When a team collaborates on the same project, it would be better that they share the same settings, copilot instructions, and, of course, MCP configurations.
To use MCP inside your workspace, you need to create an MCP.json file under .vscode
If you want to push the MCP.json file to share servers with other collaborators, you have to care about sensitive secrets like elasticUrl, elasticApiKey
The ugly solution is to push the file and let team members set the secret values, but what if a member push that file by mistake with real secrets? π¨
Here is a safe and clean way using envmcp package that lets you use environment variables in your VSCODE MCP client in 2 steps:
- Create an .env.mcp file that contains the env vars needed by the MCP server in order to run. Example for @octodet/elasticsearch-mcp:
# .env.mcp file π‘ π
ES_URL=https://esUrl.com
ES_API_KEY=mYaPiKeY==
ES_VERSION=8
Don't forget to add .env.mcp to .gitignore
And change the MCP.json config to
{
"servers": {
"elasticsearch": {
"command": "npx",
"args": ["envmcp", "npx", "-y", "@octodet/elasticsearch-mcp@1.0.7"],
"type": "stdio"
}
}
}
Required env vars for the MCP will be picked automatically from the .env.mcp file. Start your server and enjoy!
Top comments (0)