Skip to content

Conversation

rakdutta
Copy link
Collaborator

@rakdutta rakdutta commented Sep 11, 2025

(Reference issue #945)

Background / Issue

Previously, Gateway Server Name, Gateway Server URL, and Tool Name were validated with a global unique constraint.

  • Creating a Gateway Server or Tool with Private visibility prevented others from using the same name/URL, even in other teams.
  • This blocked valid scenarios where these values should only be unique within their visibility scope.

Fix Implemented

Database Changes

  • Added composite unique constraints to enforce scope-based uniqueness:
    • Private(slug, owner_email, team_id) for Gateway Server Name, Gateway Server URL, and Tool Name
    • Removed the old global uniqueness constraint on slug and url.

Application Logic

  • Added validation to enforce scope rules:
    • Private → DB constraint ensures uniqueness per (slug/url/tool_name, owner_email, team_id)
    • Team → Validation ensures no duplicates within the same team_id
    • Public → Validation ensures no duplicates globally

Expected Behavior After Fix

Visibility Uniqueness Scope Example Conflict
Private (slug/url/tool_name, owner_email, team_id) Blocked only if same user & same team
Team (slug/url/tool_name, team_id) Blocked if another user in the same team uses the same name, URL, or Tool Name
Public (slug/url/tool_name) globally Blocked if any user/team already created a public resource

Testing / Verification

  • User A (Team 1, Private) can create gw_name, gw_url, tool_name.
  • User B (Team 2, Private) can also create the same names/URL/tool ✅ allowed.
  • Two users in the same team cannot create duplicate names, URLs, or Tools ❌ blocked.
  • Public names, URLs, and Tools are restricted globally ❌ blocked.

@rakdutta rakdutta marked this pull request as ready for review September 12, 2025 13:25
rakdutta and others added 15 commits September 13, 2025 08:34
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
@crivetimihai crivetimihai force-pushed the scope-uniqueness-for-tool-gateway branch from a6096e9 to b531fb7 Compare September 13, 2025 08:00
@crivetimihai crivetimihai merged commit facb02c into main Sep 13, 2025
32 of 34 checks passed
@crivetimihai crivetimihai deleted the scope-uniqueness-for-tool-gateway branch September 13, 2025 08:02
vk-playground pushed a commit to vk-playground/mcp-context-forge that referenced this pull request Sep 14, 2025
…Server URL & Tool Name (Private/Team/Public visibility rules) (IBM#970)

* uniqueness

Signed-off-by: rakdutta <[email protected]>

* flake

Signed-off-by: rakdutta <[email protected]>

* alembic

Signed-off-by: rakdutta <[email protected]>

* alembic

Signed-off-by: rakdutta <[email protected]>

* pytest

Signed-off-by: rakdutta <[email protected]>

* pytest

Signed-off-by: rakdutta <[email protected]>

* pytest

Signed-off-by: rakdutta <[email protected]>

* pytest

Signed-off-by: rakdutta <[email protected]>

* flake

Signed-off-by: rakdutta <[email protected]>

* pytest

Signed-off-by: rakdutta <[email protected]>

* revert alembic script with main

Signed-off-by: rakdutta <[email protected]>

* alembic

Signed-off-by: rakdutta <[email protected]>

* fix lint error

Signed-off-by: rakdutta <[email protected]>

* fix lint error

Signed-off-by: rakdutta <[email protected]>

* rebase

Signed-off-by: Mihai Criveti <[email protected]>

---------

Signed-off-by: rakdutta <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Co-authored-by: Mihai Criveti <[email protected]>
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.

2 participants