Skip to content

mcp: accept sse / streamable-http / stdio hub transports (was HTTP-only) - #219

Merged
FMXExpress merged 2 commits into
mainfrom
claude/mcp-hub-stdio-transport
Jun 10, 2026
Merged

FMXExpress merged 2 commits into
mainfrom
claude/mcp-hub-stdio-transport

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Why the 10 entries were skipped

pasclaw mcp catalog printed (10 hub entry/entries skipped -- non-HTTP transports not supported yet) and fell back to the bundled 5 because ProjectHubEntryToCatalog strictly required transport: "http". In practice the pasclaw.dev hub publishes:

  • 9 entries with transport: "sse" — remote HTTP endpoints that stream responses via text/event-stream.
  • 1 entry with transport: "stdio" — a binary you spawn locally.

TMCPHttpClient already speaks the MCP Streamable HTTP transport (2025-03-26 spec) and Accepts both application/json and text/event-stream response bodies. So those 9 SSE rows would have connected if we'd let install through. The strict check was stale spelling discipline, not a real protocol gap.

What this PR does

  • Accept http / sse / streamable-http / stream as remote-HTTP-class transports; they project to the same TMCPCatalogEntry shape (URL + EnvVar + AuthFmt) and route through TMCPHttpClient. The hub's literal transport string is preserved on Entry.Transport so the catalog display can still flag SSE rows.
  • Accept stdio: maps hub { command, args[] } into new TMCPCatalogEntry.Cmd + CmdArgs slots. JoinHubArgs flattens the args array into space-separated form (same convention pasclaw mcp add already uses), and DoInstall persists them into Cfg.MCPServers as Cmd + Args — TMCPStdioClient picks them up via the existing ://-vs-not heuristic in PasClaw.MCP.Bridge.
  • DoInstall branches on CatalogEntryIsStdio: stdio entries skip the Authorization-header dance (the binary handles auth itself) but DO surface a warning when the hub-flagged required env var isn't set in the spawning shell.
  • pasclaw mcp catalog shows a new transport column. Bundled KnownMCPServers rows default to http so the column never looks blank.
  • Truly unknown transports (e.g. websocket) still reject with a clearer "transport X not supported" message; the count surfaces in the existing skip line.

Files

  • src/pkg/mcp/PasClaw.MCP.Catalog.pas — Transport / Cmd / CmdArgs fields on TMCPCatalogEntry; new CatalogEntryIsStdio predicate.
  • src/pkg/mcp/PasClaw.MCP.Hub.pas — ProjectHubEntryToCatalog rewritten + exposed at interface scope so tests can pin it; JoinHubArgs helper for args[] flattening.
  • src/cmd/PasClaw.Cmd.MCP.pas — DoInstall routes by transport; DoCatalog shows transport column; new TransportLabel helper.
  • New: src/tests/mcp_hub_projection_tests.pas — 11 cases covering each transport branch and every reject path (missing slug / endpointUrl / command, unknown transport).
  • Makefile — new test-mcp-hub-projection target wired into the umbrella test.

Test plan

  • make test — full suite green incl. new test-mcp-hub-projection (11/11)
  • make test-mcp-server still green (no surface area collision with the new fields)
  • pasclaw mcp catalog smoke (live, in this sandbox: hub unreachable due to no libssl — falls back to the bundled 5 in the new column format)
  • Live pasclaw mcp catalog against the real hub on a box with OpenSSL: should now show the 9 SSE + 1 stdio rows + bundled 5

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon


Generated by Claude Code

…nly)

`pasclaw mcp catalog` printed

    (showing built-in 5 entries)
    (10 hub entry/entries skipped -- non-HTTP transports not supported yet)

because PasClaw.MCP.Hub.ProjectHubEntryToCatalog rejected every entry
whose transport field wasn't literally "http". In practice the
pasclaw.dev registry publishes nine entries with transport: "sse"
(remote HTTP endpoints that stream responses as text/event-stream) and
one with transport: "stdio" -- all ten were dropped.

The interesting nuance: TMCPHttpClient already speaks the MCP
Streamable HTTP transport (2025-03-26 spec) and Accepts both
application/json and text/event-stream response bodies. So those nine
SSE rows would have CONNECTED if we'd let the install path through. The
strict "transport != http -> skip" check was just stale spelling
discipline, not a real protocol gap.

