Repository navigation
Let users add remote MCP servers by URL as their own connectors - #2
Merged
Merged
Conversation
POST /v1/custom-connectors discovers the server's OAuth setup (RFC 9728, RFC 8414), registers a client (RFC 7591) and records a connector named mcp_<hash> that only that project user can see, connect and call. Every request to such a server is checked to reach public addresses only and never follows redirects. Listing and removal included; deleting a project removes its custom servers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CUSTOM_MCP_ALLOW_FAKE_IP=true accepts 198.18.0.0/15, which proxies in fake-IP mode answer every name with. Off by default; never for servers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps the Google REST connectors and zh-HK locales from main; custom MCP servers stay out of the shared tool catalog, which now also lists built-in REST tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
A project's user can now add a remote MCP server that is not in the catalog, by its URL. It becomes a connector named
mcp_<10 hex>that only that user can see, connect and call; authorization, tool listing, calls and disconnect use the existing connector APIs.POST /v1/custom-connectors { external_user_id, url }: discovers the server's sign-in per the MCP authorization spec — an unauthenticatedinitializereturns 401, then protected resource metadata (RFC 9728), then authorization server metadata (RFC 8414) — and registers a client (RFC 7591). Only OAuth servers with PKCE S256 are accepted; servers without sign-in or with API keys only are refused with closed error codes. Adding the same URL again returns the same connector.GET /v1/custom-connectors?external_user_id=…andDELETE /v1/custom-connectors/{name}?external_user_id=…(revokes and deletes the user's connections, sessions, tool catalog and client).GET /v1/connectors,GET /v1/toolsor the console; other users or projects getconnector_not_found. At most 20 per user. Deleting a project removes them.custom_connectorstable (migration015) and are loaded into the catalog lookup on first use, so every process can serve them.CUSTOM_MCP_ALLOW_FAKE_IP=true(development only) accepts 198.18.0.0/15 for machines behind a fake-IP proxy.docs/custom-connectors.md(design, security, known limits).Known limit, documented: the address is checked when each request starts, so a DNS rebinding between the check and the connection is theoretically possible; pinning the resolved address in the connection layer would close it.
Test plan
npm run typechecknpm test— 64 pass, incl.tests/custom-connectors.test.ts(address checks, discovery and its refusals, authorization and calls only through the guarded fetcher)npm run test:integration— 33 pass, incl.tests/integration/custom.test.ts(add, idempotent re-add, connect, call, reload of the definition in a fresh process, isolation across users and projects, kept out of shared catalogs, removal and project deletion cleanup)/healthandGET /v1/custom-connectorsrespond🤖 Generated with Claude Code