Skip to content

MCP server environment variables not passed correctly to Notion MCP server #1100

@Abdull-UV

Description

@Abdull-UV

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

  1. Configure Notion MCP server via Copilot CLI MCP settings (type: local)
  2. Command: npx -y @notionhq/notion-mcp-server
  3. Set environment variable: OPENAPI_MCP_HEADERS={"Authorization": "ntn_xxx", "Notion-Version": "2022-06-28"}
  4. Save and restart Copilot CLI
  5. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions