Add Keycard auth to MCP servers, REST APIs, and A2A agents
54
68%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Python: pip install keycardai-a2a uvicorn
TypeScript: npm install @keycardai/a2a @a2a-js/sdk express
@keycardai/a2a READMEkeycard run sessions)[zone]
id = "<your-zone-id>"The verified user is available via context.call_context.state["access_token"] (Python) or getKeycardAuth(requestContext).token (TypeScript). Use this as the subject_token in an RFC 8693 token exchange when calling downstream services to maintain the delegation chain.
| Error | Cause | Fix |
|---|---|---|
| 401 on all A2A requests | Expected — require_authentication=True on the JSONRPC mount | Callers must present a Keycard bearer token |
access_token missing from executor context | KeycardServerCallContextBuilder not wired | Pass context_builder=KeycardServerCallContextBuilder() to create_jsonrpc_routes (Python) or use createKeycardRequestHandler (TypeScript) |
| Agent card empty or missing capabilities | AgentServiceConfig missing description or capabilities | Set both fields in the config object |
| Delegation chain not propagating | Caller token not forwarded as subject_token | Read context.call_context.state["access_token"] and pass it as subject_token in downstream token exchange |