Skip to content

Add per-server service authentication#19

Merged
dgellow merged 4 commits intomainfrom
sam/support-basic-auth
Jul 2, 2025
Merged

Add per-server service authentication#19
dgellow merged 4 commits intomainfrom
sam/support-basic-auth

Conversation

@dgellow
Copy link
Member

@dgellow dgellow commented Jul 1, 2025

Previously, authentication was configured globally at the proxy level. This meant all servers had to use the same auth method.

Now each MCP server can have its own authentication. This is useful when you have different services that need different auth - for example, one service uses API keys while another uses basic auth.

Example config:

{
  "proxy": {
    "baseURL": "http://localhost:8080",
    "addr": ":8080"
  },
  "mcpServers": {
    "postgres": {
      "transportType": "stdio",
      "command": "docker",
      "args": ["run", "-i", "mcp/postgres"],
      "serviceAuths": [
        {
          "type": "bearer",
          "tokens": ["api-key-123", "api-key-456"]
        }
      ]
    },
    "notion": {
      "transportType": "sse",
      "url": "https://notion-mcp.example.com/sse",
      "serviceAuths": [
        {
          "type": "basic",
          "username": "admin",
          "password": {"$env": "NOTION_PASSWORD"}
        }
      ]
    }
  }
}

When a server requires user tokens, each service auth can specify its own:

"serviceAuths": [
  {
    "type": "bearer",
    "tokens": ["service-key"],
    "userToken": {"$env": "NOTION_USER_TOKEN"}
  }
]

Allow each MCP server to define its own auth methods (basic/bearer) instead of global proxy auth. This enables different auth for different services.
@dgellow dgellow marked this pull request as draft July 1, 2025 16:36
@dgellow dgellow marked this pull request as ready for review July 2, 2025 07:23
Copy link
Member Author

@dgellow dgellow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dgellow dgellow enabled auto-merge (squash) July 2, 2025 07:36
@dgellow dgellow merged commit 54459fb into main Jul 2, 2025
1 check passed
@dgellow dgellow deleted the sam/support-basic-auth branch July 2, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant