Description
Environment variables configured for MCP servers don't appear to be passed correctly to the server process, causing authentication failures with the Notion MCP server.
Steps to Reproduce
- Configure Notion MCP server via Copilot CLI MCP settings (type: local)
- Command:
npx -y @notionhq/notion-mcp-server
- Set environment variable:
OPENAPI_MCP_HEADERS={"Authorization": "ntn_xxx", "Notion-Version": "2022-06-28"}
- Save and restart Copilot CLI
- Try to query Notion workspace
Expected Behavior
The Notion MCP server should receive the environment variable and authenticate successfully.
Actual Behavior
Always returns 401 unauthorized error: {"status":401,"object":"error","code":"unauthorized","message":"API token is..."}
Notes
- The same token works when tested directly via curl against the Notion API
- The same token and
OPENAPI_MCP_HEADERS format works correctly in Claude Code
- Also tried
NOTION_TOKEN environment variable - same 401 result
- The config file at
~/.copilot/mcp-config.json shows the correct values are saved
Config File Contents
{
"mcpServers": {
"notion": {
"type": "local",
"command": "npx",
"tools": ["*"],
"args": ["-y", "@notionhq/notion-mcp-server"],
"env": {
"OPENAPI_MCP_HEADERS": "{\"Authorization\": \"ntn_xxx\", \"Notion-Version\": \"2022-06-28\"}"
}
}
}
}
Environment
- Copilot CLI Version: 0.0.365 (Commit 76d0881)
- OS: macOS Darwin 25.2.0
- MCP Server: @notionhq/notion-mcp-server (via npx)
Description
Environment variables configured for MCP servers don't appear to be passed correctly to the server process, causing authentication failures with the Notion MCP server.
Steps to Reproduce
npx -y @notionhq/notion-mcp-serverOPENAPI_MCP_HEADERS={"Authorization": "ntn_xxx", "Notion-Version": "2022-06-28"}Expected Behavior
The Notion MCP server should receive the environment variable and authenticate successfully.
Actual Behavior
Always returns 401 unauthorized error:
{"status":401,"object":"error","code":"unauthorized","message":"API token is..."}Notes
OPENAPI_MCP_HEADERSformat works correctly in Claude CodeNOTION_TOKENenvironment variable - same 401 result~/.copilot/mcp-config.jsonshows the correct values are savedConfig File Contents
{ "mcpServers": { "notion": { "type": "local", "command": "npx", "tools": ["*"], "args": ["-y", "@notionhq/notion-mcp-server"], "env": { "OPENAPI_MCP_HEADERS": "{\"Authorization\": \"ntn_xxx\", \"Notion-Version\": \"2022-06-28\"}" } } } }Environment