@absolutejs/mcp 0.4.0 → 0.4.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.
package/README.md CHANGED
@@ -177,11 +177,40 @@ spec also forbids eliciting **sensitive information**.
177
177
  **The trade-off, stated plainly.** Elicitation is the one MCP feature a
178
178
  stateless server cannot do: the question goes out on the SSE stream of an
179
179
  in-flight `tools/call`, and the client answers on a _separate_ HTTP POST. Two
180
- requests have to meet, so the pending call is remembered in-process and the
181
- endpoint becomes **session-stateful** (`Mcp-Session-Id`). Run one instance, or
182
- pin sessions. Leave `elicitation` off the default and nothing changes: the
183
- server stays stateless, `tools/call` keeps answering with a plain JSON body, and
184
- only tools marked `mayElicit` ever stream.
180
+ requests have to meet, so the endpoint becomes **session-stateful**
181
+ (`Mcp-Session-Id`). Leave `elicitation` off — the default — and nothing changes:
182
+ the server stays stateless, `tools/call` keeps answering with a plain JSON body,
183
+ and only tools marked `mayElicit` ever stream.
184
+
185
+ **Running more than one instance.** Behind one server the defaults handle it.
186
+ Behind several, two different things break, and each has a seam:
187
+
188
+ ```ts
189
+ elicitation: {
190
+ enabled: true,
191
+ // (1) The client initializes on A and calls a tool on B, which has never
192
+ // heard of the session. Put session state where every instance sees it.
193
+ // It is an id and a boolean — nothing sensitive, nothing large.
194
+ store: {
195
+ create: ({ canElicit }) => db.insertSession(canElicit), // → id
196
+ get: (id) => db.findSession(id), // → { canElicit } | null
197
+ drop: (id) => db.deleteSession(id),
198
+ },
199
+ // (2) The tool call and its question live on ONE instance, but the user's
200
+ // answer POST can land on any of them. A promise cannot move, so route
201
+ // the answer to the instance that is waiting — over whatever fan-out you
202
+ // already run (Postgres LISTEN/NOTIFY, Redis, …).
203
+ bus: {
204
+ publish: (answer) => notify("mcp_elicit", answer),
205
+ subscribe: (handler) => listen("mcp_elicit", handler),
206
+ },
207
+ }
208
+ ```
209
+
210
+ Supply neither and run a single instance (or pin sessions). Supply both and
211
+ elicitation is safe behind a load balancer with **no sticky routing** — there is
212
+ a test for exactly that: instance A asks, the answer lands on B, the bus carries
213
+ it back, and A's call finishes.
185
214
 
186
215
  Consuming a server that elicits? Pass `onElicit` to `createMcpClient` — that is
187
216
  what declares the capability, and what the package uses to answer. Omit it and
@@ -38,4 +38,4 @@ export { createMcpHandler } from "./handler";
38
38
  export { metadataPathFor, protectedResourceMetadata, type ProtectedResourceMetadata, } from "./metadata";
39
39
  export { mcpServer } from "./server";
40
40
  export { createSessionRegistry, type SessionRegistry } from "./sessions";
41
- export type { McpAudioContent, McpElicitationRequest, McpElicitResult, McpAuthResult, McpCallGate, McpCallMeta, McpContent, McpImageContent, McpPromptArgument, McpPromptDefinition, McpPrompts, McpResource, McpResourceLink, McpResources, McpServerConfig, McpServerInfo, McpTextContent, McpTool, McpToolAnnotations, McpToolCallContext, McpToolContext, McpToolRegistry, McpToolResult, McpToolReturn, } from "./types";
41
+ export type { McpAudioContent, McpElicitAnswer, McpElicitationRequest, McpElicitBus, McpElicitResult, McpSessionStore, McpAuthResult, McpCallGate, McpCallMeta, McpContent, McpImageContent, McpPromptArgument, McpPromptDefinition, McpPrompts, McpResource, McpResourceLink, McpResources, McpServerConfig, McpServerInfo, McpTextContent, McpTool, McpToolAnnotations, McpToolCallContext, McpToolContext, McpToolRegistry, McpToolResult, McpToolReturn, } from "./types";
package/package.json CHANGED
@@ -37,5 +37,5 @@
37
37
  "typecheck": "tsc --noEmit --project tsconfig.json"
38
38
  },
39
39
  "types": "./dist/src/index.d.ts",
40
- "version": "0.4.0"
40
+ "version": "0.4.2"
41
41
  }