I made this little package that provides a convenient solution for stdio MCP server definitions: envmcp - npm
You just need to prefix the command with npx envmcp
in order to load your environment variables from an env file.
For your example, you could use it like this:
{
"mcpServers": {
"github-mcp": {
"command": "npx",
"args": [
"envmcp",
"npx",
"-y",
"@modelcontextprotocol/server-github"
],
}
}
}