Where MCP Secrets Actually Sit

Noam Dekel 5 min read

The MCP spec says nothing about where secrets live. It specifies the call: a JSON-RPC message from host to server, a method name, some parameters. What the server does with those parameters, and which credential it uses to carry out the operation, falls outside the protocol. That restraint keeps MCP small and leaves every credential decision to the implementation, where practices differ sharply.

Finding the secrets in a working MCP system means looking in three places: the agent host's credential store, the server's own configuration, and the access control layer on the far side. A review that opens only one of them sees a third of the picture.

The Host Carries the Credential

Most deployments put credential management on the agent host, over stdio and HTTP alike.

On stdio, the server runs as a child of the host, and environment variables injected at launch are the usual channel. The host fetches the secret from wherever it keeps it, whether a vault, an env file or a config checked into the repo, and puts it into the server's environment at startup. From there the server reads it into memory and keeps it for the life of the process.

On HTTP, two patterns show up. The host can attach credentials to each call as a bearer token or API key, which gives it control over when they appear. Or the server can be configured with credentials ahead of time, which pushes management into the deployment configuration, and that configuration may not be guarded as carefully as the secret inside it.

What "Credential Store" Means Here

The phrase gets used loosely. Concretely, an agent's store is one of a few things: environment variables in the container or process, a reference into a cloud vault (AWS Secrets Manager, HashiCorp Vault, Azure Key Vault), a file read at boot, or an OAuth token fetched and held in memory.

Each has its own exposure. Env vars are convenient, survive restarts, and show up in process inspection. A vault reference depends on the IAM permissions of the agent's execution role, and the breadth of that role is its own question. A file at a known path can be read by anything else on the host with sufficient permission. An in-memory token dies with the process but is visible to any code sharing that process.

Storage quality only covers half of it. The question worth asking is who else can reach the store, and what they can do with what they find. In a shared container environment, that list is often longer than anyone assumed.

Proxy, Not a Vault

An MCP server relays operations; it does not warehouse secrets. When an agent invokes a tool, the server runs the operation with the credentials it holds and returns the result. In most setups the credential never travels from agent to downstream system. The agent sees the output.

That layout buys a real boundary. The agent need not hold the database password or the API key; the server does. Compromise the agent process and an attacker does not walk away with the raw secret. They walk away with the ability to call the server's tools as the agent.

The boundary is not immunity. Whoever can drive those tools through the agent can do whatever the tools allow. Write operations mean writes. Administrative functions mean administration. The line separates holding the key from wielding it, and how much that matters depends on which operations the tool list exposes.

Shared Servers, Shared Reach

When one server serves several agents, a specific question appears: does each connection come with its own scoped credential, or does every call run on one shared credential no matter who started it?

In a lot of current deployments it is the second. The connecting host identifies the agent, but the credential reaching downstream is the same for all of them. A tightly scoped agent and a broad one sharing that server end up with identical downstream reach. Scope control that ought to sit at the per-agent tool layer collapses into one permission set for the whole server.

A shared credential is not automatically a mistake; some architectures work that way on purpose. What tends to go unanswered is whether per-agent scoping is needed and whether the current setup provides it. That question rarely gets a deliberate answer without a review built to ask it.

Four Checks in a Secrets Review

A focused pass over an MCP deployment should establish where each server's credential material sits and who can reach it; whether that credential is scoped to the minimum the tools require; whether multiple agents on one server carry distinct identities or share a single credential; and how rotation works, including what happens to running sessions when a credential turns over.

Rotation is the check that gets skipped. A key that can only be rotated by restarting every server process will interrupt service unless the restart is coordinated with the agent deployment. That friction is a genuine reason rotation gets postponed, and postponed rotation means credentials outliving the lifetime they were meant to have.

Back to Security Brief