mcp-agent cloud has two phases:
- Deployment secrets – values known at deploy time (provider API keys, service accounts, webhooks). Stored encrypted, mounted into the runtime automatically.
- User secrets – values each consumer must supply (personal access tokens, OAuth refresh tokens). Collected per user via
mcp-agent cloud configureand scoped to that user’s configuration.
Secret files at a glance
| File | When | Contains | Checked into git? |
|---|---|---|---|
mcp_agent.secrets.yaml | Before deploy | Raw values you author locally | No (add to .gitignore) |
mcp_agent.deployed.secrets.yaml | Generated by mcp-agent deploy | Handles for deployment secrets, !user_secret placeholders | Yes – safe to commit |
mcp_agent.configured.secrets.yaml | Generated by mcp-agent cloud configure | User-supplied secrets bound to secret handles | Optional – safe to share with that user only |
Step 1 – author your secrets file
Createmcp_agent.secrets.yaml next to mcp_agent.config.yaml:
Step 2 – transform during deployment
When you runmcp-agent deploy, the CLI:
- Loads
mcp_agent.secrets.yaml. - Asks how to treat each value (unless already tagged or using
--non-interactive). - Creates secrets via the cloud API and stores the resulting handles.
- Writes
mcp_agent.deployed.secrets.yamland bundles it with your deployment.
mcp_agent.deployed.secrets.yaml
Each !secret handle references an encrypted value stored in the control plane. Handles are opaque and cannot be used outside the deployment.
Step 3 – collect end-user secrets (optional)
If you exposed any!user_secret entries, share the deployment URL with your users and have them run:
<app_id> is the hostname printed in your deployment output (for example, app_abc123xyz).
The CLI:
- Checks what user secrets are required (
--paramsshows them without storing). - Prompts for each secret (or reads them from
--secrets-file). - Writes
mcp_agent.configured.secrets.yaml(unless--dry-run). - Uploads encrypted user secret handles tied to the caller’s API key.
--dry-run to validate without persisting changes.
Sharing with automated clients
- Provide
mcp_agent.configured.secrets.yamlalongside the deployment URL for headless environments (CI, scheduled jobs). - Re-run
mcp-agent cloud configure --paramsin pipelines to assert the contract matches expectations. - If you must rotate secrets automatically, script the configure command with
--secrets-file.
Accessing secrets in code
Secrets are injected into your app via the config layer. Useapp.config or the global settings helper:
Deployment secrets are available to all users of the app. User secrets are scoped to the specific user/configuration that ran mcp-agent cloud configure and are only injected when that user’s API key is used to connect.
Non-interactive + CI/CD
- Reuse existing handles:
mcp-agent deploy --non-interactivereuses secrets stored inmcp_agent.deployed.secrets.yamland fails if new values are required. - Custom API URL/keys: set
MCP_API_KEY(or use--api-key) andMCP_API_BASE_URLfor staging environments. - Partial updates: if you add a new entry to
mcp_agent.secrets.yaml, the CLI prompts only for the new value.
Advanced tips
MCP_APP_SETTINGS_PRELOAD
MCP_APP_SETTINGS_PRELOAD
For local testing or one-off overrides, set
MCP_APP_SETTINGS_PRELOAD to a YAML string that merges into the app settings before initialization. Useful when you do not want to create a secrets file on disk.Secret reuse across deployments
Secret reuse across deployments
Handles are per deployment. If you want to share the same credential across multiple apps, store the raw value in a secure password manager and paste it during each deploy. Secret rotation APIs are on the roadmap.
Auditing & rotation
Auditing & rotation
Today rotation is manual (
mcp-agent deploy with a new value). We log all secret creation/update events for future audit surfaces. Automatic rotation hooks are planned post-beta.Workspace-scoped secrets
Workspace-scoped secrets
By default secrets are scoped to your user account. Team-wide sharing is coming with the upcoming workspace model—expect CLI flags to target a workspace instead of a personal scope.
Troubleshooting
- “Must have API key to process secrets” – run
mcp-agent login(or setMCP_API_KEY) before deploying. - Secrets not injected at runtime – double-check
mcp_agent.deployed.secrets.yamlis present in your project and that you are reading viaget_settings(). Also ensure the file is not ignored by.mcpacignore. - Configure prompts unexpectedly – you likely tagged a value as
!user_secret. If it should be global, re-runmcp-agent deployand choose “store as deployment secret”. - Need to revoke a user’s secrets – run
mcp-agent cloud app revoke-config --id <configuration_id>(coming soon). For now, delete the configuration via the API or ask the user to run configure again.
