Implement MCP 2026-07-28 (#2286)
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com> Co-authored-by: Konstantin Konstantinov <KKonstantinov@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
e4227d135c
commit
1823aae891
1 changed files with 69131 additions and 9001 deletions
24
examples/legacy-routing/client.ts
Normal file
24
examples/legacy-routing/client.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Connects to the routing fork as both a plain 2025 client (lands on the
|
||||
* existing sessionful transport, `era=legacy`) and a 2026-capable client
|
||||
* (lands on the strict modern entry, `era=modern`).
|
||||
*/
|
||||
import { check, parseExampleArgs } from '@mcp-examples/shared';
|
||||
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
|
||||
|
||||
const { url } = parseExampleArgs();
|
||||
|
||||
// 2025 client → routed to the existing sessionful deployment.
|
||||
const legacy = new Client({ name: 'legacy-routing-client', version: '1.0.0' });
|
||||
await legacy.connect(new StreamableHTTPClientTransport(new URL(url)));
|
||||
const lr = await legacy.callTool({ name: 'greet', arguments: { name: 'A' } });
|
||||
check.match(lr.content?.[0]?.type === 'text' ? lr.content[0].text : '', /era=legacy/);
|
||||
await legacy.close();
|
||||
|
||||
// 2026 client → routed to the strict modern entry.
|
||||
const modern = new Client({ name: 'legacy-routing-client', version: '1.0.0' }, { versionNegotiation: { mode: 'auto' } });
|
||||
await modern.connect(new StreamableHTTPClientTransport(new URL(url)));
|
||||
check.equal(modern.getNegotiatedProtocolVersion(), '2026-07-28');
|
||||
const mr = await modern.callTool({ name: 'greet', arguments: { name: 'B' } });
|
||||
check.match(mr.content?.[0]?.type === 'text' ? mr.content[0].text : '', /era=modern/);
|
||||
await modern.close();
|
||||
Loading…
Reference in a new issue