@mcp-ts/sdk 1.3.9 → 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.
- package/README.md +0 -1
- package/dist/adapters/langchain-adapter.js.map +1 -1
- package/dist/adapters/langchain-adapter.mjs.map +1 -1
- package/dist/client/index.d.mts +3 -189
- package/dist/client/index.d.ts +3 -189
- package/dist/client/index.js +218 -54
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +215 -55
- package/dist/client/index.mjs.map +1 -1
- package/dist/client/react.d.mts +29 -40
- package/dist/client/react.d.ts +29 -40
- package/dist/client/react.js +492 -147
- package/dist/client/react.js.map +1 -1
- package/dist/client/react.mjs +490 -149
- package/dist/client/react.mjs.map +1 -1
- package/dist/client/vue.d.mts +3 -2
- package/dist/client/vue.d.ts +3 -2
- package/dist/client/vue.js +239 -63
- package/dist/client/vue.js.map +1 -1
- package/dist/client/vue.mjs +236 -64
- package/dist/client/vue.mjs.map +1 -1
- package/dist/index-CQr9q0bF.d.mts +295 -0
- package/dist/index-nE_7Io0I.d.ts +295 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +315 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +303 -65
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.js +93 -10
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +88 -10
- package/dist/server/index.mjs.map +1 -1
- package/package.json +13 -11
- package/src/adapters/langchain-adapter.ts +1 -1
- package/src/client/core/app-host.ts +252 -65
- package/src/client/core/constants.ts +30 -0
- package/src/client/index.ts +6 -1
- package/src/client/react/index.ts +6 -1
- package/src/client/react/use-app-host.ts +13 -19
- package/src/client/react/use-mcp-apps.tsx +297 -125
- package/src/client/react/use-mcp.ts +75 -36
- package/src/client/utils/app-host-utils.ts +62 -0
- package/src/client/vue/use-mcp.ts +23 -12
- package/src/server/mcp/oauth-client.ts +31 -8
- package/src/server/storage/crypto.ts +92 -0
- package/src/server/storage/supabase-backend.ts +7 -6
package/dist/client/react.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { SSEClient, AppHost } from '
|
|
2
|
-
export { SSEClientOptions } from '
|
|
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
|
/**
|
|
@@ -172,23 +173,19 @@ declare function useMcp(options: UseMcpOptions): McpClient$1;
|
|
|
172
173
|
/**
|
|
173
174
|
* Hook to host an MCP App in a React component
|
|
174
175
|
*
|
|
175
|
-
*
|
|
176
|
-
* -
|
|
177
|
-
* -
|
|
178
|
-
* -
|
|
176
|
+
* Initialization is async but optimized for instant availability:
|
|
177
|
+
* - Constructor runs synchronously (sandbox + bridge handler setup)
|
|
178
|
+
* - Host is set in state immediately so launch() can be called right away
|
|
179
|
+
* - start() is a lightweight no-op reserved for future async pre-init work
|
|
180
|
+
* - The real async work (iframe load, bridge connect) happens inside launch()
|
|
179
181
|
*
|
|
180
182
|
* @param client - Connected SSEClient instance
|
|
181
183
|
* @param iframeRef - Reference to the iframe element
|
|
182
184
|
* @param options - Optional configuration
|
|
183
185
|
* @returns Object containing the AppHost instance (or null) and error state
|
|
184
186
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
onMessage?: (params: {
|
|
188
|
-
role: string;
|
|
189
|
-
content: unknown;
|
|
190
|
-
}) => void;
|
|
191
|
-
}): {
|
|
187
|
+
type UseAppHostOptions = AppHostOptions;
|
|
188
|
+
declare function useAppHost(client: AppHostClient | null, iframeRef: React.RefObject<HTMLIFrameElement>, options?: UseAppHostOptions): {
|
|
192
189
|
host: AppHost | null;
|
|
193
190
|
error: Error | null;
|
|
194
191
|
};
|
|
@@ -222,42 +219,34 @@ interface McpAppMetadata {
|
|
|
222
219
|
resourceUri: string;
|
|
223
220
|
sessionId: string;
|
|
224
221
|
}
|
|
225
|
-
|
|
226
|
-
|
|
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
|
+
}
|
|
229
|
+
/** Props for {@link useMcpApps}'s `McpAppRenderer` (client is supplied via the hook). */
|
|
230
|
+
interface McpAppRendererProps extends Pick<UseAppHostOptions, 'sandbox' | 'hostContext' | 'onCallTool' | 'onReadResource' | 'onFallbackRequest' | 'onMessage' | 'onOpenLink' | 'onLoggingMessage' | 'onSizeChanged' | 'onError'> {
|
|
227
231
|
name: string;
|
|
232
|
+
toolResourceUri?: string;
|
|
233
|
+
html?: string;
|
|
228
234
|
input?: Record<string, unknown>;
|
|
229
235
|
result?: unknown;
|
|
230
|
-
status
|
|
231
|
-
|
|
236
|
+
status?: 'executing' | 'inProgress' | 'complete' | 'idle';
|
|
237
|
+
toolInputPartial?: any;
|
|
238
|
+
toolCancelled?: boolean;
|
|
232
239
|
className?: string;
|
|
240
|
+
loader?: React$1.ReactNode;
|
|
233
241
|
}
|
|
234
242
|
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* @param mcpClient - The MCP client from useMcp() or context
|
|
238
|
-
* @returns Object with getAppMetadata function and McpAppRenderer component
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* ```tsx
|
|
242
|
-
* function ToolRenderer(props) {
|
|
243
|
-
* const { getAppMetadata, McpAppRenderer } = useMcpApps(mcpClient);
|
|
244
|
-
* const metadata = getAppMetadata(props.name);
|
|
243
|
+
* Helpers scoped to one `mcpClient`. Pass the client here once; `McpAppRenderer` only needs per-tool props (`name`, `input`, `result`, `status`).
|
|
245
244
|
*
|
|
246
|
-
*
|
|
247
|
-
* return (
|
|
248
|
-
* <McpAppRenderer
|
|
249
|
-
* metadata={metadata}
|
|
250
|
-
* input={props.args}
|
|
251
|
-
* result={props.result}
|
|
252
|
-
* status={props.status}
|
|
253
|
-
* />
|
|
254
|
-
* );
|
|
255
|
-
* }
|
|
256
|
-
* ```
|
|
245
|
+
* @param mcpClient - From `useMcp()` or context (for example `useMcpContext()`).
|
|
257
246
|
*/
|
|
258
247
|
declare function useMcpApps(mcpClient: McpClient | null): {
|
|
259
248
|
getAppMetadata: (toolName: string) => McpAppMetadata | undefined;
|
|
260
|
-
McpAppRenderer: React$1.
|
|
249
|
+
McpAppRenderer: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<McpAppRendererProps & React$1.RefAttributes<McpAppRendererHandle>>>;
|
|
261
250
|
};
|
|
262
251
|
|
|
263
|
-
export { AppHost, 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 };
|
package/dist/client/react.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { SSEClient, AppHost } from '
|
|
2
|
-
export { SSEClientOptions } from '
|
|
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
|
/**
|
|
@@ -172,23 +173,19 @@ declare function useMcp(options: UseMcpOptions): McpClient$1;
|
|
|
172
173
|
/**
|
|
173
174
|
* Hook to host an MCP App in a React component
|
|
174
175
|
*
|
|
175
|
-
*
|
|
176
|
-
* -
|
|
177
|
-
* -
|
|
178
|
-
* -
|
|
176
|
+
* Initialization is async but optimized for instant availability:
|
|
177
|
+
* - Constructor runs synchronously (sandbox + bridge handler setup)
|
|
178
|
+
* - Host is set in state immediately so launch() can be called right away
|
|
179
|
+
* - start() is a lightweight no-op reserved for future async pre-init work
|
|
180
|
+
* - The real async work (iframe load, bridge connect) happens inside launch()
|
|
179
181
|
*
|
|
180
182
|
* @param client - Connected SSEClient instance
|
|
181
183
|
* @param iframeRef - Reference to the iframe element
|
|
182
184
|
* @param options - Optional configuration
|
|
183
185
|
* @returns Object containing the AppHost instance (or null) and error state
|
|
184
186
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
onMessage?: (params: {
|
|
188
|
-
role: string;
|
|
189
|
-
content: unknown;
|
|
190
|
-
}) => void;
|
|
191
|
-
}): {
|
|
187
|
+
type UseAppHostOptions = AppHostOptions;
|
|
188
|
+
declare function useAppHost(client: AppHostClient | null, iframeRef: React.RefObject<HTMLIFrameElement>, options?: UseAppHostOptions): {
|
|
192
189
|
host: AppHost | null;
|
|
193
190
|
error: Error | null;
|
|
194
191
|
};
|
|
@@ -222,42 +219,34 @@ interface McpAppMetadata {
|
|
|
222
219
|
resourceUri: string;
|
|
223
220
|
sessionId: string;
|
|
224
221
|
}
|
|
225
|
-
|
|
226
|
-
|
|
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
|
+
}
|
|
229
|
+
/** Props for {@link useMcpApps}'s `McpAppRenderer` (client is supplied via the hook). */
|
|
230
|
+
interface McpAppRendererProps extends Pick<UseAppHostOptions, 'sandbox' | 'hostContext' | 'onCallTool' | 'onReadResource' | 'onFallbackRequest' | 'onMessage' | 'onOpenLink' | 'onLoggingMessage' | 'onSizeChanged' | 'onError'> {
|
|
227
231
|
name: string;
|
|
232
|
+
toolResourceUri?: string;
|
|
233
|
+
html?: string;
|
|
228
234
|
input?: Record<string, unknown>;
|
|
229
235
|
result?: unknown;
|
|
230
|
-
status
|
|
231
|
-
|
|
236
|
+
status?: 'executing' | 'inProgress' | 'complete' | 'idle';
|
|
237
|
+
toolInputPartial?: any;
|
|
238
|
+
toolCancelled?: boolean;
|
|
232
239
|
className?: string;
|
|
240
|
+
loader?: React$1.ReactNode;
|
|
233
241
|
}
|
|
234
242
|
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* @param mcpClient - The MCP client from useMcp() or context
|
|
238
|
-
* @returns Object with getAppMetadata function and McpAppRenderer component
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* ```tsx
|
|
242
|
-
* function ToolRenderer(props) {
|
|
243
|
-
* const { getAppMetadata, McpAppRenderer } = useMcpApps(mcpClient);
|
|
244
|
-
* const metadata = getAppMetadata(props.name);
|
|
243
|
+
* Helpers scoped to one `mcpClient`. Pass the client here once; `McpAppRenderer` only needs per-tool props (`name`, `input`, `result`, `status`).
|
|
245
244
|
*
|
|
246
|
-
*
|
|
247
|
-
* return (
|
|
248
|
-
* <McpAppRenderer
|
|
249
|
-
* metadata={metadata}
|
|
250
|
-
* input={props.args}
|
|
251
|
-
* result={props.result}
|
|
252
|
-
* status={props.status}
|
|
253
|
-
* />
|
|
254
|
-
* );
|
|
255
|
-
* }
|
|
256
|
-
* ```
|
|
245
|
+
* @param mcpClient - From `useMcp()` or context (for example `useMcpContext()`).
|
|
257
246
|
*/
|
|
258
247
|
declare function useMcpApps(mcpClient: McpClient | null): {
|
|
259
248
|
getAppMetadata: (toolName: string) => McpAppMetadata | undefined;
|
|
260
|
-
McpAppRenderer: React$1.
|
|
249
|
+
McpAppRenderer: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<McpAppRendererProps & React$1.RefAttributes<McpAppRendererHandle>>>;
|
|
261
250
|
};
|
|
262
251
|
|
|
263
|
-
export { AppHost, 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 };
|