Build credential-free MCP servers with single-use token redemption
An mcp-use MCP server template that holds no API keys, redeeming single-use Keydris tokens for credentials at call time instead.
1.0.0Add to Favorites
Why it matters
Enable developers to build MCP servers that never store API keys, tokens, or secrets by redeeming single-use, action-scoped tokens at call time through Keydris middleware, eliminating credential exposure and simplifying secret management.
Outcomes
What it gets done
Redeem single-use KIT action tokens for credentials at the moment each tool call executes
Wire Keydris kit reader middleware into mcp-use servers to intercept and authorize outbound requests
Bootstrap new MCP servers from a template with credential redemption already configured
Apply just-in-time credentials to upstream API requests without storing secrets in the server
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Retrieves the authenticated GitHub user information using Keydris credential redemption.
Overview
Mcp Auth Keydris Template
A template for building credential-free MCP servers on mcp-use, with Keydris kit-reader middleware wired in. The server holds no API keys itself; it redeems a single-use, action-scoped token per tool call for the exact credential needed, at the moment the outbound request is made. Use it as a starting point for an MCP server whose tools call credentialed upstream APIs and should never store long-lived secrets; requires a Keydris account and gateway URL, and ships only one demo tool to replace.
What it does
mcp-auth-keydris-template is a template for building credential-free MCP servers with mcp-use, with the Keydris kit reader wired in as middleware. The server itself holds no API key, personal access token, or secret of any kind: for each tools/call, it redeems a single-use, action-scoped KIT action token (handed to it by a Keydris proxy in params._meta["keydris/kit_action_token"], or as a legacy fallback on the authorization header) for the exact credential that call needs, at the moment the outbound request is made - the Keydris gateway requires the downstream request target alongside the action before it will mint one. One token authorizes exactly one outbound request: the gateway consumes it atomically and a second spend against the same token is refused locally.
When to use - and when NOT to
Use it as a starting point when building an MCP server whose tools call credentialed upstream APIs and you want zero long-lived secrets sitting in the server's config or environment - the middleware arms a one-shot credential spend bound to the wire-exact MCP call rather than storing anything. It requires a Keydris account and a gateway URL to redeem against; without KEYDRIS_GATEWAY_URL set, the server still starts and lists its tools (so a client with no token can connect and see what's on offer), but every credentialed call is refused with a problem naming that variable. This is explicitly a template, not a finished server - it ships one demo tool (github-whoami) to clone and replace, not a production integration.
Capabilities
index.ts registers the middleware once (server.use("mcp:tools/call", keydrisCredentials(reader))) and arms the one-shot spend; only tools/call is gated, initialize and tools/list never touch the gateway. Inside a tool, keydrisFetch(ctx, url, init) derives the request target from the URL, redeems the token, injects the credential, and sends the request in one call; for custom transports, kitSpendFrom(ctx) returns the raw spend and applyCredentials(...) does the injection separately. Redemption failures come back as { ok: false, problem } and are returned to the agent as a readable tool error rather than thrown - the template's own rule is to never log the resolved credentials, only the problem side. The kit-reader code under src/keydris/ is vendored from the upstream @keydris/kit-reader package (token.ts, credentials.ts verbatim; types.ts and redeem.ts updated to the current gateway contract, which added the target requirement after the upstream package shipped).
How to install
Built with create-mcp-use-app, so it's a standard mcp-use TypeScript project. With Node 22+ and a Keydris account and gateway URL in hand:
npm install
npm run dev
Then open http://localhost:3000/mcp/inspector to test the server; it auto-reloads as you edit tools and prompts. npm run typecheck refreshes MCP view types and runs the local TypeScript compiler. Configuration is via .env: KEYDRIS_GATEWAY_URL is required with no fallback (must be https unless loopback), KEYDRIS_TOKEN_HEADER defaults to authorization as the legacy fallback header, and GITHUB_API_BASE defaults to https://api.github.com for the demo tool. npm run deploy ships it to Manufact Cloud.
Who it's for
Developers building MCP servers that need to call credentialed upstream APIs (starting from the bundled GitHub whoami example) who want the server process itself to never hold or store the actual API keys - the Keydris proxy, gateway, and vault own credential issuance instead. The template itself is MIT-licensed.
Source README
keydris-manufact-template: Credential-Free MCP Server Template for mcp-use
A template for building credential-free MCP servers with mcp-use, with the Keydris kit reader wired in as middleware. The server holds no API key, no PAT, no secret of any kind: it redeems a single-use, action-scoped KIT action token for the credential each tool call needs, at call time.
An MCP server that holds no credential of its own. One single-use token, one action, one call.
Website · Discord · keydris-reader · mcp-use docs
What this is
This is a template, not a finished server: clone it, keep the middleware, and replace the demo tool with your own. It was bootstrapped with create-mcp-use-app and adds the Keydris kit reader as mcp-use middleware, following the upstream keydris-reader libraries.
Requires a Keydris account. The tokens this server redeems are minted and evaluated by the Keydris proxy, gateway, and vault. Sign up at keydris.com to get a gateway URL to redeem against; without one, the server starts and lists its tools, but every credentialed call is refused.
The flow
proxy ──► POST /mcp
params._meta["keydris/kit_action_token"] = token
──► this server
tool builds its upstream request, then:
this server ──► POST {KEYDRIS_GATEWAY_URL}
{token, mcp:{method,action_name,parameters},
target:{host,path,method}}
◄── {credentials:[{type,name,prefix,value}]}
this server ──► the upstream API, credential applied
For each tools/call, the server redeems the single-use KIT action token the Keydris proxy injected on params._meta["keydris/kit_action_token"] (or, as a legacy fallback, on the authorization header) for the credential that one call needs - at the moment the outbound request is made, because the gateway requires the downstream target alongside the action.
How the template is wired
src/keydris/- the kit reader.token.tsandcredentials.tsare vendored verbatim from@keydris/kit-reader;types.tsandredeem.tsare vendored and updated to the current gateway contract (the upstream package predates thetargetrequirement);middleware.tsis the mcp-use adapter.index.tsregisters the middleware once:server.use("mcp:tools/call", keydrisCredentials(reader)). It does not redeem - it arms a one-shot spend bound to the wire-exact MCP call. Onlytools/callis armed;initializeandtools/listnever touch the gateway, so a client with no token can still connect and see what is on offer.- Inside a tool, make the one credentialed request with
keydrisFetch(ctx, url, init)- it derives the target from the URL, redeems, injects the credential, and sends. See thegithub-whoamitool. For custom transports,kitSpendFrom(ctx)returns the raw spend andapplyCredentials(...)does the injection. - One token authorizes one outbound request: the gateway consumes it atomically, and a second spend is refused locally. Failures arrive as
{ ok: false, problem }and are returned as tool errors the agent can read, never thrown. Never logcredentials(theproblemside is safe to log).
Getting Started
Prerequisites
- A Keydris account, and the gateway URL it gives you to redeem against
- Node 22+
Run the development server
npm install
npm run dev
Open http://localhost:3000/mcp/inspector with your browser to test your server.
You can start building by editing the entry file. Add tools and prompts - the server auto-reloads as you edit.
Run npm run typecheck to refresh MCP view types and check the project with its local TypeScript compiler.
Configuration
Configure via .env (see .env.example):
| Variable | Default | Meaning |
|---|---|---|
KEYDRIS_GATEWAY_URL |
(required - no fallback) | Where this server redeems the KIT action token it was handed. Must be https unless loopback. Unset, the server starts and lists tools, but every credentialed call refuses with a problem naming this variable. |
KEYDRIS_TOKEN_HEADER |
authorization |
Legacy header accepted as a fallback; tokens normally arrive in MCP params._meta. |
GITHUB_API_BASE |
https://api.github.com |
Upstream API base for the github-whoami demo tool. |
Learn More
To learn more about mcp-use, MCP, and the kit reader:
- mcp-use Documentation - guides, API reference, and tutorials
- keydris-reader - the upstream Node and Python kit-reader libraries this template vendors
- keydris.com - the proxy, gateway, and vault the tokens are redeemed against
Deploy on Manufact Cloud
npm run deploy
Star History
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.