fix(api): isolate MCP server registry by session user - #51
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Process-global mcpClient returned every user's servers (including environment metadata) to any authenticated caller. Scope list/get/delete and tool calls to session.user.id and ignore client-supplied ownerUserId. Co-authored-by: esadrianno <esadrianno@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authenticated
/api/mcp/*routes still used a process-globalmcpClient. Any signed-in user could list, read (includingmetadata/environment), delete, or invoke tools against another user's MCP registration.Trigger
User A
POST /api/mcp/serverswith{name,url,environment}. User B in the same Node processGET /api/mcp/serverssees A's server and env. B canDELETEby id orPOST /api/mcp/tools/callagainst A's tools.Distinct from #49 (connector store) and #47 (agents/[id] auth only).
Fix
ownerUserIdfromsession.user.id(ignore client-supplied owner)requireSessionUserIdhelper (same contract as fix(api): isolate connector credentials by session user #49; merge should keep one copy)Tests
pnpm exec vitest run tests/api/mcp-servers-route.test.tsplus fullpnpm test:run(242 tests).Not in this PR
/api/agents)/api/setup/test-connectionstill accepts attacker-controlled Supabase URL (SSRF)