[v2] serveStdio falls back to legacy when a notification without _meta arrives after server/discover
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 30/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- typescript
- Bereich
- backend-api-design
Rechercherichtung
Read serveStdio.ts and inspect the probe phase's legacy and modern branches, especially how notifications without _meta affect protocol selection. Start by running the supplied stdio reproduction, then review the linked pull request #3237, which already addresses this issue. Done means the notification leaves the selected protocol era unchanged and the subsequent tools/list and server/discover responses remain on 2026-07-28.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
What happened?
Hi! I ran into this while testing a client against server-everything over stdio.
If a client sends server/discover and then a notification that has no _meta, serveStdio takes it as a legacy client falling back and pins the connection to 2025-11-25. From then on everything is served as legacy: a second server/discover gets Method not found, and tools/list comes back without resultType.
The realistic way to hit this is a client cancelling its discover request after a timeout (e.g. while npx is still starting the server). The cancellation example in the spec doesn't include _meta either.
With the repro below I get:
{"id":1,"resultType":"complete","error":null}
{"id":2,"resultType":null,"error":null}
{"id":3,"resultType":null,"error":"Method not found"}
If you remove the cancel line, 2 and 3 both come back with "resultType":"complete".
What did you expect?
The notification shouldn't change the era, so 2 and 3 should still be answered as 2026-07-28.
Looking at serveStdio.ts, while in the probe phase the case 'legacy' branch falls back for any message without a protocol version, notifications included. The modern branch already lets enveloped notifications through during the probe without pinning anything, so I think the no-_meta case just needs the same check. I have a fix with a test, happy to open a PR.
Code to reproduce
META='"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"repro","version":"0"}}'
{
echo "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"server/discover\",\"params\":{$META}}"
sleep 2
echo '{"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":1}}'
sleep 1
echo "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/list\",\"params\":{$META}}"
echo "{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"server/discover\",\"params\":{$META}}"
sleep 2
} | npx -y @modelcontextprotocol/[email protected] stdio 2>/dev/null | jq -c '{id, resultType: .result.resultType, error: .error.message}'
SDK version
@modelcontextprotocol/server 2.4.0 (through server-everything 2.3.1). The code is the same on main.
Area
Server
- Vorherrschende Sprache
- TypeScript
- Sterne
- 13.8k
- Forks
- 2.5k
- Ø Merge
- 6 T. 23 Std.
- Gemergte PRs (30 T.)
- 2
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/typescript-sdk
-
v2
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
modelcontextprotocol/typescript-sdk#3270 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`Evtl. vergeben @mgoldsborough hat das vor 6 Tagen übernommen. Offenv2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
modelcontextprotocol/typescript-sdk#3249 ·
Maintainer antworten meist innerhalb von 1 Tag
-
v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
modelcontextprotocol/typescript-sdk#3243 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` replyEvtl. vergeben @Tidehyc hat das vor 7 Tagen übernommen. Offenv2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
modelcontextprotocol/typescript-sdk#3235 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
UriTemplate.match() throws a TypeError on an empty expression it acceptsEvtl. vergeben @yunusemrejs hat das vor 12 Tagen übernommen. Offenv1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
modelcontextprotocol/typescript-sdk#3221 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/typescript-sdk
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Vessel9817/onion-site-template#512 ·
Maintainer antworten meist innerhalb von 1 Tag
-
nightly-tests
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
Maintainer antworten meist innerhalb von 1 Tag
-
approved
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
fritzprix/libr-agent#3266 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
better-auth/better-auth#13101 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag