Describe the bug
When the client sends POST notifications/initialized after the negotiation round trip, the test scenario server returns HTTP 200 with body {"jsonrpc": "2.0", "result": {}} in the last condition branch without id as it's a response to id-less notification from the client:
if (request.method === 'initialize') {
this.handleInitialize(request, res);
} else if (request.method === 'tools/list') {
this.handleToolsList(request, res);
} else {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(
JSON.stringify({
jsonrpc: '2.0',
id: request.id,
result: {}
})
);
}
As per specification 2.1 Sending Messages to the Server point 4:
- If the input is a JSON-RPC response or notification:
- If the server accepts the input, the server MUST return HTTP status code 202 Accepted with no body.
- If the server cannot accept the input, it MUST return an HTTP error status code (e.g., 400 Bad Request). The HTTP response body MAY comprise a JSON-RPC error response that has no id.
This causes strict client implementation to fail, as it never expects a JSON response without id unless it has HTTP error status as per quoted spec. Client implementation needs a nasty workaround to don't throw error for this scenario which could cause issues with real world MCP server.
Expected behavior
Test server returns 202 Accepted with no body as response for notifications/initialized.
I am happy to contribute if you agree with what I've found 🤔
Describe the bug
When the client sends POST
notifications/initializedafter the negotiation round trip, the test scenario server returns HTTP 200 with body{"jsonrpc": "2.0", "result": {}}in the last condition branch withoutidas it's a response to id-less notification from the client:As per specification 2.1 Sending Messages to the Server point 4:
This causes strict client implementation to fail, as it never expects a JSON response without
idunless it has HTTP error status as per quoted spec. Client implementation needs a nasty workaround to don't throw error for this scenario which could cause issues with real world MCP server.Expected behavior
Test server returns 202 Accepted with no body as response for
notifications/initialized.I am happy to contribute if you agree with what I've found 🤔