chore: renumber draft error codes per modelcontextprotocol#2907 (#353)
The error-code allocation policy in modelcontextprotocol#2907 renumbers the draft-only codes: HeaderMismatch -32001 -> -32020, MissingRequiredClientCapability -32003 -> -32021, UnsupportedProtocolVersion -32004 -> -32022. This updates every reference in the suite (mocks, scenarios, fixtures, tests, traceability yaml) and re-syncs the vendored draft schema to that commit. src/seps/traceability.json is generated and intentionally left for the scheduled refresh workflow.
This commit is contained in:
parent
7c4bea4188
commit
fe3a3103bc
2 changed files with 73 additions and 57 deletions
|
|
@ -265,12 +265,8 @@ async function runRequestMetadataClient(serverUrl: string): Promise<void> {
|
|||
const clone = response.clone();
|
||||
try {
|
||||
const errorResult = await clone.json();
|
||||
// -32004 is UnsupportedProtocolVersionError in the draft schema;
|
||||
// -32001 is tolerated for servers that predate the dedicated code.
|
||||
if (
|
||||
errorResult.error?.code === -32004 ||
|
||||
errorResult.error?.code === -32001
|
||||
) {
|
||||
// UnsupportedProtocolVersionError is -32022 in the draft schema.
|
||||
if (errorResult.error?.code === -32022) {
|
||||
logger.debug(
|
||||
'Received UnsupportedProtocolVersionError, starting negotiation...'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1260,7 +1260,7 @@ app.post('/mcp', async (req, res) => {
|
|||
return res.status(400).json({
|
||||
jsonrpc: '2.0',
|
||||
id,
|
||||
error: { code: -32001, message: 'Missing MCP-Protocol-Version header' }
|
||||
error: { code: -32020, message: 'Missing MCP-Protocol-Version header' }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1283,25 +1283,25 @@ app.post('/mcp', async (req, res) => {
|
|||
});
|
||||
}
|
||||
|
||||
// Header Mismatch Verification (-32001, HTTP 400)
|
||||
// Header Mismatch Verification (-32020, HTTP 400)
|
||||
if (reqVersion !== metaVersion) {
|
||||
return res.status(400).json({
|
||||
jsonrpc: '2.0',
|
||||
id,
|
||||
error: {
|
||||
code: -32001,
|
||||
code: -32020,
|
||||
message: 'Mismatched MCP-Protocol-Version header'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Protocol Version Negotiation Matrix (-32004, HTTP 400)
|
||||
// Protocol Version Negotiation Matrix (-32022, HTTP 400)
|
||||
if (metaVersion !== '2026-07-28') {
|
||||
return res.status(400).json({
|
||||
jsonrpc: '2.0',
|
||||
id,
|
||||
error: {
|
||||
code: -32004,
|
||||
code: -32022,
|
||||
message: 'UnsupportedProtocolVersionError',
|
||||
data: {
|
||||
supported: ['2026-07-28'],
|
||||
|
|
@ -1655,13 +1655,13 @@ app.post('/mcp', async (req, res) => {
|
|||
if (name === 'test_missing_capability') {
|
||||
const clientCaps = meta['io.modelcontextprotocol/clientCapabilities'];
|
||||
|
||||
// Missing Required Client Capability Check (-32003, HTTP 400)
|
||||
// Missing Required Client Capability Check (-32021, HTTP 400)
|
||||
if (!clientCaps?.sampling) {
|
||||
return res.status(400).json({
|
||||
jsonrpc: '2.0',
|
||||
id,
|
||||
error: {
|
||||
code: -32003,
|
||||
code: -32021,
|
||||
message: 'MissingRequiredClientCapabilityError',
|
||||
data: { requiredCapabilities: ['sampling'] }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue