-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When testing in LM Studio an MCP server built with the StreamableHTTPTransport
I get an error about the body of the response to tool calls "code": "unrecognized_keys", "keys": [ "accepted" ]"
I tried modifying the response from send_response_to_stream
(
[200, { "Content-Type" => "application/json" }, [{ accepted: true }.to_json]] |
ie
def send_response_to_stream(stream, response, session_id)
if response
message = JSON.parse(response)
send_to_stream(stream, message)
end
[202, {}, []]
...
Looking at the spec I see https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#sending-messages-to-the-server If the server accepts the input, the server MUST return HTTP status code 202 Accepted with no body.
... but Im not sure if thats the relavent section related to send_response_to_stream
Logs
MCP Responded with
127.0.0.1 - - [21/Aug/2025:05:27:41 +0000] "POST / HTTP/1.1" 200 - 0.0007
[MCP] Request: notifications/initialized (id: )
[MCP] Request body: {
"method": "notifications/initialized",
"jsonrpc": "2.0"
}
127.0.0.1 - - [21/Aug/2025:05:27:41 +0000] "POST / HTTP/1.1" 202 - 0.0002
127.0.0.1 - - [21/Aug/2025:05:27:41 +0000] "GET / HTTP/1.1" 200 - 0.0002
[MCP] Request: tools/list (id: 1)
[MCP] Request body: {
"method": "tools/list",
"params": {},
"jsonrpc": "2.0",
"id": 1
}
[MCP] Response: empty (id: )
[MCP] Response body: {
"accepted": true
}
127.0.0.1 - - [21/Aug/2025:05:27:41 +0000] "POST / HTTP/1.1" 200 - 0.0003
then LM Studio reports this parse error:
Failed to load plugin tools: [ { "code": "invalid_union", "unionErrors": [ { "issues": [ { "code": "invalid_literal", "expected": "2.0", "path": [ "jsonrpc" ], "message": "Invalid literal value, expected \"2.0\"" }, { "code": "invalid_union", "unionErrors": [ { "issues": [ { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "id" ], "message": "Required" } ], "name": "ZodError" }, { "issues": [ { "code": "invalid_type", "expected": "number", "received": "undefined", "path": [ "id" ], "message": "Required" } ], "name": "ZodError" } ], "path": [ "id" ], "message": "Invalid input" }, { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "method" ], "message": "Required" }, { "code": "unrecognized_keys", "keys": [ "accepted" ], "path": [], "message": "Unrecognized key(s) in object: 'accepted'" } ], "name": "ZodError" }, { "issues": [ { "code": "invalid_literal", "expected": "2.0", "path": [ "jsonrpc" ], "message": "Invalid literal value, expected \"2.0\"" }, { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "method" ], "message": "Required" }, { "code": "unrecognized_keys", "keys": [ "accepted" ], "path": [], "message": "Unrecognized key(s) in object: 'accepted'" } ], "name": "ZodError" }, { "issues": [ { "code": "invalid_literal", "expected": "2.0", "path": [ "jsonrpc" ], "message": "Invalid literal value, expected \"2.0\"" }, { "code": "invalid_union", "unionErrors": [ { "issues": [ { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "id" ], "message": "Required" } ], "name": "ZodError" }, { "issues": [ { "code": "invalid_type", "expected": "number", "received": "undefined", "path": [ "id" ], "message": "Required" } ], "name": "ZodError" } ], "path": [ "id" ], "message": "Invalid input" }, { "code": "invalid_type", "expected": "object", "received": "undefined", "path": [ "result" ], "message": "Required" }, { "code": "unrecognized_keys", "keys": [ "accepted" ], "path": [], "message": "Unrecognized key(s) in object: 'accepted'" } ], "name": "ZodError" }, { "issues": [ { "code": "invalid_literal", "expected": "2.0", "path": [ "jsonrpc" ], "message": "Invalid literal value, expected \"2.0\"" }, { "code": "invalid_union", "unionErrors": [ { "issues": [ { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "id" ], "message": "Required" } ], "name": "ZodError" }, { "issues": [ { "code": "invalid_type", "expected": "number", "received": "undefined", "path": [ "id" ], "message": "Required" } ], "name": "ZodError" } ], "path": [ "id" ], "message": "Invalid input" }, { "code": "invalid_type", "expected": "object", "received": "undefined", "path": [ "error" ], "message": "Required" }, { "code": "unrecognized_keys", "keys": [ "accepted" ], "path": [], "message": "Unrecognized key(s) in object: 'accepted'" } ], "name": "ZodError" } ], "path": [], "message": "Invalid input" } ]
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working