feat: support protocol version 2025-11-25 (#81)
- Update client initialization check to accept both 2025-06-18 and 2025-11-25 - Server echoes back client's version if valid (proper version negotiation) - Fixes compatibility with SDK 1.25.1+ which sends 2025-11-25 🦉 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5f1bedd54b
commit
3994cb3c86
2 changed files with 18 additions and 3 deletions
|
|
@ -23,12 +23,20 @@ export function createServerInfoCheck(serverInfo: {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Valid MCP protocol versions
|
||||||
|
const VALID_PROTOCOL_VERSIONS = ['2025-06-18', '2025-11-25'];
|
||||||
|
|
||||||
export function createClientInitializationCheck(
|
export function createClientInitializationCheck(
|
||||||
initializeRequest: any,
|
initializeRequest: any,
|
||||||
expectedSpecVersion: string = '2025-06-18'
|
expectedSpecVersion: string = '2025-11-25'
|
||||||
): ConformanceCheck {
|
): ConformanceCheck {
|
||||||
const protocolVersionSent = initializeRequest?.protocolVersion;
|
const protocolVersionSent = initializeRequest?.protocolVersion;
|
||||||
const versionMatch = protocolVersionSent === expectedSpecVersion;
|
|
||||||
|
// Accept known valid versions OR custom expected version (for backward compatibility)
|
||||||
|
const validVersions = VALID_PROTOCOL_VERSIONS.includes(expectedSpecVersion)
|
||||||
|
? VALID_PROTOCOL_VERSIONS
|
||||||
|
: [...VALID_PROTOCOL_VERSIONS, expectedSpecVersion];
|
||||||
|
const versionMatch = validVersions.includes(protocolVersionSent);
|
||||||
|
|
||||||
const errors: string[] = [];
|
const errors: string[] = [];
|
||||||
if (!protocolVersionSent) errors.push('Protocol version not provided');
|
if (!protocolVersionSent) errors.push('Protocol version not provided');
|
||||||
|
|
|
||||||
|
|
@ -110,11 +110,18 @@ export class InitializeScenario implements Scenario {
|
||||||
|
|
||||||
this.checks.push(clientChecks.createServerInfoCheck(serverInfo));
|
this.checks.push(clientChecks.createServerInfoCheck(serverInfo));
|
||||||
|
|
||||||
|
// Echo back client's version if valid, otherwise use latest
|
||||||
|
const VALID_VERSIONS = ['2025-06-18', '2025-11-25'];
|
||||||
|
const clientVersion = initializeRequest?.protocolVersion;
|
||||||
|
const responseVersion = VALID_VERSIONS.includes(clientVersion)
|
||||||
|
? clientVersion
|
||||||
|
: '2025-11-25';
|
||||||
|
|
||||||
const response = {
|
const response = {
|
||||||
jsonrpc: '2.0',
|
jsonrpc: '2.0',
|
||||||
id: request.id,
|
id: request.id,
|
||||||
result: {
|
result: {
|
||||||
protocolVersion: '2025-06-18',
|
protocolVersion: responseVersion,
|
||||||
serverInfo,
|
serverInfo,
|
||||||
capabilities: {}
|
capabilities: {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue