Skip to content

fix(mcpdo): fail connections/list and MRU inference on an over-limit socket path - #2849

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2823-mcpdo-socket-path-list
Oct 29, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2823-mcpdo-socket-path-list

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #2823

What changed

connections/list and servers/show with no name both read a daemon_unreachable error as "nothing is connected". When the daemon socket path is over the platform's sun_path limit, the daemon can never bind, so that reading was wrong. The list printed Connections (0) and exited 0, and MRU inference reported "no most-recently-used connection", while connect refused with the real cause.

A small helper in clients/mcpdo/src/connection/mcp.ts, assertNoDaemonMeansNothingConnected(), rethrows anything that isn't daemon_unreachable. It then runs the same assertSocketPathWithinLimit(getDaemonSocketPath()) check that ensureDaemon() runs. Both call sites use it, so they now fail with connect's exact error and exit code.

  • connections/list still does not start the daemon or create its directory.
  • An absent daemon on a valid path still reports an empty list.
  • servers/list and the auth-name index also tolerate an unreachable daemon. They are left alone because the issue scopes the fix to these two commands. Those commands only use connections to annotate output, and they work without a daemon.

Tests

clients/mcpdo/__tests__/mcp-coverage.test.ts has a new case, skipped on win32 because named pipes have no sun_path limit. With an over-limit MCP_INSPECTOR_DAEMON_DIR it checks that:

  • connections/list and nameless servers/show both fail with the socket-path error.
  • neither one creates the daemon dir.
  • their exit code matches connect's.

The test fails without the fix (exit 0). The existing "do not auto-spawn" test still covers the empty-list case.

Hand smoke (built mcpdo, macOS)

$ MCP_INSPECTOR_DAEMON_DIR=$LONG node clients/mcpdo/build/mcp-bin.js connections/list; echo $?
{"error":{"code":"error","message":"Connection daemon socket path is too long for this platform (207 bytes > 103): …/mcpdod.sock. Point MCP_INSPECTOR_DAEMON_DIR (or MCP_STORAGE_DIR) at a shorter directory."}}
1
$ MCP_ALLOW_DEFAULT_CONNECTION=1 MCP_INSPECTOR_DAEMON_DIR=$LONG node clients/mcpdo/build/mcp-bin.js servers/show; echo $?
(same error)
1
$ MCP_INSPECTOR_DAEMON_DIR=/tmp/mcpdo-2823 node clients/mcpdo/build/mcp-bin.js connections/list; echo $?
Connections (0):
(none — connect first)
0

npm run local:gate passed.

🤖 Generated with Claude Code

…socket path (#2823)

`connections/list` and `servers/show` with no name read a
`daemon_unreachable` error as "nothing is connected". When the daemon
socket path is over the platform's sun_path limit the daemon can never
bind, so that read was wrong: the list printed `Connections (0)` and
exited 0, and MRU inference said there was no most-recently-used
connection, while `connect` refused with the real cause.

Both now run the same `assertSocketPathWithinLimit()` check that
`ensureDaemon()` runs before treating an unreachable daemon as empty,
so they fail with connect's error and exit code. Neither starts the
daemon or creates its directory, and an absent daemon on a valid path
still reports an empty list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified for the socket-path validation change.

No open issues 🎉

What changed in this PR

Fixes #2823 by making mcpdo distinguish an absent daemon from an unusable socket path, without starting the daemon.

Changes:

  • Shares the socket-path validation between connections/list and nameless servers/show.
  • Preserves empty-list behavior when the daemon is absent and the path is valid.
  • Adds regression coverage for error reporting, exit-code parity with connect, and avoiding daemon-directory creation.
File Description
clients/​mcpdo/​src/​connection/​mcp.ts Validates socket-path length before treating an unreachable daemon as no connections.
clients/​mcpdo/​__tests__/​mcp-coverage.test.ts Tests over-limit failures for both commands, skipping Windows named pipes.

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot review loop closed: round 1 was clean (no inline comments, no headline findings, no suppressed comments), so no further round was requested.

@cliffhall
cliffhall merged commit 78d0957 into v2/main Oct 29, 2026
11 checks passed
@cliffhall
cliffhall deleted the v2/fix/2823-mcpdo-socket-path-list branch October 29, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpdo connections/list reports 0 connections, exit 0, when the daemon socket path is over the platform limit

2 participants