-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Sometimes when we try to list tools we get
Error POSTing to endpoint (HTTP 422): Unexpected message, expect initialize request
curl 'http://localhost:6277/mcp?url=REDACTED&transportType=streamable-http'
-H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8'
-H 'Connection: keep-alive'
-H 'Origin: http://localhost:6274'
-H 'Referer: http://localhost:6274/'
-H 'Sec-Fetch-Dest: empty'
-H 'Sec-Fetch-Mode: cors'
-H 'Sec-Fetch-Site: same-site'
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36'
-H 'accept: application/json, text/event-stream'
-H 'content-type: application/json'
-H 'mcp-protocol-version: 2025-03-26'
-H 'mcp-session-id: 077e3d98-e726-47d5-9b2e-586fce700e97'
-H 'sec-ch-ua: "Chromium";v="142", "Google Chrome";v="142", "Not_A Brand";v="99"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "macOS"' \
--data-raw '{"method":"tools/list","params":{"_meta":{"progressToken":5}},"jsonrpc":"2.0","id":5}'
Request Headers
POST /mcp?url=REDACTEDtransportType=streamable-http HTTP/1.1
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Connection: keep-alive
Content-Length: 85
Host: localhost:6277
Origin: http://localhost:6274
Referer: http://localhost:6274/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
accept: application/json, text/event-stream
content-type: application/json
mcp-protocol-version: 2025-03-26
mcp-session-id: 077e3d98-e726-47d5-9b2e-586fce700e97
sec-ch-ua: "Chromium";v="142", "Google Chrome";v="142", "Not_A Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "macOS"
Response
event: message
data: {"jsonrpc":"2.0","id":5,"error":{"code":-32001,"message":"Error POSTing to endpoint (HTTP 422): Unexpected message, expect initialize request","data":{}}}
The request is correct.
If I Reconnect in MCP inspector, the issue disappears