A collection of starter projects for building Keycard-protected MCP servers, agents, and other AI workloads. Each template is a self-contained project at the root of this repo. Copy a directory, follow its README.md, and you have a working project.
You are encouraged to use, modify, and extend this code.
git clone --depth=1 https://github.com/keycardai/templates
cp -R templates/<template-name> my-project
cd my-project
# follow the template's README.md from hereEach template runs with whatever the native toolchain expects (npm install && npm run start for Node, uv sync && uv run for Python, bundle install && bundle exec rackup for Ruby, ./gradlew installDist and the generated start script for Java, etc.). There is no Keycard-specific build step.
Every template ships a SPEC.md describing the Keycard resources that must be provisioned for the project to work — the Application, Resource, credential provider, what the [credentials] block should look like, and what the agent must not do. Read it before running anything against a real Keycard environment.
Agents (the Keycard skills, or your own automation) MUST treat SPEC.md as the source of truth for provisioning. The template files themselves intentionally do not encode Keycard state.
Keycard engineers can use the shared SDK test zone for SDK experiments, local template runs, and CI tests.
| Template | Flow | Language | Framework | SDK packages | Description |
|---|---|---|---|---|---|
mcp-server-python-mcp |
MCP server | Python | MCP v2 (MCPServer), Starlette |
keycardai-mcp, keycardai-starlette |
Serve a greeting tool over MCP with Keycard OAuth protection. |
mcp-server-typescript-express |
MCP server | TypeScript | Express 5 | @keycardai/express, @keycardai/mcp |
Serve a greeting tool over MCP with Keycard OAuth protection. |
mcp-server-go |
MCP server | Go | net/http |
github.com/keycardai/go-sdk |
Serve a greeting tool over MCP with Keycard OAuth protection. |
mcp-server-ruby |
MCP server | Ruby | Rack | keycardai-mcp, keycardai-oauth |
Serve a greeting tool over MCP with Keycard OAuth protection. |
mcp-server-java |
MCP server | Java | Jetty (Servlet) | ai.keycard:keycard-mcp |
Serve a greeting tool over MCP with Keycard OAuth protection. |
mcp-server-java-spring-ai |
MCP server, Agent frameworks | Java | Spring AI (WebMVC) | ai.keycard:keycard-spring-boot-starter |
Expose a Spring AI MCP tool with Keycard authentication and scope enforcement. |
mcp-delegated-access-typescript |
Delegated access | TypeScript | Express 5 | @keycardai/express, @keycardai/mcp, @keycardai/oauth |
Exchange an authenticated MCP user's token and call a protected downstream API on their behalf. |
mcp-delegated-access-go |
Delegated access | Go | net/http |
github.com/keycardai/go-sdk |
Exchange an authenticated MCP user's token for a resource-scoped token. |
mcp-delegated-access-java |
Delegated access | Java | Jetty (Servlet) | ai.keycard:keycard-mcp |
Exchange an authenticated MCP user's token for a resource-scoped token. |
mcp-brokered-credentials-python |
Brokered credentials | Python | MCP v2 (MCPServer), Starlette |
keycardai-mcp, keycardai-oauth, keycardai-starlette |
Discover and call Linear MCP tools with Keycard-brokered credentials. |
mcp-brokered-credentials-typescript |
Brokered credentials | TypeScript | Express 5 | @keycardai/express, @keycardai/mcp, @keycardai/oauth |
Discover and call Linear MCP tools with Keycard-brokered credentials. |
a2a-delegation-python |
A2A delegation | Python | Starlette | keycardai-a2a, keycardai-starlette |
Delegate a user's A2A request to a target agent that reports the verified identity claims. |
a2a-delegation-typescript |
A2A delegation | TypeScript | A2A / Express | @keycardai/a2a, @keycardai/express |
Exchange a user token to call another agent that reports the verified subject, actor and audience. |
a2a-delegation-ruby |
A2A delegation | Ruby | Rack | keycardai-a2a, keycardai-mcp, keycardai-oauth |
Exchange a user token to call another agent that reports the verified subject, actor and audience. |
a2a-delegation-java |
A2A delegation | Java | Jetty (Servlet), a2a-java | ai.keycard:keycard-a2a, ai.keycard:keycard-mcp |
Delegate a user's A2A request to a target agent that reports the verified identity claims. |
agent-python-langchain |
Workload identity, Agent frameworks | Python | LangChain | keycardai-langchain, keycardai-oauth |
Use Fly workload identity and broker per-tool-call access to Google Calendar in a LangChain agent. |
autonomous-agent-snowflake-wif |
Workload identity | TypeScript | pi-agent-core, pi-ai |
@keycardai/a2a, @keycardai/express, @keycardai/mcp, @keycardai/oauth |
Connect an autonomous agent to Snowflake with workload identity federation instead of a shared secret. |
delegated-access-typescript-cloudflare |
Workload identity | TypeScript | Cloudflare Workers | @keycardai/cloudflare, @keycardai/oauth |
Use a Worker's keypair identity to exchange a user's token and call a protected downstream resource. |
See the template catalog for flow definitions and coverage by language.
We welcome new templates. 6166 Check the inclusion criteria first, then see CONTRIBUTING.md for the template format and CI, eval, and review steps. Coding agents should also follow AGENTS.md.
MIT — see LICENSE. The Keycard name and logo are trademarks; TRADEMARKS.md states how they may be used.