Skip to content

Serve the MCP tools over HTTP at /mcp - #69

Open
maaland wants to merge 1 commit into
mainfrom
feat/remote-mcp-38
Open

maaland wants to merge 1 commit into
mainfrom
feat/remote-mcp-38

Conversation

@maaland

@maaland maaland commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Closes #38

Covers the first "Done when" line of #38: an MCP client test lists the tools and runs each against the hosted handlers (fixtures, no live sites). The second (claude mcp add against a preview) needs you; see below.

What changes

  • packages/mcp: createServer({ store, startScan }). The four tool definitions are unchanged and shared, and how scan_domain scans is now a ScanStarter.
    • localScanStarter({ store, net, decider?, browser? }) is today's behaviour, used by the stdio bin and its tests (unchanged, passing).
    • scan_domain turns a LimitError into a tool error with its message, and its description now says to call get_scan if a scan is still running.
  • apps/web/src/lib/mcp.ts + app/mcp/route.ts: the remote endpoint.
    • Authorization: Bearer <key> is required: 401 invalid_key otherwise, before any MCP traffic. Each request is logged against the key.
    • The hosted starter uses startKeyedScan, now shared with POST /api/scans: workflow runs, the key's 10 new scans a day, and reused scans free. It waits up to 25 s for the scan, then returns it running (maxDuration = 60).
    • Stateless Streamable HTTP: the MCP SDK's WebStandardStreamableHTTPServerTransport, a fresh server per request, JSON responses (no SSE), so it fits serverless functions. GET/POST/DELETE go to the transport.
  • README: a short "MCP" section with the claude mcp add line.

Checked

  • MCP client test (StreamableHTTPClientTransport with its fetch going straight into handleMcp; workflow stood in for by replaying the recorded vercel fixture):
    • Lists the four tools.
    • scan_domain runs a hosted scan under the key (one spend), then reuses it (no spend).
    • get_scan, explain_detection and diff_scans work.
    • A scan still running after the wait comes back running and points to get_scan.
    • The 11th new scan in a day is refused with the limit message.
    • No key is refused with how to get one.
  • Production build over real HTTP (curl JSON-RPC): initialize, tools/list, get_scan, explain_detection with evidence, and no key → 401.
  • pnpm lint, pnpm typecheck, pnpm test (400 passing), pnpm build pass.

To finish "Done when" on a preview

Previews are behind Vercel's login, so Claude Code needs a protection bypass header as well:

claude mcp add --transport http stackprobe-preview https://<preview-url>/mcp \
  --header "Authorization: Bearer <key from POST /api/keys on the preview>" \
  --header "x-vercel-protection-bypass: <bypass secret>"

The bypass secret is under Project → Settings → Deployment Protection → Protection Bypass for Automation.

🤖 Generated with Claude Code

Agents can connect to the hosted service over MCP with an API key:
claude mcp add --transport http stackprobe https://stackprobe.tech/mcp
--header "Authorization: Bearer <key>". The same four tools as the
local server, defined once in packages/mcp: createServer now takes a
ScanStarter, localScanStarter for stdio, and a hosted one in apps/web
that starts workflow runs under the key's limits and waits up to 25 s
before returning a running scan for get_scan.

Stateless Streamable HTTP (a server per request, JSON responses), using
the MCP SDK's web-standard transport. Starting a scan with a key is
shared with POST /api/scans (startKeyedScan).

Closes #38

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stackprobe Ready Ready Preview Oct 12, 2026 7:41pm UTC

Request Review

@drippa-ai

drippa-ai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Drippa Sign-Off: Remote MCP endpoint at /mcp serving the four stackprobe tools

✅ Delivers ticket #38 — 4 of 5 outcomes

Open in Drippa

What was promised

  • ✅ Agents can connect to the hosted service at /mcp with an API key and nothing to install; requests without a valid key are refused.
  • ✅ The hosted endpoint offers the same four tools as the local server, using one shared set of tool definitions rather than a copy.
  • ✅ Scans started over MCP run as normal hosted scans; scan_domain waits briefly, then returns the running scan to check later with get_scan.
  • ✅ MCP scans follow the same daily new-scan limit, free reuse of recent scans and error messages as the HTTP API.
  • ❓ Adding the endpoint in Claude Code works against a preview deployment.

Proof
Not tested in the browser: behaviour change with no page to click.

Steps based on ticket #38, the pull request description and the code change.

Details

The web app now serves an MCP endpoint at /mcp. Agents connect to it with an API key and get the same four tools as the local server, with no install. Scans started this way run as normal hosted scans under the key's daily limit, and a scan still running after about 25 seconds comes back as running so the agent can follow up with get_scan. The second done-when check, adding the endpoint in Claude Code against a preview, still has to be run by hand, and the description says how.

Test coverage: ✅ Well covered — A new client test lists the tools and runs each one against the hosted handlers using recorded fixtures. It also covers a still-running scan, the daily limit and a missing key.

🔍 Checked: ticket #38 with 4 build items and 2 done-when checks; 7 of 12 changed files read, covering all the app code and the new client test

🎫 Compared against drippa-ai/stackprobe#38


Updated by Drippa • 2026-10-12 19:42 UTC

Comment @drippa-ai review for a fresh review.

This branch was successfully deployed

1 active deployment
Preview — 7efdd637 Deployed Oct 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote MCP endpoint at /mcp

1 participant