Hardcoded API keys in MCP config files pose serious security risks, developer warns
A developer has highlighted a widespread security flaw where live API keys are being stored directly in .mcp.json configuration files used to set up MCP servers. These files often get committed to code repositories, shared in tutorials, or pasted into bug reports, exposing sensitive credentials like Stripe secret keys. While wrapping servers in a secret manager's CLI removes keys from config files, the approach breaks when developer sessions expire, causing multiple MCP servers to fail simultaneously with unhelpful error messages. The developer built a tool called mcp-secrets-runner that uses machine credentials instead of human sessions to fetch secrets at runtime, supporting backends like Infisical, 1Password, and HashiCorp Vault. The tool also includes a diagnostic command to clearly identify the four most common MCP server startup failures, which otherwise surface as identical, opaque errors in MCP clients.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in