Secret Handling (MCP Host)
Secret references in MCP configs
Section titled “Secret references in MCP configs”- Values prefixed with
secret:are resolved at runtime (e.g.secret:API_KEY). envFrom.secretRefaccepts keys whose ENV values are given inKEY=VALUEformat (one per line).- With a
secret:reference the configuration holds only the name of an environment variable — the value itself stays in the process ENV. - A value entered directly, by contrast, is stored as typed. It is masked in previews (
***) and, since version 0.5.0, no longer returned over the API, but it sits in the database in plain text. Use thesecret:reference if that is not acceptable.
Resolution in the orchestrator
Section titled “Resolution in the orchestrator”resolveEnvchecksenvandenvFromper server:- Reads secrets from the process ENV (
process.env). - Splits
KEY=VALUElines from secret refs. - Keeps a
missingSecretslist for absent entries.
- Reads secrets from the process ENV (
- The preview stores masked ENV values and lists missing secrets.
startuses the internalresolvedEnvvalues; servers with missing secrets get statusmissing_secretsand do not start.
Recommendations
Section titled “Recommendations”- Set secrets as environment variables in the deployment. Example (bash):
Terminal window export FILESYSTEM_API_KEY="..."export FILESYSTEM_EXTRA=$'BASE_URL=https://example.test\nTOKEN=...' - Never commit sensitive values into JSON configuration files.
- For production, integrate a secret manager (Vault, AWS Secrets Manager, etc.) and inject via ENV.
Missing secrets
Section titled “Missing secrets”- The UI should display the warning from
warnings[]and check the start status. - The REST response to
/servers/startreturns HTTP 400 witherror="secrets_missing",missingServers, a masked preview and warnings, so the user can supply the missing secrets. - General validation errors (
/servers/validate,/servers/start) returnerror="invalid_argument"with a detail object;/servers/stop/:namereturnserror="not_found"for an unknown server. - Docker hardening: volumes must be read-only (
:ro/ro), forbidden flags such as--privileged,--cap-addand--deviceare blocked, and--networkmust match the configured hardening name. - Dry run (
POST /servers/start,dryRun: true) performs all checks but starts no processes (statusdry_run). - Rootless check:
ROOTLESS_DOCKER_HOSTmust point at a rootless socket (/run/user/<uid>/docker.sock), otherwisestartaborts with a warning/error.scripts/rootless-preflight.shcreates the network (MCP_DOCKER_NETWORK) automatically.