Skip to content

feat: allow reassigning a gateway's team (and its federated entities) from the edit form#5794

Draft
hirapHoriuchi wants to merge 1 commit into
IBM:mainfrom
hirapHoriuchi:feat/gateway-edit-team-selector
Draft

feat: allow reassigning a gateway's team (and its federated entities) from the edit form#5794
hirapHoriuchi wants to merge 1 commit into
IBM:mainfrom
hirapHoriuchi:feat/gateway-edit-team-selector

Conversation

@hirapHoriuchi

Copy link
Copy Markdown

✨ Feature / Enhancement PR

Draft — opened for feedback on the design question below before finalizing, since this touches team scoping (RBAC visibility).

🔗 Epic / Issue

Closes #5792


🚀 Summary (1-2 sentences)

Adds a team selector to the MCP server (gateway) edit form and makes team reassignment consistent by propagating the new team to the gateway's federated tools/resources/prompts. Mirrors the virtual server selector in #5791, plus the backend propagation gateways need.


❓ Design question for maintainers (please confirm before merge)

When a gateway's team changes, this PR propagates the new team_id to child tools/resources/prompts that inherited the old team, preserving per-item overrides (mirroring how visibility already propagates). Is that the desired behavior, or should children be left in place and moved individually? Happy to change the approach based on your preference — that's why this is a draft.


📏 Reviewability

  • This PR has one clear purpose
  • The linked issue is not labeled triage
  • Unrelated bugs or improvements are tracked in separate issues/PRs
  • Tests are included with the code they validate

Notes:

What it does

UI (mirrors the virtual server selector): owned-teams-only dropdown, empty placeholder to avoid implicit moves, team_id sent only for team visibility, submission blocked with an accessible message otherwise, disabled with an explanation when the user owns no teams.

Backend (update_gateway):

  • Validates destination-team ownership before the duplicate checks.
  • Runs the slug/URL duplicate checks against the destination team when the team is changing (previously used the pre-change team).
  • On team change, propagates the new team_id to child tools/resources/prompts that inherited the old team, preserving per-item overrides. No schema/migration change (columns already exist).

🧪 Checks

Targeted checks run locally (not the full make lint/make test suite):

  • python -m pytest tests/unit/mcpgateway/services/test_gateway_service.py354 passed, 1 skipped (includes new deny-path, propagation-with-override, and destination-team conflict tests)

  • npx vitest run tests/unit/js/gateway.test.js tests/unit/js/formSubmitHandlers.test.js116 passed

  • ruff check mcpgateway/services/gateway_service.py → clean

  • make build-ui → success

  • Manually verified end-to-end: reassigning a gateway's team on a local instance moved the gateway and its two federated tools to the destination team together; per-item overrides were preserved.

  • make lint passes (ran targeted ruff/eslint on changed files only)

  • make test passes (ran targeted pytest/vitest above)

  • CHANGELOG updated (if user-facing) (can add an entry if preferred)


📓 Notes (optional)

Security: destination-team ownership is validated before applying the change and cannot be bypassed via disabled gateways (validation and assignment are under the same enabled/include-inactive guard). Deny-path regression tests are included.

Add a team selector to the MCP server (gateway) edit form and propagate
team changes to the gateway's federated entities.

- UI mirrors the virtual server selector: owned teams only, empty
  placeholder to avoid implicit moves, team_id sent only for team
  visibility, submission blocked with an accessible message otherwise.
- On team reassignment, propagate the new team_id to child tools,
  resources and prompts that inherited the old team, preserving
  per-item overrides (mirrors the existing visibility propagation).
- Run the slug/URL duplicate checks against the destination team and
  validate destination-team ownership before applying the change.
- Adds deny-path and propagation regression tests.

Signed-off-by: hirapHoriuchi <yuta.hira-p0119@docomo.ne.jp>
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.

[FEATURE]: Allow reassigning a gateway's team (and its federated entities) from the edit form

1 participant