This PR:

  - Accepts http / sse / streamable-http / stream as remote-HTTP-class
    transports; they project to the same TMCPCatalogEntry shape (URL +
    EnvVar + AuthFmt) and route through TMCPHttpClient. The hub's
    literal transport string is preserved on Entry.Transport so the
    catalog display can flag SSE rows -- helpful when an older-spec
    server doesn't quite cooperate, the operator wants to know.

  - Accepts stdio: maps hub fields { command, args[] } into new
    TMCPCatalogEntry.Cmd + CmdArgs slots. JoinHubArgs flattens the args
    array into space-separated form (the same convention
    `pasclaw mcp add` already uses), and DoInstall persists them into
    Cfg.MCPServers as Cmd + Args -- TMCPStdioClient picks them up via
    the existing ://-vs-not heuristic in PasClaw.MCP.Bridge.

  - DoInstall now branches on CatalogEntryIsStdio: stdio entries skip
    the Authorization-header handling (the binary reads env vars
    itself) but DO surface a warning when the hub-flagged required env
    var isn't set in the spawning shell.

  - `pasclaw mcp catalog` shows a new transport column. Bundled
    KnownMCPServers rows default to "http" so the column never looks
    blank.

  - Truly unknown transports (e.g. websocket) still reject with a
    clearer "transport X not supported" message; the count surfaces
    in the existing skip line.

New unit: 11-case mcp_hub_projection_tests.pas pins the contract for
each transport branch (including missing-slug / missing-endpointUrl /
missing-command rejections) so a future tightening doesn't silently
re-drop SSE entries.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e3ed83e5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pkg/mcp/PasClaw.MCP.Hub.pas Resolved
Self-audit while waiting on Codex review: JoinHubArgs was joining the hub's
argv slots with a bare space. The other side of the trip is
PasClaw.MCP.StdioClient.SplitArgs, which splits on unquoted whitespace and
honors paired single + double quotes -- so a hub arg of "--prompt say hello"
would JOIN as `--mode --prompt say hello` and re-SPLIT into four tokens,
and the spawned MCP server would see a broken flag.

Fix: QuoteForSplitArgs wraps args containing whitespace in double quotes
(or single quotes if the arg already contains a double quote, and falls
through to the worse-of-two double-quote wrap when the arg contains
both). The MCP servers we route through here ship short flag-shaped
argv, so the both-quote-kind case never appears in practice.

New test (TestStdioArgsWithWhitespaceRoundTripSafely) pins the contract
with an arg that previously would have re-split incorrectly.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
@FMXExpress
FMXExpress merged commit 2be9e6e into main Jun 10, 2026
FMXExpress pushed a commit that referenced this pull request Jun 13, 2026
Both changelog files were stuck at the 2026-06-10 TUI / background-
subagent / session_search / tool-RPC entries. ~7 weeks of merged
PRs (#214 through #244) had landed without a corresponding entry in
either file -- the git log was the only record of features like the
knowledgebase, inbound MCP server mode, checkpoints + /undo,
heartbeat daemon, shell backends (local | docker), send_message,
promptware defense, Windows shell-output encoding fixes, fs_grep
ripgrep optimisations, OpenTelemetry traces, and `pasclaw agent
--quiet`.

Added (newest first):

  2026-06-13
    #244  agent --quiet log-level clamp

  2026-06-12
    #243  dcc64 search path + agent --quiet / -q
    #242  OpenTelemetry traces (OTLP/HTTP+JSON)
    #241  fs_grep tier 5+6 (byte walker + Boyer-Moore-Horspool)
    #240  fs_grep tier 1-4 (deferred hash + skip-dirs + binary
          sniff + size cap)

  2026-06-11
    #239  Windows shell output: auto-detect UTF-8 vs OEM
    #238  Hashline fs_read header mojibake fix (¶ vs ¶)
    #237  Windows shell output: OEM codepage decode

  2026-06-10
    #233  Shell backends (local | docker via IShellBackend)
    #232  Heartbeat daemon + reversible condensation (CCR)
    #230  send_message tool + condenser families + promptware
          defense + task-aware MEMORY.md slicing

  2026-06-09
    #223  /goal Ralph loop + judge model + JSON-aware condenser
    #222  /undo wired into agent + sample dprojs
    #221  Checkpoints (auto-snapshot + TUI /undo)
    #220  mcp catalog: lenient hub projector
    #219  mcp: SSE / Streamable HTTP / stdio hub transports
    #218  Inbound MCP server mode
    #217  onboard: offer to index docs into the knowledgebase
    #214  Knowledgebase (RAG over operator-curated docs)

Skipped from this changelog (build-system / Delphi-fix / FPC-fix
PRs visible in the git log but not user-facing features):
#215, #216, #224, #225, #226, #227, #228, #229, #231, #234, #236.

Both files (README.md and docs/changelog.md) updated with the same
entries -- intentional mirror so a reader on either surface sees
the same history. Same prose in both; same footnote refs at the
bottom.

Validated: every [#N] reference in both files has a matching [#N]:
URL footnote (no broken links).
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.

2 participants