Learn · MCP

How do I let an AI agent use a secret without putting it in the prompt?

Not by asking it politely to forget. By never handing it the value: a local MCP server injects the secret into a child process's environment and returns only that process's output. The model gets the result. It never gets the credential.

Updated 2026-11-17 · by cygnus, the developer of Bitcoffer

What actually happens when you paste a key into a chat

Three things, none of them reversible:

The usual mitigation — "rotate it afterwards" — is the tell that the workflow is broken. A credential you rotate after every use is a credential you cannot use casually, which is the entire point of having agents do the work.

The pattern that avoids it

Keep the secret in a local vault. Give the agent a way to ask for a command to be run with the secret in its environment, and return only that command's stdout. The model writes the command; the vault provides the value; the value never enters the conversation.

agent  →  run_with_secret(secret: "OPENAI_API_KEY", cmd: "curl", args: ["-sS", "https://api.openai.com/v1/models"])
vault  →  spawns curl with OPENAI_API_KEY in its environment
agent  ←  the HTTP response body, and nothing else

Four properties follow, and they are worth separating because vendors routinely merge them into one vague claim:

  1. The value is not in the tool's return payload. Structural: no code path builds a success response containing the secret.
  2. There is no tool that reveals it. Not a permission flag, not an admin mode — the tool is not registered, so a call to it returns JSON-RPC -32601 Method not found.
  3. Output is redacted as a second layer. Whatever the child process prints is passed through a filter that replaces strings matching known secret fingerprints before the text reaches the model.
  4. The audit is local. Usage is recorded on the machine that holds the vault, so "which agent used which secret" is answerable without a remote log.

The four tools, and the one that does not exist

Bitcoffer exposes exactly four read-only tools. The list is short on purpose: every tool added to this surface is another path by which a value could leak.

ToolReturnsNever returns
list_secret_namesNames, optionally filtered by vaultValues
list_secretsMetadata: name, id, category, updated timestampValues
get_secret_metadataRead-only metadata for one item, plus the login username when the item has oneValues
run_with_secretThe child process's stdout, after redactionThe value, and any of the child's other file descriptors

There is no reveal_secret, no get_password, no dump_vault, no export_all_secrets. This is the part of the design that is easiest to verify and hardest to fake: unregistered tools return -32601, so you can check the surface yourself by sending tools/list and counting what comes back.

The run_with_secret schema is deliberately small — secret, cmd, optional env_name, args, cwd. There is no shell flag, so the command is not passed through /bin/sh and cannot be a pipeline with a second command hidden behind a semicolon.

The limitation, stated plainly

Redaction is a filter over text, and a filter is not a boundary. Once a child process holds the secret in its environment, its own output is outside Bitcoffer's control. If the agent runs sh -c 'echo $OPENAI_API_KEY', the value goes to stdout and the redactor may or may not catch it — the filter looks for known fingerprints, which is a heuristic, not a guarantee.

So the guarantee has an exact shape, and it is worth stating in the form you can defend:

The value is never returned by the vault. Whether it appears in a child process's output depends entirely on what that child does with it.

In practice this means the command you allow matters more than the filter. Running a client that reads the variable and sends it to an API is safe. Running a shell that prints its environment is not, and no amount of filtering makes it safe. Treat run_with_secret as "use this credential in a tool that needs it", not as "run anything with the credential available".

How the transport is protected

A local server that hands out credentials invites an obvious question: which local process gets to talk to it? Over a Unix domain socket Bitcoffer applies four checks, and the second one is the interesting one:

CheckMechanism
Single connection lifetimeThe listener accepts once; EOF closes the server cleanly
Peer identityThe connecting process's PID must equal the PID of the process that spawned the server (LOCAL_PEERPID plus getpeereid on macOS, SO_PEERCRED on Linux). A different process, even the same user, is refused
Session challengeA random value passed in the spawn environment and echoed back on initialize, so a process that merely finds the socket path cannot use it
ReplayMessage ids must be monotonically increasing, as with stdio

The socket file is mode 0600 and its directory 0700. Missing handshake material is a configuration error, not a permissive default: the server exits rather than serving without it.

Wiring it up

The CLI ships inside the app bundle and must run from there — the signature is bound to the bundle, so a copied binary will not work:

claude mcp add --scope user bitcoffer \
  -e BITCOFFER_VAULT_DIR=/path/to/vault \
  -- "/Applications/Bitcoffer.app/Contents/Helpers/bitcoffer.app/Contents/MacOS/bitcoffer" mcp --provider bitcoffer

For a client that launches the server itself, bitcoffer mcp --uds /path/to/socket switches the transport from stdio to a Unix socket without changing the protocol frames. The MCP surface is opt-in, and it is read-only: it can list, describe and run-with, but it cannot create, edit or delete a vault item.

What this does not fix

Bitcoffer is a local-first password manager for macOS.

An encrypted vault, Touch ID unlock, and a local MCP server with four read-only tools. Secret values are injected into a child process and never returned to the model.

Download Bitcoffer Pricing