HTTP MCP: generic JSON-RPC error to server/discover over SSE is not treated as legacy fallback (invalid-discovery)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start by reading dist/core/extensions/builtin/mcp/modern/era.js, especially body() and probeHttpEra(); compare how JSON and SSE error replies are handled. Check whether the SSE event’s reply ID matches the discovery request before treating it as a legacy fallback. Done looks like the generic -32601 error over SSE follows the existing JSON fallback behavior, with the discovery response handling covered by a relevant test.
Written by the indexing model from the issue text.
Description
Summary
Connecting to the Microsoft Learn remote MCP server (https://learn.microsoft.com/api/mcp) fails with:
MCP server microsoft-learn failed during connect: MCP server microsoft-learn: invalid-discovery. Check that the server returns a complete server/discover envelope.
The server is a legacy (initialize-based) server. It rejects server/discover with a generic -32601 Method not found, which probeHttpEra() already treats as legacy-fallback. The fallback doesn't happen here only because the error arrives as an SSE event instead of a JSON body.
Environment
- @code-yeongyu/senpi 2026.11.15-2 (omo-ai 5.1.75)
- macOS arm64
Config
"microsoft-learn": {
"type": "http",
"url": "https://learn.microsoft.com/api/mcp"
}
Evidence
Response to a server/discover POST (Accept: application/json, text/event-stream) from two servers. Both return HTTP 200 with the same generic error, but in different content types:
| Server | Content-Type | Body | Result |
|---|---|---|---|
https://knowledge-mcp.global.api.aws |
application/json |
{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found: server/discover"}} |
legacy-fallback, connects |
https://learn.microsoft.com/api/mcp |
text/event-stream |
event: messagedata: {"error":{"code":-32601,"message":"Method 'server/discover' is not available."},"id":1,"jsonrpc":"2.0"} |
invalid-discovery, fails |
Sending initialize (protocolVersion 2025-06-18) directly to the Microsoft Learn endpoint works: it returns serverInfo.name: "Microsoft Learn MCP Server" with tools/prompts/resources capabilities and an mcp-session-id header.
Suspected cause
In dist/core/extensions/builtin/mcp/modern/era.js, body():
- For non-SSE responses it returns the parsed JSON as is, so a generic error reaches the
!error && errorReply(value)branch inprobeHttpEra()and becomeslegacy-fallback. - For SSE responses it only returns an event when
complete(value) || modernError(value)holds. A generic JSON-RPC error matches neither, sobody()returnsundefined.probeHttpEra()then skips the fallback branch,response.okis true, and it ends inindeterminate("invalid-discovery", ...), whichdispatch.jsturns into a hard connect error.
Suggested fix
In the SSE branch of body(), also return events where errorReply(value) holds (ideally only when the reply id matches the discovery request), so SSE and JSON responses are handled the same way. This is based on reading the shipped JS; I haven't tested a patch.
Related
- #4402 covers a different legacy-server case (
-32022listing only legacy versions ->no-mutual-version).
- Dominant language
- TypeScript
- Stars
- 517
- Forks
- 163
- Avg merge
- 23h 45m
- Merged PRs (30d)
- 691
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from code-yeongyu/senpi
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
code-yeongyu/senpi#6929 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
code-yeongyu/senpi#6927 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
code-yeongyu/senpi#6890 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 66/100
code-yeongyu/senpi#6746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
code-yeongyu/senpi#6742 ·
Maintainers usually reply within 1 day
All issues in code-yeongyu/senpi
Similar issues
-
agent-ready area: ui-server priority: p3 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
schlessera/brain-kit#4249 ·
Maintainers usually reply within 1 day
-
documentation tool triaged
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
can1357/oh-my-pi#19608 · 2 comments ·
Maintainers usually reply within 1 day
-
dependencies tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
bcgov/nr-waste-plus#1549 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blixvip/solana-token-meta#17 ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blixvip/solana-tx-parse#18 ·