ruby-sdk/test/mcp
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Koichi ITO 09c89aef14 Parse HTTP client response bodies without Faraday's JSON middleware
## Motivation and Context

json 3.0, released on 2026-09-07, accepts the options of `JSON.parse` as keywords only, and Faraday's json response middleware,
through 2.14.3, hands them over as a positional Hash, which Ruby 3 no longer converts. With both installed, every JSON body
the client receives fails inside that middleware, and `MCP::Client::HTTP` reports each request as an internal error.
Faraday's main branch passes the options as keywords, but no release carries that yet.

The client already parses streamed bodies and buffered SSE bodies itself; only a JSON body delivered
whole by an adapter without streaming support still went through the middleware. The client now parses that body too
and no longer registers the middleware, so every body takes `parse_json_buffer` and a malformed one answers
`:parse_error` whichever way it arrived. A JSON middleware added through the Faraday customizer block still works,
since a body it has parsed already is used as is.

## How Has This Been Tested?

A new test drives a buffered JSON response through a stand-in `JSON.parse` with the json 3.0 signature, options as keywords only,
so on Ruby 3 it failed with the middleware registered whatever json version is installed and passes now.
The existing buffered-body test keeps covering the plain path. The full suite passes on Ruby 3.0.7 with json 3.0.1 and faraday 2.14.3,
where five client tests failed before.

## Breaking Changes

None. A malformed JSON body delivered by an adapter without streaming support now raises `RequestHandlerError` with `error_type: :parse_error`,
as the streamed path already did, instead of `:internal_error` wrapping a `Faraday::ParsingError`.
2026-09-08 18:09:09 +09:00
..
client Parse HTTP client response bodies without Faraday's JSON middleware 2026-09-08 18:09:09 +09:00
elicitation Add MCP::Elicitation::EnumSchema builders for SEP-1330 2026-08-05 12:26:13 +09:00
prompt Add _meta field to resource, content, and result classes 2026-04-11 15:08:55 +09:00
resource Add _meta field to resource, content, and result classes 2026-04-11 15:08:55 +09:00
server Fix the flaky thread count assertion in the listen keepalive test 2026-09-04 00:19:38 +09:00
tool fix: preserve explicit tool response content 2026-07-23 03:11:48 +08:00
annotations_test.rb Add audience role validation for MCP::Annotations per MCP specification 2026-06-22 01:13:17 +09:00
apps_test.rb Add Server-Side MCP Apps Helpers per SEP-1865 2026-07-07 01:16:02 +09:00
cancellation_test.rb Support notifications/cancelled per MCP specification 2026-05-03 04:02:22 +09:00
client_test.rb Bound automatic pagination in the MCP client 2026-08-14 04:45:32 +09:00
configuration_test.rb Stop negotiating modern protocol versions through the initialize handshake 2026-08-14 16:08:07 +09:00
content_test.rb Add _meta field to resource, content, and result classes 2026-04-11 15:08:55 +09:00
error_codes_test.rb Add Stateless Lifecycle Foundations per SEP-2575 2026-07-26 20:03:57 +09:00
icon_test.rb Replace assert_empty with assert_equal using explicit literals 2026-02-24 16:09:34 +09:00
instrumentation_test.rb Expose the user-defined server_context in instrumentation data 2026-08-08 08:33:07 +09:00
logging_message_notification_test.rb Add logging support 2026-01-26 22:23:46 +09:00
methods_test.rb Add server/discover and stateless lifecycle error codes per SEP-2575 2026-07-04 20:24:37 +09:00
progress_test.rb Auto-set server.transport in Transport#initialize 2026-04-09 12:08:55 +09:00
prompt_test.rb Fix Prompt#validate_arguments! crash when arguments are nil 2026-03-01 17:21:41 +09:00
protocol_deprecations_test.rb feat: deprecate roots sampling and logging 2026-08-02 13:13:10 -04:00
request_envelope_test.rb Align modern envelope validation with the finalized spec 2026-08-08 16:00:29 +09:00
resource_template_test.rb Support class-based Resource and ResourceTemplate definitions 2026-07-10 22:39:42 +09:00
resource_test.rb Support class-based Resource and ResourceTemplate definitions 2026-07-10 22:39:42 +09:00
server_cancellation_test.rb Reject duplicate in-flight JSON-RPC request IDs 2026-08-17 03:47:35 +09:00
server_context_test.rb Bound server-to-client requests with a timeout 2026-08-13 23:16:59 +09:00
server_elicitation_test.rb Associate server-to-client requests with the originating client request per SEP-2260 2026-07-12 02:10:16 +09:00
server_input_required_legacy_shim_test.rb Fulfill input_required results on the legacy wire per SEP-2322 2026-08-14 02:46:38 +09:00
server_notification_test.rb Stop negotiating modern protocol versions through the initialize handshake 2026-08-14 16:08:07 +09:00
server_progress_test.rb Auto-set server.transport in Transport#initialize 2026-04-09 12:08:55 +09:00
server_roots_test.rb Stop negotiating modern protocol versions through the initialize handshake 2026-08-14 16:08:07 +09:00
server_sampling_test.rb Stop negotiating modern protocol versions through the initialize handshake 2026-08-14 16:08:07 +09:00
server_session_ping_test.rb Support server-to-client ping per MCP specification 2026-05-22 11:28:51 +09:00
server_session_request_timeout_test.rb Bound server-to-client requests with a timeout 2026-08-13 23:16:59 +09:00
server_test.rb Merge pull request #510 from koic/pass_meta_through_subscription_results 2026-08-20 16:06:22 +09:00
string_utils_test.rb Fix ReDoS vulnerability in StringUtils#underscore 2026-01-09 01:14:52 +09:00
tool_test.rb Speed Up Tool::Schema Validation by 5x to 100x 2026-06-01 21:47:30 +09:00
trace_context_test.rb Support W3C Trace Context Propagation via _meta per SEP-414 2026-06-12 14:36:24 +09:00
transport_test.rb Remove redundant require statements 2025-08-02 00:57:31 +09:00