避免意外地将API密钥提交到你的仓库!
在使用Cursor AI(以及其他AI编码助手)与MCP服务器时,你需要在./cursor/mcp.json文件中包含API密钥:
{
"mcpServers": {
"firecrawl": {
"command": "npx",
"args": [
"-y",
"firecrawl-mcp"
],
"env": {
"FIRECRAWL_API_KEY": "sk_live_ohno-this-should-NOT-be-in-git" // 💀
}
}
}
}
这是一场等待发生的安全噩梦。 一旦不小心提交,你的密钥就会暴露在Git历史记录中。
get-mcp-keys从你家目录中的一个安全文件加载API密钥,完全将其排除在你的仓库之外。
.mcprc文件touch ~/.mcprc
chmod 600 ~/.mcprc # 只让你自己可以读取
# ~/.mcprc
FIRECRAWL_API_KEY="your_actual_api_key_here"
BRAVE_API_KEY="another_secret_key_here"
# 添加任何其他使用的MCP服务器密钥
{
"mcpServers": {
"firecrawl": {
"command": "npx",
"args": [
"@masonator/get-mcp-keys", // 🔐
"npx",
"-y",
"firecrawl-mcp"
]
}
}
}
就这样! get-mcp-keys工具会:
~/.mcprc加载你的API密钥适用于需要环境变量的任何MCP服务器,包括:
get-mcp-keys读取你的.mcprc文件,将这些环境变量添加到当前环境中,然后执行你在参数列表中指定的任何命令。它简单而有效!

MIT
⭐ 如果这个工具帮助你避免了提交密钥,请给仓库加星!