Skip to content

[BUG]: Gateway creation under team scope returns team id as null #1453

@ramcysiddique

Description

@ramcysiddique

🐞 Bug Summary

When making API calls to add resources (e.g., MCP servers, virtual servers, tools) using a team-level scoped token, the team_id is not being automatically extracted from the token. Instead, the resource is added to the default personal team of the user, even though the token is scoped for a specific team.


🧩 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. Use the POST /gateways API to add an MCP server to the gateway, but do not include the team_id parameter in the request body.
  2. Use a team-level scoped token for the API call.
  3. Observe that the server is added to the default personal team of the user, rather than the team associated with the token.

🤔 Expected Behavior

When the team_id is not explicitly provided, the API should extract the team_id from the team-level scoped token and use it to associate the resource with the correct team, rather than defaulting to the user's personal team.


🧠 Environment Info

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

Key Value
Version or commit e.g. v0.9.0 or main@a1b2c3d
Runtime e.g. Python 3.11, Gunicorn
Platform / OS e.g. Ubuntu 22.04, macOS
Container e.g. Docker, Podman, none

🧩 Additional Context (optional)

Add any configuration details, flags, or related issues.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions