Skip to content

[Bug]: Creating an MCP OAUTH2 server fails if using API. #1094

@popagruia

Description

@popagruia

🐞 Bug Summary

Briefly describe the issue or unexpected behavior.
If I try to use the API to create an OAUTH2 MCP server the creation will fail. Normally I should be able to use the UI to authorise but creation should not fail.

🧩 Affected Component

Select the area of the project impacted:

  • mcpgateway - API
  • mcpgateway - UI (admin panel)
  • mcpgateway.wrapper - stdio wrapper
  • Federation or Transports
  • CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)
  • Other (explain below)

🔁 Steps to Reproduce

  1. curl -s -X POST -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN"
    -H "Content-Type: application/json"
    -d '{
    "name": "github_com",
    "url": "https://api.githubcopilot.com/mcp/",
    "description": "A new MCP server added with OAuth2 authentication",
    "auth_type": "oauth",
    "auth_value": {
    "client_id": "'$CLIENT_ID'",
    "client_secret": "'$CLIENT_SECRET'",
    "token_url": "https://github.com/login/oauth/access_token",
    "redirect_url": "http://localhost:4444/oauth/callback"
    },
    "tags": ["system:github.com"],
    "passthrough_headers": ["X-Vault-Tokens"]
    }'
    http://localhost:4444/gateways

  2. 2025-09-22 11:56:40,182 - mcpgateway.services.gateway_service - ERROR - GatewayConnectionError in group: (GatewayConnectionError('Failed to initialize gateway at https://api.githubcopilot.com/mcp/'),)
    2025-09-22 11:56:40,186 - uvicorn.access - INFO - 127.0.0.1:63479 - "POST /gateways HTTP/1.1" 503

  3. ...


🤔 Expected Behavior

What should have happened instead?

Creation succeeded and I can Authorise in UI.

📓 Logs / Error Output

Paste any relevant stack traces or logs here.
⚠️ Do not paste secrets, credentials, or tokens.


🧠 Environment Info

You can retrieve most of this from the /version endpoint.

Key Value
Version or commit `0.0.7
Runtime Python 3.11, Gunicorn
Platform / OS macOS
Container local

🧩 Additional Context (optional)

Add any configuration details, flags, or related issues.

Metadata

Metadata

Labels

bugSomething isn't workingtriageIssues / Features awaiting triage

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions