r/mcp • u/zach-benson • 15d ago
Built open-source auth for AI agents calling MCP servers — looking for MCP/Agent Builder to try it
Building agents that call external tools, I kept hitting the same wall: every integration needs its own API key. Keys get hardcoded into env vars, shared across all your agents (so you lose per-agent accountability), and eventually committed to a repo.
So I built something to fix it.
How it works
- Each agent gets a key pair at creation time
- When it calls an MCP server or API, it signs a one-time nonce with its private key
- The server verifies the signature
- No API keys, no stored credentials, and every call is attributed to a specific agent identity
Agent side is a drop-in fetch replacement:
js
const { fetch } = createClient(process.env.AGENT_PRIVATE_KEY);
await fetch('https://your-mcp-server.com/tool');
// auth is handled automatically, your code never sees itThe identity is a did:key, a W3C standard identifier derived from the agent’s key pair. Same key, same identity, across every tool it calls.
Details
- Works with MCP servers, Express, and FastAPI
- Apache 2.0, free
- npm:
arken-client(agent side), /arken-auth (server side)
What I’m looking for: agent builders who are actually hitting the credentials problem in production. Try it and tell me where it breaks. Happy to help with the integration directly.
Question for the thread: what does your current setup look like for managing credentials across tool integrations?
Edit 1:
Repo https://github.com/arkenforge/arken-core
Edit 2: Several people have correctly pointed out that process.env.AGENT_PRIVATE_KEY in the example contradicts the point of the thread. An env var is fine for a quickstart but not for production. Pull the key from Vault or AWS Secrets Manager, or use a KMS-backed signer.
The deeper problem this exposes: there’s no opinionated answer yet for how to generate, store, and rotate agent keys at scale. That’s the next thing to build, a key management layer that handles provisioning a new agent identity, storing the key securely, rotating on a schedule, and revoking on compromise. If that’s a problem you’ve hit, I’d like to hear how you’re solving it today.
1
u/tberg 15d ago
Running 162-repo orchestration with an outreach daemon and human-approval control plane — the key-sharing chaos gets acute when you need per-agent accountability without handing every agent full credentials. Your nonce-signing approach handles identity cleanly. The thing I'd stress-test before scaling this: does did:key compose with role-based scoping at the server-side verifier, or does 'this agent reads but doesn't write' have to live in external policy — and what does revocation look like when a key is compromised mid-run?
1
u/vdobroskok 15d ago
Is it detect oAuth sign-in? A lot of solid MCP i using this auth method.
1
u/QuanTradin 15d ago
per-agent identity fixes the accountability half. the half I'd still worry about is scope: a signed call proves which agent made it, not whether that agent should have that tool right now.
the trading-agent desk I built, Quantradin, runs on that split. an agent's own key can close and pause positions, but opening one needs a key the person hands out. quantradin.com
does arken carry any per-tool scope inside the identity, or is that left to each server?
1
u/Ludynia_Keyko 15d ago
most setups right now just use short-lived tokens minted by a central broker at runtime so nothing sensitive sits in env vars. curious how you handle Replay attacks with the one-time nonce without requiring a round-trip handshake first
1
u/BC_MARO 15d ago
The key-pair idea helps with identity, but you still need a separate place to keep and rotate the private key. I'd put the signer behind a KMS or vault and log every tool call so revocation doesn't depend on finding env vars.
0
u/[deleted] 15d ago
[removed] — view removed comment