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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10204bc4a2149e7f2f78edd74990df717777df92e8312cd5d71f4d628a66e732
|
|
4
|
+
data.tar.gz: 32bfa44be84cd987c93e0553328126dbca1f1efb0f13d15b62d8cecdbb4a5456
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
12
|
-
#
|
|
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)
|