@mcp-ts/sdk 1.3.10 → 1.4.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.
Files changed (44) hide show
  1. package/dist/adapters/langchain-adapter.js.map +1 -1
  2. package/dist/adapters/langchain-adapter.mjs.map +1 -1
  3. package/dist/client/index.d.mts +3 -189
  4. package/dist/client/index.d.ts +3 -189
  5. package/dist/client/index.js +218 -54
  6. package/dist/client/index.js.map +1 -1
  7. package/dist/client/index.mjs +215 -55
  8. package/dist/client/index.mjs.map +1 -1
  9. package/dist/client/react.d.mts +21 -14
  10. package/dist/client/react.d.ts +21 -14
  11. package/dist/client/react.js +402 -83
  12. package/dist/client/react.js.map +1 -1
  13. package/dist/client/react.mjs +400 -85
  14. package/dist/client/react.mjs.map +1 -1
  15. package/dist/client/vue.d.mts +3 -2
  16. package/dist/client/vue.d.ts +3 -2
  17. package/dist/client/vue.js +239 -63
  18. package/dist/client/vue.js.map +1 -1
  19. package/dist/client/vue.mjs +236 -64
  20. package/dist/client/vue.mjs.map +1 -1
  21. package/dist/index-CQr9q0bF.d.mts +295 -0
  22. package/dist/index-nE_7Io0I.d.ts +295 -0
  23. package/dist/index.d.mts +2 -1
  24. package/dist/index.d.ts +2 -1
  25. package/dist/index.js +237 -58
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +230 -59
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/server/index.js +15 -4
  30. package/dist/server/index.js.map +1 -1
  31. package/dist/server/index.mjs +15 -4
  32. package/dist/server/index.mjs.map +1 -1
  33. package/package.json +13 -11
  34. package/src/adapters/langchain-adapter.ts +1 -1
  35. package/src/client/core/app-host.ts +252 -65
  36. package/src/client/core/constants.ts +30 -0
  37. package/src/client/index.ts +6 -1
  38. package/src/client/react/index.ts +1 -0
  39. package/src/client/react/use-app-host.ts +8 -15
  40. package/src/client/react/use-mcp-apps.tsx +221 -26
  41. package/src/client/react/use-mcp.ts +23 -12
  42. package/src/client/utils/app-host-utils.ts +62 -0
  43. package/src/client/vue/use-mcp.ts +23 -12
  44. package/src/server/mcp/oauth-client.ts +31 -8
@@ -1,10 +1,11 @@
1
- import { SSEClient, AppHost } from './index.mjs';
2
- export { SSEClientOptions } from './index.mjs';
1
+ import { c as SSEClient, e as AppHostOptions, f as AppHostClient, a as AppHost } from '../index-CQr9q0bF.mjs';
2
+ export { A as APP_HOST_DEFAULTS, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, d as SSEClientOptions } from '../index-CQr9q0bF.mjs';
3
3
  import { c as McpConnectionState, M as McpConnectionEvent } from '../events-CK3N--3g.mjs';
4
4
  export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, d as McpObservabilityEvent } from '../events-CK3N--3g.mjs';
5
5
  import { T as ToolInfo, k as FinishAuthResult, n as ListToolsRpcResult, L as ListPromptsResult, l as ListResourcesResult } from '../types-CW6lghof.mjs';
6
6
  export { p as McpRpcRequest, q as McpRpcResponse } from '../types-CW6lghof.mjs';
7
7
  import React$1 from 'react';
8
+ import '@modelcontextprotocol/ext-apps/app-bridge';
8
9
  import '@modelcontextprotocol/sdk/types.js';
9
10
 
10
11
  /**
@@ -183,13 +184,8 @@ declare function useMcp(options: UseMcpOptions): McpClient$1;
183
184
  * @param options - Optional configuration
184
185
  * @returns Object containing the AppHost instance (or null) and error state
185
186
  */
