safekeys/integration-mcp-server [built]
The Safekeys MCP server exposes secret tooling to every MCP-capable agent runtime — Claude, Cursor, Codex, Gemini — through one standard tool bus. It is the highest-leverage MVP integration: agents can create and use secrets with no per-vendor SDK, receiving only tokens, paths, and status.
Status: built
Why this exists
Every agent framework integration is a thin adapter on the same contract, so building them one by one is wasted effort. MCP is the common tool bus across the major 2026 runtimes, which makes a single MCP server the cheapest way to cover many products at once and the best adoption wedge.
Design decisions
mcp-is-first [accepted]
Decision: Make the MCP server the first harness integration shipped.
Rationale: The blueprint identifies MCP as the highest-leverage integration because it is the common tool bus across Claude, Cursor, Codex, Gemini, and most 2026 agent runtimes — one server covers many products without per-vendor SDKs.
three-harnesses-only [accepted]
Decision: Limit MVP integrations to the MCP server, the CLI exec wrapper, and the Python SDK.
Rationale: The integration surface that matters is agent asks to use a secret, sidecar injects it outside the model — every additional framework is another thin adapter on that same contract. Three covers the two-agent demo and the major runtimes.
examples-not-runtimes [accepted]
Decision: Support further harnesses later as examples calling the same SDK or MCP tools.
Rationale: Maintaining dedicated runtimes per framework creates ongoing cost with no new capability; examples demonstrate integration without becoming maintenance burdens.
mcp-holds-no-credential [accepted]
Decision: The MCP server holds no control-plane API key and no key material; list and revoke are proxied through the sidecar rather than called directly.
Rationale: The MCP server runs inside the agent's process space. Giving it a control-plane credential would mean a compromised agent inherits admin authority — able to mint tokens, read the audit log, and rewrite policy — simply by hosting the server. Routing through the sidecar keeps the credential in the privileged process and the agent-adjacent process empty-handed.
Alternatives considered:
- Let the MCP server hold the API key and call the control plane directly — rejected: Directly contradicts the boundary the rest of the architecture is built on: the component nearest the model would hold the most authority.
- Give the MCP server a narrow, read-only credential — rejected: Still a credential in the model's process space, and scope creep over time is near-certain. Zero credentials is a property that cannot erode.
Consequences: The sidecar gains op=list and op=revoke. The MCP server cannot function without a local sidecar, which is the intended fail-closed behaviour.
Date: 2026-09-23
create-takes-a-source-file [accepted]
Decision: create_secret accepts a source_file path, never a value parameter.
Rationale: A model authoring a tool call can name a host path it knows exists, but it never holds the bytes — the sidecar reads the file itself. Omitting a value parameter entirely means a model cannot pass one even when instructed to by a prompt injection, which is a structural guarantee rather than a behavioural rule.
Consequences: The caller must write the secret to a file out-of-band first. This is a deliberate ergonomic cost in exchange for the value never entering model context.
Date: 2026-09-23
stdio-transport-single-server [accepted]
Decision: Use standard MCP over stdio with no vendor-specific code.
Rationale: MCP is the common tool bus across the major runtimes, so one server covers Claude, Cursor, Codex, and Gemini with no per-vendor adapter. A test asserts no source file branches on a vendor, making the property enforced rather than aspirational.
Date: 2026-09-23
no-interactive-secret-prompt [accepted]
Decision: create_secret takes a file path the sidecar reads; it never prompts the operator interactively and never accepts a literal value parameter.
Rationale: An interactive prompt would depend on the MCP client supporting elicitation, and a value parameter would put the secret in model context. Both were checked empirically rather than assumed: opencode 1.18.9 declares only roots in its client capabilities — no elicitation form or url mode — so a prompt-based flow could not work in the harness we target first. MCP itself forbids requesting secrets via form-mode elicitation, and the sanctioned URL mode requires client support too. A file path needs neither: it works in any client, and the model authoring the call never holds the bytes.
Alternatives considered:
- Prompt the operator via MCP elicitation (form mode) — rejected: MCP explicitly forbids requesting credentials through form-mode elicitation, and opencode does not declare the capability, so the flow would silently fail in our primary harness.
- URL mode elicitation to an out-of-band page — rejected: The correct pattern for asking an operator for a credential, and worth revisiting for a hosted setup — but it requires client support, cannot move a secret to a different agent, and adds a web surface. A local file is simpler and works everywhere.
- Accept a value parameter on create_secret — rejected: Puts the plaintext in model context, which is the one thing Safekeys exists to prevent, and a prompt injection could then capture it.
Consequences: The caller must write the secret to a file out-of-band first. This is a deliberate ergonomic cost. Verified against opencode's actual declared capabilities, so the decision rests on evidence rather than an assumption about the ecosystem.
Date: 2026-09-26
How it works
Expose Safekeys tools over MCP (expose-tools)
The MCP server registers token-only tools with the host runtime.
- Setup — MCP server starts and registers create_secret, resolve_for_tool, list, and revoke tools.
- Observe — The host agent runtime discovers the tools through the standard MCP handshake.
- Observe — Tool schemas expose identifiers, tokens, and paths only.
Call a Safekeys tool from an agent (call-tool)
The agent invokes a tool and receives a token or status, never a value.
- Receive — MCP server receives a tool call from the host runtime.
- Send — The handler forwards the operation to the local sidecar over its socket.
- Receive — A token, path, or status is returned to the agent.
- Observe — The tool result contains no plaintext, and the call arguments never carried a value.