Skip to content

mcp: register Claude over HTTP by default, keep stdio as fallback - #29

Open
shakhin85 wants to merge 1 commit into
kunal12203:mainfrom
shakhin85:mcp-http-primary
Open

mcp: register Claude over HTTP by default, keep stdio as fallback#29
shakhin85 wants to merge 1 commit into
kunal12203:mainfrom
shakhin85:mcp-http-primary

Conversation

@shakhin85

Copy link
Copy Markdown

Summary

  • Flip Claude MCP registration in bin/dual_graph_launch.sh from stdio-first to HTTP-first.
  • The HTTP server on 127.0.0.1:$MCP_PORT/mcp is already started unconditionally (line ~1298+) for prime.sh hooks and non-Claude assistants, so Claude can connect to the same endpoint instead of spawning a parallel stdio process.
  • Stdio remains in the fallback chain for older claude CLI builds that lack --transport http support.
  • Replace the binary _CLAUDE_NEEDS_HTTP flag with _CLAUDE_TRANSPORT (http|sse|stdio) so the final log line tells the user exactly which transport was registered.

Why

In some environments the stdio transport never establishes a session with Claude Code (no errors surfaced, MCP just sits disconnected) even though the HTTP server is healthy. Since HTTP is the canonical transport every other consumer of the dual-graph already uses, treating it as the Claude default removes a class of "MCP disconnected" reports without losing compatibility — stdio falls through automatically if the HTTP registration step fails.

Behavior

  • claude mcp add --transport http → tried first
  • --transport sse → second
  • bare URL form → third
  • stdio (-- mcp-graph-server --stdio) → last resort, kept inside the auto-fix retry block too

Final user-facing log:

[dgc] MCP config updated -> http://127.0.0.1:8081/mcp (HTTP)

(or (SSE) / stdio (HTTP unavailable, fallback) depending on which branch won).

Test plan

  • bash -n bin/dual_graph_launch.sh — syntax OK
  • Manual run of dgc on Ubuntu — Claude connects via HTTP, MCP tools available
  • Manual run on macOS to confirm no regression
  • Confirm older claude CLI (without --transport) still works via stdio fallback

The HTTP server is already started unconditionally for prime.sh hooks
and non-Claude assistants, so for Claude we can connect to that same
endpoint instead of spawning a parallel stdio process. Stdio remains
as a compatibility fallback for older claude CLI builds without
--transport support.

Replaces the binary _CLAUDE_NEEDS_HTTP flag with _CLAUDE_TRANSPORT
(http|sse|stdio) for clearer logs.
@graperoot-review

Copy link
Copy Markdown

GrapeRoot Review — No issues found. This PR looks clean.

Powered by GrapeRoot — graph-aware AI review

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.

1 participant