186
- declare function useAppHost(client: SSEClient, iframeRef: React.RefObject<HTMLIFrameElement>, options?: {
187
- /** Callback when the App sends a message (e.g. to chat) */
188
- onMessage?: (params: {
189
- role: string;
190
- content: unknown;
191
- }) => void;
192
- }): {
187
+ type UseAppHostOptions = AppHostOptions;
188
+ declare function useAppHost(client: AppHostClient | null, iframeRef: React.RefObject<HTMLIFrameElement>, options?: UseAppHostOptions): {
193
189
  host: AppHost | null;
194
190
  error: Error | null;
195
191
  };
@@ -223,14 +219,25 @@ interface McpAppMetadata {
223
219
  resourceUri: string;
224
220
  sessionId: string;
225
221
  }
222
+ /**
223
+ * Imperative handle for {@link useMcpApps}'s `McpAppRenderer` (via `ref`),
224
+ * aligned with `@mcp-ui/client`'s `AppRendererHandle.teardownResource`.
225
+ */
226
+ interface McpAppRendererHandle {
227
+ teardownResource: (params?: Record<string, unknown>) => void;
228
+ }
226
229
  /** Props for {@link useMcpApps}'s `McpAppRenderer` (client is supplied via the hook). */
227
- interface McpAppRendererProps {
230
+ interface McpAppRendererProps extends Pick<UseAppHostOptions, 'sandbox' | 'hostContext' | 'onCallTool' | 'onReadResource' | 'onFallbackRequest' | 'onMessage' | 'onOpenLink' | 'onLoggingMessage' | 'onSizeChanged' | 'onError'> {
228
231
  name: string;
232
+ toolResourceUri?: string;
233
+ html?: string;
229
234
  input?: Record<string, unknown>;
230
235
  result?: unknown;
231
- status: 'executing' | 'inProgress' | 'complete' | 'idle';
232
- /** Custom CSS class for the container */
236
+ status?: 'executing' | 'inProgress' | 'complete' | 'idle';
237
+ toolInputPartial?: any;
238
+ toolCancelled?: boolean;
233
239
  className?: string;
240
+ loader?: React$1.ReactNode;
234
241
  }
235
242
  /**
236
243
  * Helpers scoped to one `mcpClient`. Pass the client here once; `McpAppRenderer` only needs per-tool props (`name`, `input`, `result`, `status`).
@@ -239,7 +246,7 @@ interface McpAppRendererProps {
239
246
  */
240
247
  declare function useMcpApps(mcpClient: McpClient | null): {
241
248
  getAppMetadata: (toolName: string) => McpAppMetadata | undefined;
242
- McpAppRenderer: React$1.NamedExoticComponent<McpAppRendererProps>;
249
+ McpAppRenderer: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<McpAppRendererProps & React$1.RefAttributes<McpAppRendererHandle>>>;
243
250
  };
244
251
 
245
- export { AppHost, type McpAppMetadata, type McpAppRendererProps, type McpClient$1 as McpClient, type McpConnection, McpConnectionEvent, McpConnectionState, SSEClient, ToolInfo, type UseMcpOptions, useAppHost, useMcp, useMcpApps };
252
+ export { AppHost, type McpAppMetadata, type McpAppRendererHandle, type McpAppRendererProps, type McpClient$1 as McpClient, type McpConnection, McpConnectionEvent, McpConnectionState, SSEClient, ToolInfo, type UseMcpOptions, useAppHost, useMcp, useMcpApps };
@@ -1,10 +1,11 @@
1
- import { SSEClient, AppHost } from './index.js';
2
- export { SSEClientOptions } from './index.js';
1
+ import { c as SSEClient, e as AppHostOptions, f as AppHostClient, a as AppHost } from '../index-nE_7Io0I.js';
2
+ export { A as APP_HOST_DEFAULTS, D as DEFAULT_MCP_APP_CSP, S as SANDBOX_PROXY_READY_METHOD, b as SANDBOX_RESOURCE_READY_METHOD, d as SSEClientOptions } from '../index-nE_7Io0I.js';
3
3
  import { c as McpConnectionState, M as McpConnectionEvent } from '../events-CK3N--3g.js';
4
4
  export { D as Disposable, a as DisposableStore, E as Emitter, b as Event, d as McpObservabilityEvent } from '../events-CK3N--3g.js';
5
5
  import { T as ToolInfo, k as FinishAuthResult, n as ListToolsRpcResult, L as ListPromptsResult, l as ListResourcesResult } from '../types-CW6lghof.js';
6
6
  export { p as McpRpcRequest, q as McpRpcResponse } from '../types-CW6lghof.js';
7
7
  import React$1 from 'react';
8
+ import '@modelcontextprotocol/ext-apps/app-bridge';
8
9
  import '@modelcontextprotocol/sdk/types.js';
9
10
 
10
11
  /**
@@ -183,13 +184,8 @@ declare function useMcp(options: UseMcpOptions): McpClient$1;
183
184
  * @param options - Optional configuration
184
185
  * @returns Object containing the AppHost instance (or null) and error state
185
186
  */
186
- declare function useAppHost(client: SSEClient, iframeRef: React.RefObject<HTMLIFrameElement>, options?: {
187
- /** Callback when the App sends a message (e.g. to chat) */
188
- onMessage?: (params: {
189
- role: string;
190
- content: unknown;
191
- }) => void;
192
- }): {
187
+ type UseAppHostOptions = AppHostOptions;
188
+ declare function useAppHost(client: AppHostClient | null, iframeRef: React.RefObject<HTMLIFrameElement>, options?: UseAppHostOptions): {
193
189
  host: AppHost | null;
194
190
  error: Error | null;
195
191
  };
@@ -223,14 +219,25 @@ interface McpAppMetadata {
223
219
  resourceUri: string;
224
220
  sessionId: string;
225
221
  }
222
+ /**
223
+ * Imperative handle for {@link useMcpApps}'s `McpAppRenderer` (via `ref`),
224
+ * aligned with `@mcp-ui/client`'s `AppRendererHandle.teardownResource`.
225
+ */
226
+ interface McpAppRendererHandle {
227
+ teardownResource: (params?: Record<string, unknown>) => void;
228
+ }
226
229
  /** Props for {@link useMcpApps}'s `McpAppRenderer` (client is supplied via the hook). */
227
- interface McpAppRendererProps {
230
+ interface McpAppRendererProps extends Pick<UseAppHostOptions, 'sandbox' | 'hostContext' | 'onCallTool' | 'onReadResource' | 'onFallbackRequest' | 'onMessage' | 'onOpenLink' | 'onLoggingMessage' | 'onSizeChanged' | 'onError'> {
228
231
  name: string;
232
+ toolResourceUri?: string;
233
+ html?: string;
229
234
  input?: Record<string, unknown>;
230
235
  result?: unknown;
231
- status: 'executing' | 'inProgress' | 'complete' | 'idle';
232
- /** Custom CSS class for the container */
236
+ status?: 'executing' | 'inProgress' | 'complete' | 'idle';
237
+ toolInputPartial?: any;
238
+ toolCancelled?: boolean;
233
239
  className?: string;
240
+ loader?: React$1.ReactNode;
234
241
  }
235
242
  /**
236
243
  * Helpers scoped to one `mcpClient`. Pass the client here once; `McpAppRenderer` only needs per-tool props (`name`, `input`, `result`, `status`).
@@ -239,7 +246,7 @@ interface McpAppRendererProps {
239
246
  */
240
247
  declare function useMcpApps(mcpClient: McpClient | null): {
241
248
  getAppMetadata: (toolName: string) => McpAppMetadata | undefined;
242
- McpAppRenderer: React$1.NamedExoticComponent<McpAppRendererProps>;
249
+ McpAppRenderer: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<McpAppRendererProps & React$1.RefAttributes<McpAppRendererHandle>>>;
243
250
  };
244
251
 
245
- export { AppHost, type McpAppMetadata, type McpAppRendererProps, type McpClient$1 as McpClient, type McpConnection, McpConnectionEvent, McpConnectionState, SSEClient, ToolInfo, type UseMcpOptions, useAppHost, useMcp, useMcpApps };
252
+ export { AppHost, type McpAppMetadata, type McpAppRendererHandle, type McpAppRendererProps, type McpClient$1 as McpClient, type McpConnection, McpConnectionEvent, McpConnectionState, SSEClient, ToolInfo, type UseMcpOptions, useAppHost, useMcp, useMcpApps };