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 +4 -4
- data/CHANGELOG.md +14 -0
- data/app/controllers/rails_ai_context/mcp_controller.rb +33 -4
- data/lib/rails_ai_context/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 91f2141cb80001b16aa88dc0512da99e1f8b72069716920ddf93ac5011c0074b
|
|
4
|
+
data.tar.gz: fd468f67533f4e7d5f9a00f27af3508a3fe1df2834321a66ad7411d8e4e83701
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
12
|
-
self.status =
|
|
13
|
-
|
|
14
|
-
|
|
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
|