feat: expose per-server endpoints in mcporter serve#194
Conversation
|
Codex review: found issues before merge. Reviewed May 31, 2026, 8:34 PM ET / 00:34 UTC. Summary Reproducibility: not applicable. as a feature PR rather than a bug report. Source inspection shows current main lacks Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land the focused bridge change after the public endpoint is documented or maintainer-approved as intentionally undiscoverable, while preserving aggregate Do we have a high-confidence way to reproduce the issue? Not applicable as a feature PR rather than a bug report. Source inspection shows current main lacks Is this the best way to solve the issue? Unclear until maintainer signs off the public docs/help surface. The code path itself is narrow, preserves Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 2bf7a5eab23f. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Maintainer-side proof for the Commands/evidence:
This covers the live behavior proof blocker I could verify from the maintainer side. The docs/help surface decision for the new endpoint remains a maintainer/product call unless the contributor updates this branch. @clawsweeper re-review |
|
Adding real-behavior proof for this PR. Before the aggregate
After registering each server at
Reproducible from a throwaway config of 3 keep-alive stdio servers (alpha/beta/gamma), 5 tools each = 15 aggregate: Before, current After, this branch (
Why not just
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…ixed tools Add per-server HTTP routes alongside the aggregate /mcp endpoint. /mcp/<server> serves a single server's tools under their original (unprefixed) names so the server can be registered under its own client key, while /mcp keeps the server__tool namespacing. Unknown servers 404; malformed paths 400.
ecc5d29 to
3498fdf
Compare
|
Landed as 0fb1358 after rebasing the contributor commit onto current main and adding a maintainer docs/help/test fixup. Proof:
Caveats: first manual E2E attempt used a long nested temp daemon directory and hit the macOS Unix-socket path limit; rerun used a short isolated |


Summary
Follow-up to #172.
mcporter serveexposes all daemon-managed keep-aliveservers under one aggregate endpoint (
/mcp), namespacing every tool asserver__tool. That is the right default for a single bridge, but it has a sharpedge: registering the aggregate endpoint in an MCP client surfaces every server's
tools under one client key.
In practice that is a lot of tools. On my setup the aggregate
mcporterregistration shows 206 tools across about a dozen servers (visible in the
client's MCP server list), so a client that registers it pays the full context
cost of all 206 even when a session only needs one server, e.g. gitnexus's 13
tools. There is no way to mount just one server today.
You can approximate this today by running a separate
mcporter serve --servers <name>process per server, but that means one process, port, and launchd plisteach, and those names still come out
server__tool-prefixed. Per-serverendpoints give the same isolation from a single serve process, with the server's
original tool names.
This adds per-server endpoints.
GET/POST /mcp/<server>serves only thatserver's tools, under their original (unprefixed) names, so a client can register
gitnexuson its own and see its 13 tools instead of all 206./mcpisunchanged and still aggregates everything with
server__toolnaming.What's Included
src/serve.tsbareserve mode: a single server whose tools are exposed under theiroriginal names, with no
server__toolprefixing or decoding.serveHttproutes/mcp/<server>to a bare single-server bridge;/mcpkeeps the aggregate bridge.
text/plaincontent type so the echoedname is never sniffed as HTML); malformed percent-encoding returns 400.
createBridgeServerenforces exactly one served server in bare mode.Tests
Added coverage in
tests/serve.test.ts:/mcp/<server>.Full suite: 689 passed, 3 skipped (121 files).
pnpm checkclean.