feat: let users hide single tools from their own /mcp #22

Merged
marti merged 3 commits from feature/user-tool-visibility into develop 2026-11-06 15:32:49 +01:00
Owner

Summary

Users can switch off single tools for their own /mcp, so the tools they don't use stop taking up their agent's context. Descriptions also lose their [Server Name] prefix.

 listGatewayTools(user)
   ready servers (not hidden by user)
     upstream tools
-      skip if admin disabled
+      skip if admin disabled or user hid it   # user_hidden_tools
       expose as <slug>__<tool>
-        description: "[Server] " + description
+        description: description

 callGatewayTool(<slug>__<tool>)
   ...admin-disabled check
+  user hid it -> Unknown tool

+PUT /api/me/servers/:id/tools/:name/prefs { hidden }
+  404 unless accessible and an enabled catalog tool
+  emit user.tools.changed -> tools/list_changed to that user's sessions
+                             (does not drop upstream processes)
 <ServerPage>
   <ToolsPanel>            "1 of 2 tools in your MCP"
     <li> github__search
+      <Switch "github__search in my MCP">   useSetToolHidden (optimistic)

Migration: 0004_user_hidden_tools.sql (new table, PK user + server + tool name, cascades on user and server delete).

Evidence

  • Before: no way to drop one tool; alpha__echo description was "[Alpha] Echo the text back".
    After: gateway.test.ts: alice hides alpha__fail -> gets tools/list_changed, it's gone from her list, calling it throws Unknown tool, bob still sees it, unhiding brings it back. Description is "Echo the text back".
  • portal.test.ts: hide is per user, idempotent, 404 for an unknown tool and for a user without access.
  • ServerPage.test.tsx: the switch sends { hidden: true } and the header reads 1 of 2 tools in your MCP.
  • npm test: all four workspaces pass (288 + 109 + 46 + 5). Lint and typecheck are clean.

trail check flags user_hidden_tools against the learning that ruled out admin tools on the user /mcp. That's a lexical match: this adds no tools to /mcp, it only filters them per user.

Merge Danger

Door: two-way

The migration only adds a table. Rolling back leaves an unused table behind and drops users' tool choices.

Blast Radius: small

Connected agents see shorter descriptions on every tool, so clients that pinned on the old text would notice. Tools that only exist in a per-user process (catalog empty until an admin runs Test) can't be hidden yet.

🤖 Generated with Claude Code

## Summary Users can switch off single tools for their own `/mcp`, so the tools they don't use stop taking up their agent's context. Descriptions also lose their `[Server Name]` prefix. ```diff listGatewayTools(user) ready servers (not hidden by user) upstream tools - skip if admin disabled + skip if admin disabled or user hid it # user_hidden_tools expose as <slug>__<tool> - description: "[Server] " + description + description: description callGatewayTool(<slug>__<tool>) ...admin-disabled check + user hid it -> Unknown tool +PUT /api/me/servers/:id/tools/:name/prefs { hidden } + 404 unless accessible and an enabled catalog tool + emit user.tools.changed -> tools/list_changed to that user's sessions + (does not drop upstream processes) ``` ```diff <ServerPage> <ToolsPanel> "1 of 2 tools in your MCP" <li> github__search + <Switch "github__search in my MCP"> useSetToolHidden (optimistic) ``` Migration: `0004_user_hidden_tools.sql` (new table, PK user + server + tool name, cascades on user and server delete). ## Evidence - **Before:** no way to drop one tool; `alpha__echo` description was `"[Alpha] Echo the text back"`. **After:** `gateway.test.ts`: alice hides `alpha__fail` -> gets `tools/list_changed`, it's gone from her list, calling it throws `Unknown tool`, bob still sees it, unhiding brings it back. Description is `"Echo the text back"`. - `portal.test.ts`: hide is per user, idempotent, 404 for an unknown tool and for a user without access. - `ServerPage.test.tsx`: the switch sends `{ hidden: true }` and the header reads `1 of 2 tools in your MCP`. - `npm test`: all four workspaces pass (288 + 109 + 46 + 5). Lint and typecheck are clean. `trail check` flags `user_hidden_tools` against the learning that ruled out admin tools on the user `/mcp`. That's a lexical match: this adds no tools to `/mcp`, it only filters them per user. ## Merge Danger **Door:** two-way The migration only adds a table. Rolling back leaves an unused table behind and drops users' tool choices. **Blast Radius:** small Connected agents see shorter descriptions on every tool, so clients that pinned on the old text would notice. Tools that only exist in a per-user process (catalog empty until an admin runs Test) can't be hidden yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Merge pull request 'develop' (#18) from develop into main
All checks were successful
CI / check (push) Successful in 5m43s
b57f1d301c
Merge pull request 'develop' (#21) from develop into main
All checks were successful
CI / check (push) Successful in 5m42s
c0f7a61f0b
Reviewed-on: #21
feat: let users hide single tools from their own /mcp
All checks were successful
CI / check (pull_request) Successful in 5m34s
d68552561e
Users could only hide a whole server; every other tool of every
server they can reach lands in their agent's context. A portal switch
per tool now takes it out of that user's tools/list (stored in
user_hidden_tools); tools/call treats it as unknown. Changing one
sends tools/list_changed to the user's sessions through a new
user.tools.changed event without dropping upstream processes.

Gateway descriptions no longer get a "[Server Name]" prefix: the
<slug>__ name and the title already carry the server.

trail check flags user_hidden_tools against the learning that ruled
out admin tools on the user /mcp. That is a lexical match: this adds
no tools to /mcp, it only filters them per user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
marti merged commit e8a304adf5 into develop 2026-11-06 15:32:49 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marti/mcphub!22
No description provided.