@smithery/sdk 4.2.0 → 4.3.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.
@@ -1,5 +1,4 @@
1
1
  import type { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
- import type { Notification } from "@modelcontextprotocol/sdk/types.js";
3
2
  import type { z } from "zod";
4
3
  export type Session = {
5
4
  id: string;
@@ -10,11 +9,18 @@ export type Session = {
10
9
  export type StatelessServerContext<TConfig = unknown> = {
11
10
  config: TConfig;
12
11
  env: Record<string, string | undefined>;
12
+ accessToken?: string;
13
13
  };
14
14
  export type StatefulServerContext<TConfig = unknown> = {
15
15
  config: TConfig;
16
16
  session: Session;
17
17
  env: Record<string, string | undefined>;
18
+ accessToken?: string;
19
+ /**
20
+ * Register a handler for messages sent via `sessions.send()`.
21
+ * This enables callback-based message passing outside the MCP protocol.
22
+ */
23
+ onMessage: (handler: (message: unknown) => unknown | Promise<unknown>) => void;
18
24
  };
19
25
  export type ServerContext<TConfig = unknown> = StatelessServerContext<TConfig> | StatefulServerContext<TConfig>;
20
26
  export type SandboxServerContext = {
@@ -69,16 +75,10 @@ export type StatefulHttpContext = {
69
75
  env: Record<string, string | undefined>;
70
76
  sessions: {
71
77
  /**
72
- * Send a notification directly to the connected client (via `transport.send()`),
73
- * bypassing the server's notification handler chain.
74
- * Use this for webhook → client notification routing.
75
- */
76
- notify(sessionId: string, notification: Notification): Promise<void>;
77
- /**
78
- * Inject a raw JSON-RPC message into the server's handler chain for processing.
79
- * The server's registered request/notification handlers will be invoked.
78
+ * Send an arbitrary message to the session's registered `onMessage` handler.
79
+ * Returns the handler's response, or undefined if no handler is registered.
80
80
  */
81
- dispatch(sessionId: string, message: unknown): Promise<void>;
81
+ send(sessionId: string, message: unknown): Promise<unknown>;
82
82
  };
83
83
  };
84
84
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithery/sdk",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "SDK to develop with Smithery",
5
5
  "type": "module",
6
6
  "repository": {