vector_mcp 0.6.0 → 0.7.0
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 +12 -0
- data/lib/vector_mcp/server/message_handling.rb +2 -3
- data/lib/vector_mcp/session.rb +5 -73
- data/lib/vector_mcp/transport/http_stream/stream_handler.rb +2 -11
- data/lib/vector_mcp/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: 19883e6171b2fc442256036ec7841130c8ef557f7b5a58c354aa3880c6910907
|
|
4
|
+
data.tar.gz: 4e5d96fe5172319af0af30f8118704c469ccb9bfc543dead9907b4c42a0b0373
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 276a4391c46cce453ecda4cdb1582f19b0b06f762a737c30e2369bdc4a3e42f6a95f83eef46b62e9cded7e4be28095f780bf0bc8edcfe2f533fea449cabd9e6e
|
|
7
|
+
data.tar.gz: d57ebbcbd8d8bc3cbbbf110aa3b669ef54ba41fbdcc848f3dd06b2f3bc1610b6be7552ff67d3dd6467498d6240b9e0b761096d0f138656e5a189d4fdd48fac5f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [0.7.0] – 2026-08-15
|
|
2
|
+
|
|
3
|
+
### Removed (deprecated in 0.6.0)
|
|
4
|
+
|
|
5
|
+
* **The request-scoped API on `Session`**: `request_context=`, `update_request_context`, `request_headers?`, `request_params?`, `request_header`, `request_param`. Request-scoped data lives on the per-request `VectorMCP::Invocation` passed to handlers; sessions keep only their creation-time context.
|
|
6
|
+
* **`Server#handle_message`'s third `session_id` argument** — the signature is now `handle_message(message, session)`.
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
* **Docs and examples teach the invocation-based handler signatures** (`do |args, invocation|`); handlers written against the legacy security-context argument continue to work via the invocation's forwarded auth API.
|
|
11
|
+
* **Stream handler drops the legacy session-id connection keying** — streaming connections are tracked solely by stream ID (per-stream, resumable); the dead session-id fallback lookups are removed.
|
|
12
|
+
|
|
1
13
|
## [0.6.0] – 2026-07-19
|
|
2
14
|
|
|
3
15
|
### Added
|
|
@@ -12,12 +12,11 @@ module VectorMCP
|
|
|
12
12
|
# @param message [Hash] The parsed JSON-RPC message object.
|
|
13
13
|
# @param session [VectorMCP::Session, VectorMCP::Invocation] The session (or per-request
|
|
14
14
|
# invocation view of it) this message belongs to.
|
|
15
|
-
# @param session_id [String, nil] Deprecated: defaults to session.id; used only for log prefixes.
|
|
16
15
|
# @return [Object, nil] For requests, returns the result data to be sent in the JSON-RPC response.
|
|
17
16
|
# For notifications, returns `nil`.
|
|
18
17
|
# @raise [VectorMCP::ProtocolError] if the message is invalid or an error occurs during handling.
|
|
19
|
-
def handle_message(message, session
|
|
20
|
-
session_id
|
|
18
|
+
def handle_message(message, session)
|
|
19
|
+
session_id = session.id
|
|
21
20
|
id = message["id"]
|
|
22
21
|
method = message["method"]
|
|
23
22
|
params = message["params"] || {}
|
data/lib/vector_mcp/session.rb
CHANGED
|
@@ -113,69 +113,11 @@ module VectorMCP
|
|
|
113
113
|
Time.now - @created_at
|
|
114
114
|
end
|
|
115
115
|
|
|
116
|
-
#
|
|
117
|
-
#
|
|
118
|
-
#
|
|
119
|
-
#
|
|
120
|
-
#
|
|
121
|
-
# @return [RequestContext] The newly set request context.
|
|
122
|
-
# @raise [ArgumentError] If the context is not a RequestContext or Hash.
|
|
123
|
-
def request_context=(context)
|
|
124
|
-
deprecated_request_api(:request_context=)
|
|
125
|
-
@request_context = case context
|
|
126
|
-
when RequestContext
|
|
127
|
-
context
|
|
128
|
-
when Hash
|
|
129
|
-
RequestContext.new(**context)
|
|
130
|
-
else
|
|
131
|
-
raise ArgumentError, "Request context must be a RequestContext or Hash, got #{context.class}"
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
# Updates the request context with new data.
|
|
136
|
-
#
|
|
137
|
-
# @deprecated Will be removed in 0.7. Use the per-request invocation's
|
|
138
|
-
# {VectorMCP::Invocation#update_request_context} instead.
|
|
139
|
-
# @param attributes [Hash] The attributes to merge into the request context.
|
|
140
|
-
# @return [RequestContext] The updated request context.
|
|
141
|
-
def update_request_context(**attributes)
|
|
142
|
-
deprecated_request_api(:update_request_context)
|
|
143
|
-
@request_context = @request_context.merge(attributes)
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
# @deprecated Will be removed in 0.7. Use the per-request invocation's
|
|
147
|
-
# {VectorMCP::Invocation#request_headers?} instead.
|
|
148
|
-
# @return [Boolean] True if the request context has headers.
|
|
149
|
-
def request_headers?
|
|
150
|
-
deprecated_request_api(:request_headers?)
|
|
151
|
-
@request_context.headers?
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# @deprecated Will be removed in 0.7. Use the per-request invocation's
|
|
155
|
-
# {VectorMCP::Invocation#request_params?} instead.
|
|
156
|
-
# @return [Boolean] True if the request context has parameters.
|
|
157
|
-
def request_params?
|
|
158
|
-
deprecated_request_api(:request_params?)
|
|
159
|
-
@request_context.params?
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
# @deprecated Will be removed in 0.7. Use the per-request invocation's
|
|
163
|
-
# {VectorMCP::Invocation#request_header} instead.
|
|
164
|
-
# @param name [String] The header name.
|
|
165
|
-
# @return [String, nil] The header value or nil if not found.
|
|
166
|
-
def request_header(name)
|
|
167
|
-
deprecated_request_api(:request_header)
|
|
168
|
-
@request_context.header(name)
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
# @deprecated Will be removed in 0.7. Use the per-request invocation's
|
|
172
|
-
# {VectorMCP::Invocation#request_param} instead.
|
|
173
|
-
# @param name [String] The parameter name.
|
|
174
|
-
# @return [String, nil] The parameter value or nil if not found.
|
|
175
|
-
def request_param(name)
|
|
176
|
-
deprecated_request_api(:request_param)
|
|
177
|
-
@request_context.param(name)
|
|
178
|
-
end
|
|
116
|
+
# NOTE: The request-scoped convenience API that used to live here
|
|
117
|
+
# (request_context=, update_request_context, request_headers?,
|
|
118
|
+
# request_params?, request_header, request_param) was removed in 0.7.
|
|
119
|
+
# Request-scoped data travels on the per-request {VectorMCP::Invocation}
|
|
120
|
+
# passed to handlers; the session only keeps its creation-time context.
|
|
179
121
|
|
|
180
122
|
# Helper to check client capabilities later if needed
|
|
181
123
|
# def supports?(capability_key)
|
|
@@ -238,16 +180,6 @@ module VectorMCP
|
|
|
238
180
|
|
|
239
181
|
private
|
|
240
182
|
|
|
241
|
-
# Emit the standard deprecation warning for the request-scoped Session API.
|
|
242
|
-
# @api private
|
|
243
|
-
def deprecated_request_api(method_name)
|
|
244
|
-
VectorMCP.deprecation_warning(
|
|
245
|
-
"Session##{method_name} is deprecated and will be removed in 0.7; " \
|
|
246
|
-
"request-scoped data lives on the per-request invocation passed to handlers " \
|
|
247
|
-
"(e.g. invocation.request_header)"
|
|
248
|
-
)
|
|
249
|
-
end
|
|
250
|
-
|
|
251
183
|
# Validates that sampling can be performed on this session.
|
|
252
184
|
# @api private
|
|
253
185
|
# @raise [StandardError, InitializationError] if preconditions are not met.
|
|
@@ -223,7 +223,7 @@ module VectorMCP
|
|
|
223
223
|
loop do
|
|
224
224
|
sleep(30) # Send heartbeat every 30 seconds
|
|
225
225
|
|
|
226
|
-
connection = @active_connections[stream_id]
|
|
226
|
+
connection = @active_connections[stream_id]
|
|
227
227
|
break if connection.nil? || connection.closed?
|
|
228
228
|
|
|
229
229
|
# Check if connection has been alive too long
|
|
@@ -278,11 +278,9 @@ module VectorMCP
|
|
|
278
278
|
# @return [void]
|
|
279
279
|
def cleanup_connection(session, connection = nil)
|
|
280
280
|
connection ||= session.streaming_connection
|
|
281
|
-
connection ||= @active_connections[session.id]
|
|
282
281
|
return unless connection
|
|
283
282
|
|
|
284
283
|
@active_connections.delete(connection.stream_id)
|
|
285
|
-
@active_connections.delete(session.id) if @active_connections[session.id] == connection
|
|
286
284
|
|
|
287
285
|
connection.close
|
|
288
286
|
@transport.session_manager.remove_streaming_connection(session, connection)
|
|
@@ -324,16 +322,9 @@ module VectorMCP
|
|
|
324
322
|
end
|
|
325
323
|
|
|
326
324
|
def active_connections_for_session(session)
|
|
327
|
-
|
|
325
|
+
session.streaming_connections.values.select do |connection|
|
|
328
326
|
@active_connections[connection.stream_id] == connection && !connection.closed?
|
|
329
327
|
end
|
|
330
|
-
|
|
331
|
-
legacy_connection = @active_connections[session.id]
|
|
332
|
-
connections << legacy_connection if legacy_connection &&
|
|
333
|
-
!legacy_connection.closed? &&
|
|
334
|
-
!connections.include?(legacy_connection)
|
|
335
|
-
|
|
336
|
-
connections
|
|
337
328
|
end
|
|
338
329
|
|
|
339
330
|
def preferred_connection_for(session, connections)
|
data/lib/vector_mcp/version.rb
CHANGED