rails-ai-context 5.16.0 → 5.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59c335a48ab2976318ed2fc58d1cce4e2153c0db0144b61ca8d902f160bbeb76
4
- data.tar.gz: 334cc340093515797006c8326b47fa97721c9e66f07f940f3ec0864db2ae241a
3
+ metadata.gz: 91f2141cb80001b16aa88dc0512da99e1f8b72069716920ddf93ac5011c0074b
4
+ data.tar.gz: fd468f67533f4e7d5f9a00f27af3508a3fe1df2834321a66ad7411d8e4e83701
5
5
  SHA512:
6
- metadata.gz: f0e5532e52f873a3cb659dbf90fde582974f4840609f0c8365318f5b862659475484232e9ead3fd0074ec1a079db565cd8046a157ceb4f1bc1099b08877feded
7
- data.tar.gz: e6bd4fe02b30344a494a8af944ab6ca94e07f944d143d99bd4f116ca3f15099a5fbbe840b38c1b186398c43c3b23825889fd4b852593fc09342edc50910cd4e9
6
+ metadata.gz: 59a7f897a5241af025bf4b383d60b12548f08a6fdaf7c80cb0acb398b5984134367bf01b8fc9441a842fd99c197bea59e325b3fa3365ef274249a4e80e7a6306
7
+ data.tar.gz: 2adc3898c6fd3df5026d59a8aef9d4141ee53d902f36797b64c5fce2e1a4698144cb25212a7a14478b10124afba6cde680c8cbb78dfbdb791fbcf9a16f03ad5b
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [5.16.1] - 2026-07-12
9
+
10
+ ### Fixed
11
+
12
+ - **Engine-mounted MCP works on Rails 7.0-7.2** (caught by the release e2e
13
+ matrix minutes after 5.16.0 shipped; 8.x was unaffected). The MCP
14
+ transport answers SSE-mode requests with a Rack 3 streaming body (a
15
+ Proc); Rails 7.x's response buffer fed that Proc through Rack::ETag,
16
+ which 500'd every `tools/call` through
17
+ `mount RailsAiContext::Engine, at: "/mcp"`. `McpController` now includes
18
+ `ActionController::Live` and pumps callable bodies through the live
19
+ stream (enumerable bodies are joined to a plain string), verified with
20
+ real curl MCP sessions against booted Rails 7.0, 7.1, 7.2, and 8.0 apps.
21
+
8
22
  ## [5.16.0] - 2026-07-12
9
23
 
10
24
  ### Fixed
@@ -7,11 +7,40 @@ module RailsAiContext
7
7
  #
8
8
  # Mount in routes: mount RailsAiContext::Engine, at: "/mcp"
9
9
  class McpController < ActionController::API
10
+ # Live: the transport answers SSE-mode requests with a Rack 3 streaming
11
+ # body (a Proc that writes to a stream). Handing that Proc to a plain
12
+ # controller works only where the response body passes through untouched;
13
+ # Rails 7.x's response buffer feeds it through Rack::ETag, which 500s on
14
+ # the callable. Live's stream is exactly the interface the Proc expects
15
+ # (write/close) and keeps every middleware away from the body on all
16
+ # supported Rails versions.
17
+ include ActionController::Live
18
+
10
19
  def handle
11
- rack_response = self.class.mcp_transport.handle_request(request)
12
- self.status = rack_response[0]
13
- rack_response[1].each { |k, v| response.headers[k] = v }
14
- self.response_body = rack_response[2]
20
+ status_code, rack_headers, body = self.class.mcp_transport.handle_request(request)
21
+ self.status = status_code
22
+ rack_headers.each { |k, v| response.headers[k] = v }
23
+
24
+ if body.respond_to?(:each)
25
+ # Plain enumerable body (initialize, errors, JSON mode): join to a
26
+ # string so Content-Length/ETag semantics stay conventional.
27
+ chunks = []
28
+ body.each { |chunk| chunks << chunk }
29
+ body.close if body.respond_to?(:close)
30
+ self.response_body = chunks.join
31
+ elsif body.respond_to?(:call)
32
+ begin
33
+ body.call(response.stream)
34
+ ensure
35
+ begin
36
+ response.stream.close
37
+ rescue StandardError
38
+ nil
39
+ end
40
+ end
41
+ else
42
+ self.response_body = body
43
+ end
15
44
  end
16
45
 
17
46
  class << self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAiContext
4
- VERSION = "5.16.0"
4
+ VERSION = "5.16.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-ai-context
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.16.0
4
+ version: 5.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - crisnahine