mcp-use 1.0.3 → 1.0.5
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 +98 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/src/server/adapters/mcp-ui-adapter.d.ts +66 -0
- package/dist/src/server/adapters/mcp-ui-adapter.d.ts.map +1 -0
- package/dist/src/server/index.cjs +292 -14
- package/dist/src/server/index.d.ts +4 -2
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +286 -13
- package/dist/src/server/mcp-server.d.ts +91 -2
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/server/types/common.d.ts +27 -0
- package/dist/src/server/types/common.d.ts.map +1 -0
- package/dist/src/server/types/index.d.ts +8 -0
- package/dist/src/server/types/index.d.ts.map +1 -0
- package/dist/src/server/types/prompt.d.ts +14 -0
- package/dist/src/server/types/prompt.d.ts.map +1 -0
- package/dist/src/server/types/resource.d.ts +155 -0
- package/dist/src/server/types/resource.d.ts.map +1 -0
- package/dist/src/server/types/tool.d.ts +14 -0
- package/dist/src/server/types/tool.d.ts.map +1 -0
- package/dist/src/server/types.d.ts +3 -76
- package/dist/src/server/types.d.ts.map +1 -1
- package/dist/tests/helpers/widget-generators.d.ts +24 -0
- package/dist/tests/helpers/widget-generators.d.ts.map +1 -0
- package/dist/tests/mcp-ui-adapter.test.d.ts +8 -0
- package/dist/tests/mcp-ui-adapter.test.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../../src/server/types/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAGtD,MAAM,MAAM,iBAAiB,GA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CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB;IACnE,IAAI,EAAE,WAAW,CAAA;IACjB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAA;IACd,qDAAqD;IACrD,SAAS,CAAC,EAAE,kBAAkB,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,qBAAqB,GACrB,iBAAiB,GACjB,mBAAmB,CAAA;AAEvB,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvB,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAClB,CAAA;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACzB"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
2
|
+
import type { InputDefinition } from './common.js';
|
3
|
+
export type ToolHandler = (params: Record<string, any>) => Promise<CallToolResult>;
|
4
|
+
export interface ToolDefinition {
|
5
|
+
/** Unique identifier for the tool */
|
6
|
+
name: string;
|
7
|
+
/** Description of what the tool does */
|
8
|
+
description?: string;
|
9
|
+
/** Input parameter definitions */
|
10
|
+
inputs?: InputDefinition[];
|
11
|
+
/** Async function that executes the tool */
|
12
|
+
fn: ToolHandler;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=tool.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../src/server/types/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;AAElF,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kCAAkC;IAClC,MAAM,CAAC,EAAE,eAAe,EAAE,CAAA;IAC1B,4CAA4C;IAC5C,EAAE,EAAE,WAAW,CAAA;CAChB"}
|
@@ -1,79 +1,6 @@
|
|
1
|
-
import type { CallToolResult, GetPromptResult, ReadResourceResult } from '@modelcontextprotocol/sdk/types.js';
|
2
|
-
export interface ServerConfig {
|
3
|
-
name: string;
|
4
|
-
version: string;
|
5
|
-
description?: string;
|
6
|
-
}
|
7
|
-
export interface InputDefinition {
|
8
|
-
name: string;
|
9
|
-
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
10
|
-
description?: string;
|
11
|
-
required?: boolean;
|
12
|
-
default?: any;
|
13
|
-
}
|
14
1
|
/**
|
15
|
-
*
|
2
|
+
* Legacy types export file - maintained for backward compatibility
|
3
|
+
* New code should import from './types/index.js' instead
|
16
4
|
*/
|
17
|
-
export
|
18
|
-
/** Intended audience(s) for this resource */
|
19
|
-
audience?: ('user' | 'assistant')[];
|
20
|
-
/** Priority from 0.0 (least important) to 1.0 (most important) */
|
21
|
-
priority?: number;
|
22
|
-
/** ISO 8601 formatted timestamp of last modification */
|
23
|
-
lastModified?: string;
|
24
|
-
}
|
25
|
-
/**
|
26
|
-
* Configuration for a resource template
|
27
|
-
*/
|
28
|
-
export interface ResourceTemplateConfig {
|
29
|
-
/** URI template with {param} placeholders (e.g., "user://{userId}/profile") */
|
30
|
-
uriTemplate: string;
|
31
|
-
/** Name of the resource */
|
32
|
-
name?: string;
|
33
|
-
/** MIME type of the resource content */
|
34
|
-
mimeType?: string;
|
35
|
-
/** Description of the resource */
|
36
|
-
description?: string;
|
37
|
-
}
|
38
|
-
export interface ResourceTemplateDefinition {
|
39
|
-
name: string;
|
40
|
-
resourceTemplate: ResourceTemplateConfig;
|
41
|
-
title?: string;
|
42
|
-
description?: string;
|
43
|
-
annotations?: ResourceAnnotations;
|
44
|
-
fn: ResourceTemplateHandler;
|
45
|
-
}
|
46
|
-
export interface ResourceDefinition {
|
47
|
-
/** Unique identifier for the resource */
|
48
|
-
name: string;
|
49
|
-
/** URI pattern for accessing the resource (e.g., 'config://app-settings') */
|
50
|
-
uri: string;
|
51
|
-
/** Resource metadata including MIME type and description */
|
52
|
-
/** Optional title for the resource */
|
53
|
-
title?: string;
|
54
|
-
/** Optional description of the resource */
|
55
|
-
description?: string;
|
56
|
-
/** MIME type of the resource content (required) */
|
57
|
-
mimeType: string;
|
58
|
-
/** Optional annotations for the resource */
|
59
|
-
annotations?: ResourceAnnotations;
|
60
|
-
/** Async function that returns the resource content */
|
61
|
-
fn: ResourceHandler;
|
62
|
-
}
|
63
|
-
export interface ToolDefinition {
|
64
|
-
name: string;
|
65
|
-
description?: string;
|
66
|
-
inputs?: InputDefinition[];
|
67
|
-
fn: ToolHandler;
|
68
|
-
}
|
69
|
-
export interface PromptDefinition {
|
70
|
-
name: string;
|
71
|
-
description?: string;
|
72
|
-
args?: InputDefinition[];
|
73
|
-
fn: PromptHandler;
|
74
|
-
}
|
75
|
-
export type ResourceHandler = () => Promise<ReadResourceResult>;
|
76
|
-
export type ResourceTemplateHandler = (uri: URL, params: Record<string, any>) => Promise<ReadResourceResult>;
|
77
|
-
export type ToolHandler = (params: Record<string, any>) => Promise<CallToolResult>;
|
78
|
-
export type PromptHandler = (params: Record<string, any>) => Promise<GetPromptResult>;
|
5
|
+
export * from './types/index.js';
|
79
6
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/server/types.ts"],"names":[],"mappings":"AAAA
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/server/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,kBAAkB,CAAA"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* Test Helper Utilities for Widget Generation
|
3
|
+
*
|
4
|
+
* These functions generate HTML and JavaScript content for testing purposes.
|
5
|
+
* They are not part of the core UIResource creation flow.
|
6
|
+
*/
|
7
|
+
import type { UIResourceDefinition } from 'mcp-use/server';
|
8
|
+
/**
|
9
|
+
* Generate HTML content for a widget (utility function for tests)
|
10
|
+
*
|
11
|
+
* @param definition - Base UI resource definition
|
12
|
+
* @param props - Widget properties to inject
|
13
|
+
* @returns Generated HTML string
|
14
|
+
*/
|
15
|
+
export declare function generateWidgetHtml(definition: Pick<UIResourceDefinition, 'name' | 'title' | 'description' | 'size'>, props?: Record<string, any>): string;
|
16
|
+
/**
|
17
|
+
* Generate a Remote DOM script for a widget (utility function for tests)
|
18
|
+
*
|
19
|
+
* @param definition - Base UI resource definition
|
20
|
+
* @param props - Widget properties to inject
|
21
|
+
* @returns Generated JavaScript string
|
22
|
+
*/
|
23
|
+
export declare function generateRemoteDomScript(definition: Pick<UIResourceDefinition, 'name' | 'title' | 'description'>, props?: Record<string, any>): string;
|
24
|
+
//# sourceMappingURL=widget-generators.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"widget-generators.d.ts","sourceRoot":"","sources":["../../../tests/helpers/widget-generators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAE1D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,EACjF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,MAAM,CA+DR;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,CAAC,EACxE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,MAAM,CAyCR"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mcp-ui-adapter.test.d.ts","sourceRoot":"","sources":["../../tests/mcp-ui-adapter.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|