Repository navigation
feat(mcp-server): Turn @sentry/mcp-server into a stdio proxy to the hosted MCP - #1743
sentry-junior[bot] wants to merge 1 commit into
Conversation
…osted MCP Keep @sentry/mcp-server instead of retiring it, and replace the deprecation shim with a small proxy: the sentry-mcp bin forwards stdio JSON-RPC to the hosted MCP's Streamable HTTP endpoint with Authorization: Sentry-Bearer <token>. Old flags map onto the hosted URL (org/project path, skills, experimental); self-hosted hosts and local embedded-agent flags exit with an error pointing to `npx -y sentry mcp`. The MCP SDK is bundled with tsdown, so the published package has no runtime dependencies, and lint:deps rejects any workspace dependency. Co-Authored-By: BYK <burak.kaya@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0fbbff6. Configure here.
| "OPENROUTER_REASONING_EFFORT", | ||
| ]; | ||
|
|
||
| const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "[::1]"]); |
There was a problem hiding this comment.
IPv6 localhost HTTP URLs rejected
Low Severity
LOOPBACK_HOSTS lists [::1], but URL.hostname for an IPv6 URL is ::1 without brackets, so http://[::1]:… fails the loopback check and is rejected as a non-HTTPS MCP URL.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0fbbff6. Configure here.
| if (!closing) { | ||
| log(`Sentry MCP: ${describe(error)}`); | ||
| } | ||
| }; |
There was a problem hiding this comment.
Remote errors leave requests hanging
Medium Severity
remote.onerror only logs. In-flight ids stay in pending, so the client never gets a JSON-RPC error after a mid-session drop, and stdin-close drain never finishes. A failed local.send also skips closeWhenDrained, which can leave the process running.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0fbbff6. Configure here.
|
Closing in favor of shipping |


Stacked on #1731. That PR moves the full stdio server into
sentry mcp. This one keeps@sentry/mcp-serverand replaces its deprecation shim with a small stdio proxy to the hosted Sentry MCP. Once this merges, the@sentry/mcp-serverwork is done and the package can be published again. The design is in #1669 ("@sentry/mcp-serverstays as a stdio proxy", task 11.6).What the proxy does
sentry-mcpbin connects stdin/stdout tohttps://mcp.sentry.dev/mcpover Streamable HTTP. It sends--access-token/SENTRY_ACCESS_TOKENasAuthorization: Sentry-Bearer <token>. The hosted MCP routes that header before OAuth, so the proxy has no auth flow of its own.list_changed), and server-initiated messages on the standalone GET stream. Afterinitializeit sets the negotiatedMCP-Protocol-Versionon later HTTP requests.Flags. The old local server's flags map onto the hosted URL where the hosted MCP supports them:
--organization-slug/--project-slugbecome/mcp/<org>/<project>.--skills/MCP_SKILLSand--disable-skills/MCP_DISABLE_SKILLSbecome query params.--all-skillssends nothing, since that is the hosted default.--experimentalbecomes?experimental=1.--mcp-url/MCP_URLsets the hosted origin, for testing. In the old CLI this flag already meant the MCP origin, while--urlmeant the Sentry URL, so--urlkeeps that meaning.SaaS only. The hosted MCP serves only sentry.io; regional and org subdomains go through sentry.io. If
--host,--url,SENTRY_HOST, orSENTRY_URLnames any other host, or--insecure-httpis set, the proxy exits 1 and points tonpx -y sentry mcp, which runs the tools locally against any host. The local embedded-agent flags (--agent-provider,--openai-*,--anthropic-*) also exit 1 with that pointer, so a chosen LLM endpoint is never silently swapped for the hosted one.--sentry-dsnand the agent env vars (OPENAI_API_KEY, ...) only print a warning. With no token, and forsentry-mcp auth ..., the proxy exits 1 and explains how to create a token or usenpx -y sentry mcpwithsentry auth login.Dependency footprint. The sources are plain JS in
bin/andlib/. tsdown bundles them with@modelcontextprotocol/sdk(catalog version, now a devDependency) into one file,dist/sentry-mcp.js, onprepack. The published package has no runtime dependencies.npm pack --dry-runshows 3 files: 77.6 kB packed, 335 kB unpacked. A cleannpm installof the tarball adds 1 package (344 KB). Depending on the SDK unbundled would add 96 packages (27 MB), because the SDK brings express, hono, ajv, and others.scripts/check-workspace-deps.mjsnow rejects any workspace dependency from@sentry/mcp-server, and there is a test for that. Docs that called the package deprecated or retired now describe both entry points.server.jsonis unchanged and still points atsentry mcp.Tests
initialize,tools/list, atools/callwith progress and logging notifications, alist_changedon the GET stream, and a client-to-server notification. It also checks that every request carriesSentry-Bearerand the negotiated protocol version, and covers a rejected token returned as a JSON-RPC error, draining on stdin close, and a clean exit on SIGTERM.Open questions:
mcp-cloudflare, so it is not part of this PR.--mcp-urlpoints to a custom deployment, because it cannot tell which Sentry host that deployment serves.via BYK.
--
View Junior Session in Sentry