Skip to content

OAuth endpoints (/oauth/authorize and /oauth/token) are not accessible through Secure MCP Tunnel #23

Description

@xlingsy

Summary

I'm trying to expose coding-tools-mcp through the OpenAI Secure MCP Tunnel and use it with ChatGPT Connector using OAuth 2.1 (Authorization Code + PKCE).

The MCP endpoint works correctly, but OAuth cannot complete because the OAuth endpoints exposed in the discovery metadata are not reachable through the tunnel.

I'm not sure whether this is expected behavior or a bug.

Environment

  • tunnel-client: v0.0.9
  • coding-tools-mcp: v0.1.7

Reproduction

Start coding-tools-mcp:

export CODING_TOOLS_MCP_AUTH_MODE=oauth
export CODING_TOOLS_MCP_SERVER_URL=https://api.openai.com/v1/tunnel/<tunnel-id>/mcp

coding-tools-mcp \
  --workspace ./ \
  --tool-profile full

Start tunnel-client:

tunnel-client run \
  --control-plane.api-key env:OPENAI_API_KEY \
  --control-plane.tunnel-id <tunnel-id> \
  --mcp.server-url http://127.0.0.1:8000/mcp

Configure a ChatGPT Connector using OAuth.

Local OAuth discovery

Locally everything works:

curl http://127.0.0.1:8000/.well-known/oauth-authorization-server

returns

{
  "issuer": "https://api.openai.com/v1/tunnel/<tunnel-id>/mcp",
  "authorization_endpoint": "https://api.openai.com/v1/tunnel/<tunnel-id>/mcp/oauth/authorize",
  "token_endpoint": "https://api.openai.com/v1/tunnel/<tunnel-id>/mcp/oauth/token",
  "grant_types_supported": ["authorization_code"],
  "code_challenge_methods_supported": ["S256"],
  "token_endpoint_auth_methods_supported": ["none"]
}

Problem

The OAuth endpoints advertised by discovery return 404 through the tunnel.

curl https://api.openai.com/v1/tunnel/<tunnel-id>/mcp/oauth/authorize

returns

404

Likewise

curl https://api.openai.com/v1/tunnel/<tunnel-id>/mcp/oauth/token

also returns

404

Because of this, ChatGPT never reaches the authorization step.

The coding-tools-mcp logs never show requests to:

GET /oauth/authorize
POST /oauth/token

tunnel-client logs

OAuth discovery URLs published ...

dispatcher received unsupported channel "harpoon"

harpoon host auto-registration failed

Question

Is Secure MCP Tunnel expected to proxy OAuth endpoints (/oauth/*) for MCP servers that implement their own OAuth Authorization Server?

Or is the expectation that the OAuth Authorization Server must already be publicly reachable outside the tunnel?

If the latter, what is the recommended architecture for MCP servers such as coding-tools-mcp that embed their own OAuth server?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions