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
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.
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.
src/keydris/ — the kit reader. token.ts and credentials.ts are vendored verbatim from @keydris/kit-reader; types.ts and redeem.ts are vendored and updated to the current gateway contract (the upstream package predates the target requirement); middleware.ts is the mcp-use adapter.index.ts registers 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. Only tools/call is armed; initialize and tools/list never touch the gateway, so a client with no token can still connect and see what is on offer.keydrisFetch(ctx, url, init) — it derives the target from the URL, redeems, injects the credential, and sends. See the github-whoami tool. For custom transports, kitSpendFrom(ctx) returns the raw spend and applyCredentials(...) does the injection.{ ok: false, problem } and are returned as tool errors the agent can read, never thrown. Never log credentials (the problem side is safe to log).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.
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. |
To learn more about mcp-use, MCP, and the kit reader:
npm run deploy
1 commits
TypeScript
100.0%
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
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.
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.
src/keydris/ — the kit reader. token.ts and credentials.ts are vendored verbatim from @keydris/kit-reader; types.ts and redeem.ts are vendored and updated to the current gateway contract (the upstream package predates the target requirement); middleware.ts is the mcp-use adapter.index.ts registers 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. Only tools/call is armed; initialize and tools/list never touch the gateway, so a client with no token can still connect and see what is on offer.keydrisFetch(ctx, url, init) — it derives the target from the URL, redeems, injects the credential, and sends. See the github-whoami tool. For custom transports, kitSpendFrom(ctx) returns the raw spend and applyCredentials(...) does the injection.{ ok: false, problem } and are returned as tool errors the agent can read, never thrown. Never log credentials (the problem side is safe to log).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.
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. |
To learn more about mcp-use, MCP, and the kit reader:
npm run deploy
1 commits
TypeScript
100.0%