MCP connectors cannot point at this AnythingMCP server itself - #882
Merged
Merged
Conversation
A cloud user created an MCP connector with the URL cloud.anythingmcp.com. It imported our own kg_how_to_obtain tool, and every call to it re-entered our /mcp and called itself again: 13,709 calls in two hours on 4 Oct, each held for the 60 s timeout, and everyone's p95 nearly doubled. The MCP client now refuses, before connecting (discovery and calls), a URL whose host is this instance's own SERVER_URL / FRONTEND_URL / CLOUD_PUBLIC_URL host, with a message that says why. Host and port are compared, so another MCP server on the same machine stays allowed on self-hosted instances. Production: 3 such connectors exist; only the looping one was ever called.
keysersoft
enabled auto-merge (squash)
October 5, 2026 11:45
…oop-guard # Conflicts: # packages/backend/src/connectors/engines/mcp-client.engine.spec.ts # packages/backend/src/connectors/engines/mcp-client.engine.ts
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Found in the daily review (5 Oct).
What happened: on 4 Oct a cloud user created an MCP connector "Claude Etsy" with the URL
https://cloud.anythingmcp.com. It imported our ownkg_how_to_obtain, and each call re-entered our/mcpand called the connector again. 13,709 calls in two hours (12–14 UTC), 13,686 of themRequest timed outafter ~60 s each. No outage, but p95 latency for everyone else went from ~600 ms to ~1,100 ms in those hours. This is most of the "Etsy" errors in the weekly report.Fix:
assertNotThisServer()in the MCP client engine, before connecting, for discovery and calls: refuses a URL whose host (with port) is this instance's ownSERVER_URL/FRONTEND_URL/CLOUD_PUBLIC_URL, with a message explaining the loop. Another MCP server on the same machine (e.g.localhost:8080next tolocalhost:4000) and other AnythingMCP instances stay allowed.Production check: 3 MCP connectors point at cloud.anythingmcp.com; only the looping one was ever called (the other two have 0 calls).
Tests: 5 new cases in
mcp-client.engine.spec.ts.