Build credential-free MCP servers with single-use token redemption
Template for credential-free MCP servers on mcp-use that redeem a single-use, action-scoped Keydris token for each tool call.
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 credential-free MCP servers built on mcp-use. Keydris middleware redeems a single-use, action-scoped token for the credential each tool call needs, so the server stores no secret. Use it when you want an MCP server that never holds API keys and needs a Keydris account and gateway to redeem tokens.
What it does
This is 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 personal access token and no secret of any kind. Instead it redeems a single-use, action-scoped KIT action token for the credential each tool call needs, at call time. It is a template and 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.
The flow works like this. The Keydris proxy injects the token on params._meta["keydris/kit_action_token"] of a tools/call request, or on the authorization header as a legacy fallback. The tool builds its upstream request and the server posts the token, the MCP method, action name and parameters, and the target host, path and method to the configured gateway. The gateway returns the credentials, and the server calls the upstream API with the credential applied. Redemption happens 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/holds the kit reader.token.tsandcredentials.tsare vendored verbatim from@keydris/kit-reader, whiletypes.tsandredeem.tsare vendored and updated to the current gateway contract, since the upstream package predates the target requirement.middleware.tsis the mcp-use adapter.index.tsregisters the middleware once withserver.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, soinitializeandtools/listnever touch the gateway and a client with no token can still connect and see the tools on offer.- Inside a tool,
keydrisFetch(ctx, url, init)makes the one credentialed request: it derives the target from the URL, redeems, injects the credential and sends. The includedgithub-whoamitool shows this. 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 an object with
ok: falseand aproblem, returned as tool errors the agent can read and never thrown. Never log the credentials, although the problem side is safe to log.
When to use - and when NOT to
Use it when you want an MCP server that never stores credentials, so a leaked server or log exposes none. It requires a Keydris account: the tokens are minted and evaluated by the Keydris proxy, gateway and vault, and a gateway URL is needed to redeem against. Without one the server starts and lists its tools, but every credentialed call is refused. It needs Node 22 or newer.
Inputs and outputs
Configuration is through .env. KEYDRIS_GATEWAY_URL is required with no fallback and must be https unless loopback. If it is unset, credentialed calls refuse with a problem naming the variable. 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 install
npm run dev
The development server auto-reloads as you edit, and the mcp-use inspector runs locally at port 3000 under /mcp/inspector. npm run typecheck refreshes MCP view types and checks the project, and npm run deploy deploys to Manufact Cloud.
The template is released under the MIT License.
Integrations
mcp-use with TypeScript, the Keydris proxy, gateway and vault, the upstream keydris-reader libraries and the GitHub API for the demo tool.
Who it's for
MCP server authors who want per-call, single-use credential access instead of embedding API keys, and teams already using or evaluating Keydris.
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.