talk_to_your_app 0.1.0.pre.1 → 0.1.0.pre.2

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: cab6705b5c1fffe989fa665c452b433bc245e3f4f367009714ca36c97b4b55c4
4
- data.tar.gz: 21044992a79652e184e174bf867bae2b3569d56420299c96ac3487f5098d2385
3
+ metadata.gz: 10204bc4a2149e7f2f78edd74990df717777df92e8312cd5d71f4d628a66e732
4
+ data.tar.gz: 32bfa44be84cd987c93e0553328126dbca1f1efb0f13d15b62d8cecdbb4a5456
5
5
  SHA512:
6
- metadata.gz: 9c1679d7a4b0fcea64c7c3007b6925dd7a7eabb513990b4247b35092b453d0c3f0488d39e511b15593ff43cb5aa4adc6800bc19b71dcc28a92c2a8b4c447a232
7
- data.tar.gz: 7855f1866f5fba865424544ae143176e727f569b621e7c5e950e3df592f63c1babb828d82aa6b460e3cf40b5e81966bc3ec82f99832c8997d04b3739409ba2ea
6
+ metadata.gz: 8b1ed1bfd86c608f3fd8867b2c376ca92068f05044506291a034e2636da306656ee218a1bf0d9cd974d6eb1879256d6dc47db4c0d8e4ddd0b3ac1bd17440bddf
7
+ data.tar.gz: 630827c1779170f29c971d12310cf4f77ceb51f1504e160140bf6013d90214f4d892a949a9aa04f79c00c9781b053f926ac6a523c57a56a9b2cb267d0145073e
@@ -34,6 +34,15 @@ module TalkToYourApp
34
34
  # protection). Empty allowlist permits non-browser clients (no Origin).
35
35
  attr_accessor :allowed_origins
36
36
 
37
+ # When true, the Streamable HTTP transport runs stateless: every request is
38
+ # self-contained, with no per-session state held in the transport. Required
39
+ # when the host app runs more than one Puma/Unicorn worker or replica, where
40
+ # a follow-up request can land on a process that never saw the `initialize`
41
+ # handshake and would otherwise fail with "Session not found". Trades away
42
+ # SSE streaming and server-initiated notifications, neither of which the
43
+ # bundled read-only tools use. Default false.
44
+ attr_accessor :stateless
45
+
37
46
  def initialize
38
47
  @mount_at = "/mcp"
39
48
  @server_name = "talk_to_your_app"
@@ -46,6 +55,7 @@ module TalkToYourApp
46
55
  @logger = nil
47
56
  @api_keys = {}
48
57
  @allowed_origins = []
58
+ @stateless = false
49
59
  @basic_auth = nil
50
60
  @log_level = :info
51
61
  @authorizer = nil
@@ -8,8 +8,9 @@ module TalkToYourApp
8
8
  # Builds the Rack application the host app mounts. It assembles an
9
9
  # MCP::Server from the enabled plugins' tools, wraps it in the SDK's
10
10
  # Streamable HTTP transport, and fronts the whole thing with the auth
11
- # middleware. The session layer lives entirely in the SDK transport, so a
12
- # future stateless flip (2026-07-28 RC) is a one-line change here.
11
+ # middleware. `config.stateless` selects the transport's stateless mode,
12
+ # which holds no per-session state required when the host app runs more
13
+ # than one worker or replica.
13
14
  module RailsMount
14
15
  module_function
15
16
 
@@ -25,6 +26,7 @@ module TalkToYourApp
25
26
  )
26
27
  transport = MCP::Server::Transports::StreamableHTTPTransport.new(
27
28
  server,
29
+ stateless: config.stateless,
28
30
  enable_json_response: true,
29
31
  )
30
32
  Auth::Middleware.new(transport)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TalkToYourApp
4
- VERSION = "0.1.0.pre.1"
4
+ VERSION = "0.1.0.pre.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: talk_to_your_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.1
4
+ version: 0.1.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor