latchkey
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@latchkeyMint a latchkey for http_request, max 10 uses, 1 hour TTL"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
latchkey
Capability-token gate for AI agents. Mint time-boxed, scope-limited grants ("latchkeys") that authorize specific tool calls. Agents present a key; the gate verifies TTL, scopes, audience, and spend limits before allowing the call.
Full MCP surface for mint / revoke / introspect / authorize — plus CLI and a hash-chained audit log.
Why
Agent tool access is often all-or-nothing. Latchkey lets you hand an agent a narrow, expiring, use-capped credential instead of ambient authority — including delegation chains (A mints a tighter key for B) and an emergency kill-switch.
Related MCP server: Broker
Features
HMAC-signed tokens (
lk1.…) viaLATCHKEY_SECRET— no external KMS requiredScopes:
tool:http_request,tool:file_write:path=/tmp/**,risk:irreversibleUse-once keys (
maxUses: 1) and spend limitsDelegation with narrow-only MintPolicy
Revocation list + revoke-all kill-switch
Hash-chained audit log + Mermaid grant-graph export
MCP tools + CLI
Packages
Package | Role |
| LatchKey, KeyStore, MintPolicy, Authorizer, RevocationList, AuditLog |
| Stdio MCP server |
|
|
Quick start
git clone https://github.com/SanjoyDat1/latchkey.git
cd latchkey
npm install
cp .env.example .env # set LATCHKEY_SECRET
export LATCHKEY_SECRET="$(openssl rand -hex 32)"
npm run build
npm test
npm run typecheckCLI
export LATCHKEY_SECRET="$(openssl rand -hex 32)"
npx latchkey mint \
--audience coding-agent \
--scope 'tool:file_write:path=/tmp/**' \
--scope 'tool:http_request' \
--ttl-ms 3600000 \
--max-uses 20
npx latchkey authorize --token "$TOKEN" --tool file_write --param path=/tmp/out.txt --audience coding-agent
npx latchkey export --format mermaid
npx latchkey revoke --all # emergency kill-switchUse LATCHKEY_STORE_PATH so mint/authorize share state across CLI processes.
Cursor MCP config
Add to your Cursor MCP settings (stdio; logs go to stderr only):
{
"mcpServers": {
"latchkey": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/latchkey/packages/mcp-server/dist/index.js"],
"env": {
"LATCHKEY_SECRET": "replace-with-long-random-secret-32chars-min",
"LATCHKEY_ADMIN_TOKEN": "replace-with-admin-token-16chars-min",
"LATCHKEY_STORE_PATH": "/ABSOLUTE/PATH/TO/latchkey/.latchkey/store.json",
"LATCHKEY_AUDIT_PATH": "/ABSOLUTE/PATH/TO/latchkey/.latchkey/audit.json"
}
}
}
}Admin tools (lk_mint, lk_revoke, lk_list_active, lk_audit_query, lk_export) require adminToken matching LATCHKEY_ADMIN_TOKEN. lk_authorize / lk_introspect only need a latchkey token (authorize also requires audience).
MCP tools
Tool | Purpose |
| Mint a latchkey (optional |
| Revoke by id/token, or |
| Status without consuming a use |
| Gate a tool call (consumes a use on allow) |
| List live keys |
| Query hash-chained audit events |
| Mermaid grant graph or JSON snapshot |
Token format
lk1.<base64url(payload)>.<base64url(hmac_sha256)>Signed with HMAC-SHA256(LATCHKEY_SECRET, "lk1." + payload). Verification uses constant-time comparison.
Secret: set LATCHKEY_SECRET (min 32 characters). Set LATCHKEY_ADMIN_TOKEN for MCP admin tools. Never commit secrets. Rotate by minting new keys and revoking old ones.
Architecture
See docs/ARCHITECTURE.md and docs/PLAN.md.
flowchart LR
Host[Agent Host] -->|MCP| Server[latchkey-mcp]
Server --> Core[Authorizer / MintPolicy]
Core --> Store[KeyStore]
Core --> Rev[RevocationList]
Core --> Audit[AuditLog]License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Zero-trust gateway for AI agents: score tool calls, verify agent cards, enforce policy, audit.
- FullmaktOAuthai.fullmakt
Credential broker for AI agents: scoped, revocable API access with policy enforcement and audit.
OAuth 2.1 short-link tools for AI agents with scoped tokens, approvals, audit logs, and revocation.
Give your AI hands. Identity, credential vault, and API gateway for autonomous agents.
Related MCP Servers
- AlicenseAqualityAmaintenanceLocal zero-trust permission gateway for AI agents. Enforces policy-based tool authorization, human approvals, scoped permissions, and cryptographically verifiable audit logs.45Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to securely perform privileged actions like creating GitHub issues by minting short-lived, single-purpose tokens on demand, with policy enforcement and audit logging.MIT
- AlicenseNot gradedqualityBmaintenanceGates agent tool execution with human approval, audit trails, and replay-resistant permits, enabling safe use of tools in agent loops.15 PyPIMIT
- AlicenseNot gradedqualityCmaintenanceProvides permission gates and tamper-evident audit logging for AI agent tool executions, with declarative policies, consent ladders, and hash-chained verification.MIT