guardry/

guardry/Answers/MCP and secrets

How should MCP servers and clients handle secrets?

Give each MCP server only the credentials it needs, keep them out of plain-text configuration, and avoid returning secret values to the model.

MCP, the Model Context Protocol, is a protocol that lets an AI client call tools on a server. Secrets come into it in two places: the credentials a server needs to do its work, and any secret value a tool hands back to the client. A careful setup gives each server only the credentials it needs, keeps them out of plain-text configuration, and returns a secret value to the model only when a person has decided it should.

Why it matters

What a tool returns goes back to the client, where the model can read it. A tool that returns a secret value therefore puts that value in front of the model, and an agent that can read a secret can copy it.

A server that calls a service on your behalf usually needs a credential for that service. If that credential is written into a configuration file as plain text, any process that can read the file can read the credential.

What good looks like

  • Each server holds only the credentials it needs, with the narrowest permissions their provider allows.
  • Tools do the work and return the result, instead of returning the credential.
  • Configuration refers to a credential and does not contain it.
  • Reading a plain secret value through a tool is something a person turns on, not the default.

How Guardry does it

Guardry has a stdio MCP server built into the CLI. It has no plaintext-read tool unless the person starts it with --allow-plaintext-tools, and server permissions and approvals still apply.

guardry --profile coding-agent mcp config
guardry --profile coding-agent mcp serve

The first command prints the client configuration, which is a path and a profile name and no credential. The second starts the server.

Limits

If you start the server with --allow-plaintext-tools, an agent whose credential may read a secret can receive its value through MCP, and an agent that can read a secret can copy it. Guardry can perform an operation without releasing the credential for two services only: GitHub repository and issue reads for one named repository, and TOTP one-time code generation.

Questions

Can an agent read plain secret values through the Guardry MCP server?

Not unless the person starts the server with --allow-plaintext-tools. Even then, server permissions and approvals still apply.

Does the MCP client configuration contain my credential?

No. guardry mcp config prints a path and a profile name, and no credential.

Do approvals still apply over MCP?

Yes. A credential that may read secret values only after a person approves each request stays under that rule when it is used through the MCP server.