Repository navigation
Commit 96b50f2
committed
Handle a
MCP requires `_meta` to be an object. When a request's `_meta` is a
string, an array or a number, three `dig(:_meta, ...)` calls raised
TypeError instead of answering a client error:
- `validate_modern_headers` (Streamable HTTP, 2026-07-28): every method
answered HTTP 500 -32603. `RequestEnvelope.parse!` already treats a
non-object `_meta` as empty to answer -32602, but the header check
runs first.
- `call_tool`: legacy `tools/call` answered -32603 Internal error.
- `build_server_context`: legacy `prompts/get` answered -32603.
A non-object `_meta` carries no protocol version and no progress token,
so these reads now skip it. The 2026-07-28 path answers HTTP 400 -32602,
and legacy `tools/call` and `prompts/get` ignore the value, as legacy
`tools/list` and `RequestEnvelope.modern?` already do._meta that is not an object without raising1 parent 3b2c60b commit 96b50f2
4 files changed
Lines changed: 28 additions & 3 deletions
File tree
- lib/mcp
- server/transports
- test/mcp
- server/transports
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1403 | 1403 | | |
1404 | 1404 | | |
1405 | 1405 | | |
1406 | | - | |
| 1406 | + | |
1407 | 1407 | | |
1408 | 1408 | | |
1409 | 1409 | | |
| |||
1915 | 1915 | | |
1916 | 1916 | | |
1917 | 1917 | | |
1918 | | - | |
| 1918 | + | |
1919 | 1919 | | |
1920 | 1920 | | |
1921 | 1921 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
983 | | - | |
| 983 | + | |
984 | 984 | | |
985 | 985 | | |
986 | 986 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6505 | 6505 | | |
6506 | 6506 | | |
6507 | 6507 | | |
| 6508 | + | |
| 6509 | + | |
| 6510 | + | |
| 6511 | + | |
| 6512 | + | |
| 6513 | + | |
| 6514 | + | |
| 6515 | + | |
| 6516 | + | |
| 6517 | + | |
| 6518 | + | |
6508 | 6519 | | |
6509 | 6520 | | |
6510 | 6521 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4321 | 4321 | | |
4322 | 4322 | | |
4323 | 4323 | | |
| 4324 | + | |
| 4325 | + | |
| 4326 | + | |
| 4327 | + | |
| 4328 | + | |
| 4329 | + | |
| 4330 | + | |
| 4331 | + | |
| 4332 | + | |
| 4333 | + | |
| 4334 | + | |
| 4335 | + | |
| 4336 | + | |
| 4337 | + | |
4324 | 4338 | | |
4325 | 4339 | | |
4326 | 4340 | | |
| |||
0 commit comments