feat: add MCP discovery router#494
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 520ea7d81a
ℹ️ 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".
| if (Array.isArray(parsed)) { | ||
| for (const message of parsed) this.sink(message as JsonRpcMessage); | ||
| return; |
There was a problem hiding this comment.
Return batch responses as one JSON-RPC message
When an MCP client sends a JSON-RPC batch over stdio, this branch sinks each item independently, which makes writeMessage emit one top-level response per request. JSON-RPC batch callers expect a single array response for the batch, so clients that batch MCP requests can hang or reject the replies even though each individual handler succeeded; collect the per-entry responses and write one array for the batch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in b82e5546: batch payloads are now collected into a single JSON-RPC array response, with notifications filtered out of the response array. Added a focused unit test and a runtime stdio batch smoke command to the PR validation.
c2135b2 to
63e789b
Compare
63e789b to
5bf8e35
Compare
Summary
Add an official
agent-device mcpstdio router for discovery-oriented MCP clients. It exposes onlystatus,install, and version-matchedhelptools, plus workflow prompts/resources, while keeping device automation on the CLI.Add MCP registry metadata (
mcpName,server.json,smithery.yaml) and concise README/website install guidance for registry discovery. Metadata versions are kept in sync byscripts/sync-mcp-metadata.mjs, checked duringpnpm check:toolingandprepack, and documented inAGENTS.mdfor version/metadata edits.Touched 14 files. Scope stayed within MCP discovery/routing, CLI help, registry metadata, docs, focused tests, metadata sync tooling, and agent instructions.
Validation
PATH="$HOME/.nvm/versions/node/v24.13.0/bin:$HOME/Library/pnpm:$PATH" pnpm formatPATH="$HOME/.nvm/versions/node/v24.13.0/bin:$HOME/Library/pnpm:$PATH" pnpm exec vitest run src/mcp/__tests__/router.test.ts src/utils/__tests__/args.test.tsPATH="$HOME/.nvm/versions/node/v24.13.0/bin:$HOME/Library/pnpm:$PATH" pnpm check:mcp-metadataPATH="$HOME/.nvm/versions/node/v24.13.0/bin:$HOME/Library/pnpm:$PATH" pnpm check:toolingPATH="$HOME/.nvm/versions/node/v24.13.0/bin:$HOME/Library/pnpm:$PATH" pnpm check:fallowprintf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | PATH="$HOME/.nvm/versions/node/v24.13.0/bin:$HOME/Library/pnpm:$PATH" node bin/agent-device.mjs mcpprintf '%s\n' '[{"jsonrpc":"2.0","id":1,"method":"ping"},{"jsonrpc":"2.0","id":2,"method":"tools/list"}]' | PATH="$HOME/.nvm/versions/node/v24.13.0/bin:$HOME/Library/pnpm:$PATH" node bin/agent-device.mjs mcpgit diff --checkKnown gap: external listings on Smithery, Cline, mcp.so, mcpservers.org, and awesome-mcp-servers still require follow-up submissions after merge/publish.