Repository navigation
🐛 fix(adminmcp): the HTTP endpoint answers ping and acknowledges notifications - #16893
Conversation
…fications POST /api/admin/mcp answered MCP's ping with -32601 "method not found", though the receiver must answer it with an empty result, and answered every notification except notifications/initialized (notifications/cancelled after an abandoned tool call, for one) with the same error. ping now returns an empty result, and any notifications/* method gets the empty acknowledgement notifications/initialized always had. Unknown request methods are still -32601. The stdio binary uses the MCP SDK and was not affected. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Looks correct to me.
Read dispatch at src/pkg/adminmcp/adminmcp.go:262-282. ping → empty result matches MCP; the notifications/ prefix check in the default arm subsumes the removed notifications/initialized case, so that path is unchanged in behaviour, and any other unknown method still gets -32601. The new protocol_test.go cases cover all three. One pre-existing note, not a finding of this PR: a notification carries no id, and rpcResponse.ID is omitempty (adminmcp.go:231), so the ack body is {"jsonrpc":"2.0","result":{}} — exactly what the doc line now says, so it's documented as intended.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
…cker src/docs/admin-mcp.md: kept the reorganized guide and carried over v6's changes to it: ping and notification answers (hivecommons#16893), version_read hash/short (hivecommons#16890), settings_read takes no limit and the triggers section (hivecommons#16892), What a read masks (hivecommons#16889), and write tools always listed with metadata.preview.enabled (hivecommons#16890); the troubleshooting row follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Summary
The admin MCP HTTP endpoint (
POST /api/admin/mcp) did not answer two messages every MCP client is allowed to send. It replied "method not found" toping, and to every notification exceptnotifications/initialized. This PR answerspingand acknowledges notifications. Tool calls are unchanged, and the stdio binary was never affected.What went wrong
Checked against a live v6 hive:
pingis MCP's liveness check. The receiver must answer with an empty result. A client that pings to see whether the server is still there was told the method does not exist, and can treat the hive as gone.notifications/initializedit writes an empty result, which the docs record. Any other notification got an error.notifications/cancelledis the common one: a client sends it after it gives up on a slow tool call.The public knowledge MCP endpoint in the same codebase already answers
ping.What changes
pingreturns{}.notifications/...method gets the same empty acknowledgementnotifications/initializedalways had.-32601.Files
src/pkg/adminmcp/adminmcp.go:dispatch.src/pkg/adminmcp/protocol_test.go: new.src/docs/admin-mcp.md: one bullet under "HTTP endpoint".changelog.d/fixed-admin-mcp-http-ping.mdTests
TestHTTPEndpointAnswersPingTestHTTPEndpointAcknowledgesEveryNotification: four notification methods.TestHTTPEndpointStillRefusesUnknownMethods: five methods, including a barenotifications.v6without the change.go test ./pkg/adminmcp/ ./cmd/hive-admin-mcp/passes.🤖 Generated with Claude Code