mcp-use 1.11.0-canary.15 → 1.11.0-canary.17
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/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-HUOCLQT4.js → chunk-744QI6FX.js} +1 -1
- package/dist/{chunk-NEIO2CWV.js → chunk-ETMSIR6K.js} +4 -2
- package/dist/{chunk-XTPTD37Z.js → chunk-HNNUDW4Q.js} +8 -3
- package/dist/{chunk-HWBQAAP5.js → chunk-JQMHLTXF.js} +1 -1
- package/dist/{chunk-COZWUWRK.js → chunk-LQJZY6OD.js} +2 -2
- package/dist/{chunk-C5MVPCV2.js → chunk-NTB5TTZW.js} +10 -4
- package/dist/{chunk-4A6AEYDD.js → chunk-QEEFUZ22.js} +10 -1
- package/dist/{chunk-HK4BXTYV.js → chunk-XZM65NMN.js} +1 -1
- package/dist/index.cjs +26 -4
- package/dist/index.js +7 -7
- package/dist/src/agents/index.cjs +12 -1
- package/dist/src/agents/index.js +5 -5
- package/dist/src/browser.cjs +20 -3
- package/dist/src/browser.js +5 -5
- package/dist/src/client/browser.d.ts.map +1 -1
- package/dist/src/client.cjs +12 -1
- package/dist/src/client.js +3 -3
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/connectors/http.d.ts +2 -0
- package/dist/src/connectors/http.d.ts.map +1 -1
- package/dist/src/react/index.cjs +24 -4
- package/dist/src/react/index.js +4 -4
- package/dist/src/react/useMcp.d.ts.map +1 -1
- package/dist/src/server/index.cjs +85 -72
- package/dist/src/server/index.js +89 -76
- package/dist/src/server/types/widget.d.ts +4 -4
- package/dist/src/server/types/widget.d.ts.map +1 -1
- package/dist/src/server/widgets/mount-widgets-dev.d.ts.map +1 -1
- package/dist/src/server/widgets/ui-resource-registration.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/{tool-execution-helpers-UZAPEVA6.js → tool-execution-helpers-F56E75XW.js} +2 -2
- package/package.json +3 -3
package/dist/src/react/index.js
CHANGED
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
useWidgetProps,
|
|
10
10
|
useWidgetState,
|
|
11
11
|
useWidgetTheme
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-HNNUDW4Q.js";
|
|
13
|
+
import "../../chunk-NTB5TTZW.js";
|
|
14
|
+
import "../../chunk-QEEFUZ22.js";
|
|
15
15
|
import {
|
|
16
16
|
Tel,
|
|
17
17
|
Telemetry,
|
|
18
18
|
setTelemetrySource
|
|
19
|
-
} from "../../chunk-
|
|
19
|
+
} from "../../chunk-JQMHLTXF.js";
|
|
20
20
|
import "../../chunk-FRUZDWXH.js";
|
|
21
21
|
import {
|
|
22
22
|
onMcpAuthorization
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMcp.d.ts","sourceRoot":"","sources":["../../../src/react/useMcp.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"useMcp.d.ts","sourceRoot":"","sources":["../../../src/react/useMcp.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CAqwC3D"}
|
|
@@ -761,7 +761,7 @@ var VERSION;
|
|
|
761
761
|
var init_version = __esm({
|
|
762
762
|
"src/version.ts"() {
|
|
763
763
|
"use strict";
|
|
764
|
-
VERSION = "1.11.0-canary.
|
|
764
|
+
VERSION = "1.11.0-canary.17";
|
|
765
765
|
__name(getPackageVersion, "getPackageVersion");
|
|
766
766
|
}
|
|
767
767
|
});
|
|
@@ -2221,7 +2221,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2221
2221
|
// src/server/mcp-server.ts
|
|
2222
2222
|
var import_mcp2 = require("@mcp-use/modelcontextprotocol-sdk/server/mcp.js");
|
|
2223
2223
|
var import_types2 = require("@mcp-use/modelcontextprotocol-sdk/types.js");
|
|
2224
|
-
var
|
|
2224
|
+
var import_zod3 = require("zod");
|
|
2225
2225
|
init_telemetry2();
|
|
2226
2226
|
init_version();
|
|
2227
2227
|
|
|
@@ -3187,7 +3187,7 @@ function processWidgetHtml(html2, widgetName, baseUrl) {
|
|
|
3187
3187
|
}
|
|
3188
3188
|
__name(processWidgetHtml, "processWidgetHtml");
|
|
3189
3189
|
function createWidgetRegistration(widgetName, metadata, html2, serverConfig, isDev = false) {
|
|
3190
|
-
const props = metadata.
|
|
3190
|
+
const props = metadata.inputs || metadata.props || metadata.schema || {};
|
|
3191
3191
|
const description = metadata.description || `Widget: ${widgetName}`;
|
|
3192
3192
|
const title = metadata.title || widgetName;
|
|
3193
3193
|
const exposeAsTool = metadata.exposeAsTool !== void 0 ? metadata.exposeAsTool : true;
|
|
@@ -3705,12 +3705,17 @@ export default PostHog;
|
|
|
3705
3705
|
const mod = await viteServer.ssrLoadModule(widget2.entry);
|
|
3706
3706
|
if (mod.widgetMetadata) {
|
|
3707
3707
|
metadata = mod.widgetMetadata;
|
|
3708
|
-
|
|
3708
|
+
const schemaField = metadata.inputs || metadata.props;
|
|
3709
|
+
if (schemaField) {
|
|
3709
3710
|
try {
|
|
3710
|
-
|
|
3711
|
+
const extractedShape = schemaField.shape || schemaField;
|
|
3712
|
+
metadata.inputs = extractedShape;
|
|
3713
|
+
if (!metadata.inputs && metadata.props) {
|
|
3714
|
+
metadata.inputs = metadata.props;
|
|
3715
|
+
}
|
|
3711
3716
|
} catch (error2) {
|
|
3712
3717
|
console.warn(
|
|
3713
|
-
`[WIDGET] Failed to extract
|
|
3718
|
+
`[WIDGET] Failed to extract schema for ${widget2.name}:`,
|
|
3714
3719
|
error2
|
|
3715
3720
|
);
|
|
3716
3721
|
}
|
|
@@ -3900,6 +3905,7 @@ function setupWidgetRoutes(app, serverConfig) {
|
|
|
3900
3905
|
__name(setupWidgetRoutes, "setupWidgetRoutes");
|
|
3901
3906
|
|
|
3902
3907
|
// src/server/widgets/ui-resource-registration.ts
|
|
3908
|
+
var import_zod = __toESM(require("zod"), 1);
|
|
3903
3909
|
function uiResourceRegistration(server, definition) {
|
|
3904
3910
|
const displayName = definition.title || definition.name;
|
|
3905
3911
|
if (definition.type === "appsSdk" && definition._meta) {
|
|
@@ -4005,69 +4011,76 @@ function uiResourceRegistration(server, definition) {
|
|
|
4005
4011
|
}
|
|
4006
4012
|
}
|
|
4007
4013
|
}
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4014
|
+
const widgetMetadata2 = definition._meta?.["mcp-use/widget"];
|
|
4015
|
+
const propsOrSchema = definition.props || widgetMetadata2?.props || widgetMetadata2?.inputs || widgetMetadata2?.schema;
|
|
4016
|
+
const isZodSchema = propsOrSchema && typeof propsOrSchema === "object" && propsOrSchema instanceof import_zod.default.ZodObject;
|
|
4017
|
+
const toolDefinition = {
|
|
4018
|
+
name: definition.name,
|
|
4019
|
+
title: definition.title,
|
|
4020
|
+
description: definition.description,
|
|
4021
|
+
annotations: definition.toolAnnotations,
|
|
4022
|
+
_meta: Object.keys(toolMetadata).length > 0 ? toolMetadata : void 0
|
|
4023
|
+
};
|
|
4024
|
+
if (isZodSchema) {
|
|
4025
|
+
toolDefinition.schema = propsOrSchema;
|
|
4026
|
+
} else if (propsOrSchema) {
|
|
4027
|
+
toolDefinition.inputs = convertPropsToInputs(
|
|
4028
|
+
propsOrSchema
|
|
4029
|
+
);
|
|
4030
|
+
}
|
|
4031
|
+
server.tool(toolDefinition, async (params) => {
|
|
4032
|
+
const uiResource = await createWidgetUIResource(
|
|
4033
|
+
definition,
|
|
4034
|
+
params,
|
|
4035
|
+
serverConfig
|
|
4036
|
+
);
|
|
4037
|
+
if (definition.type === "appsSdk") {
|
|
4038
|
+
const randomId = Math.random().toString(36).substring(2, 15);
|
|
4039
|
+
const uniqueUri = generateWidgetUri(
|
|
4040
|
+
definition.name,
|
|
4041
|
+
server.buildId,
|
|
4042
|
+
".html",
|
|
4043
|
+
randomId
|
|
4022
4044
|
);
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
} else {
|
|
4041
|
-
toolOutputResult = {
|
|
4042
|
-
content: [
|
|
4043
|
-
{
|
|
4044
|
-
type: "text",
|
|
4045
|
-
text: `Displaying ${displayName}`
|
|
4046
|
-
}
|
|
4047
|
-
]
|
|
4048
|
-
};
|
|
4049
|
-
}
|
|
4050
|
-
const content = toolOutputResult.content || [
|
|
4051
|
-
{ type: "text", text: `Displaying ${displayName}` }
|
|
4052
|
-
];
|
|
4053
|
-
return {
|
|
4054
|
-
_meta: uniqueToolMetadata,
|
|
4055
|
-
content,
|
|
4056
|
-
structuredContent: toolOutputResult.structuredContent
|
|
4045
|
+
const uniqueToolMetadata = {
|
|
4046
|
+
...toolMetadata,
|
|
4047
|
+
"openai/outputTemplate": uniqueUri,
|
|
4048
|
+
"mcp-use/props": params
|
|
4049
|
+
// Pass params as widget props
|
|
4050
|
+
};
|
|
4051
|
+
let toolOutputResult;
|
|
4052
|
+
if (definition.toolOutput) {
|
|
4053
|
+
toolOutputResult = typeof definition.toolOutput === "function" ? definition.toolOutput(params) : definition.toolOutput;
|
|
4054
|
+
} else {
|
|
4055
|
+
toolOutputResult = {
|
|
4056
|
+
content: [
|
|
4057
|
+
{
|
|
4058
|
+
type: "text",
|
|
4059
|
+
text: `Displaying ${displayName}`
|
|
4060
|
+
}
|
|
4061
|
+
]
|
|
4057
4062
|
};
|
|
4058
4063
|
}
|
|
4064
|
+
const content = toolOutputResult.content || [
|
|
4065
|
+
{ type: "text", text: `Displaying ${displayName}` }
|
|
4066
|
+
];
|
|
4059
4067
|
return {
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
text: `Displaying ${displayName}`,
|
|
4064
|
-
description: `Show MCP-UI widget for ${displayName}`
|
|
4065
|
-
},
|
|
4066
|
-
uiResource
|
|
4067
|
-
]
|
|
4068
|
+
_meta: uniqueToolMetadata,
|
|
4069
|
+
content,
|
|
4070
|
+
structuredContent: toolOutputResult.structuredContent
|
|
4068
4071
|
};
|
|
4069
4072
|
}
|
|
4070
|
-
|
|
4073
|
+
return {
|
|
4074
|
+
content: [
|
|
4075
|
+
{
|
|
4076
|
+
type: "text",
|
|
4077
|
+
text: `Displaying ${displayName}`,
|
|
4078
|
+
description: `Show MCP-UI widget for ${displayName}`
|
|
4079
|
+
},
|
|
4080
|
+
uiResource
|
|
4081
|
+
]
|
|
4082
|
+
};
|
|
4083
|
+
});
|
|
4071
4084
|
}
|
|
4072
4085
|
return server;
|
|
4073
4086
|
}
|
|
@@ -4129,9 +4142,9 @@ async function mountInspectorUI(app, serverHost, serverPort, isProduction) {
|
|
|
4129
4142
|
__name(mountInspectorUI, "mountInspectorUI");
|
|
4130
4143
|
|
|
4131
4144
|
// src/server/tools/schema-helpers.ts
|
|
4132
|
-
var
|
|
4145
|
+
var import_zod2 = require("zod");
|
|
4133
4146
|
function convertZodSchemaToParams(zodSchema) {
|
|
4134
|
-
if (!(zodSchema instanceof
|
|
4147
|
+
if (!(zodSchema instanceof import_zod2.z.ZodObject)) {
|
|
4135
4148
|
throw new Error("schema must be a Zod object schema (z.object({...}))");
|
|
4136
4149
|
}
|
|
4137
4150
|
const shape = zodSchema.shape;
|
|
@@ -4148,22 +4161,22 @@ function createParamsSchema(inputs) {
|
|
|
4148
4161
|
let zodType;
|
|
4149
4162
|
switch (input.type) {
|
|
4150
4163
|
case "string":
|
|
4151
|
-
zodType =
|
|
4164
|
+
zodType = import_zod2.z.string();
|
|
4152
4165
|
break;
|
|
4153
4166
|
case "number":
|
|
4154
|
-
zodType =
|
|
4167
|
+
zodType = import_zod2.z.number();
|
|
4155
4168
|
break;
|
|
4156
4169
|
case "boolean":
|
|
4157
|
-
zodType =
|
|
4170
|
+
zodType = import_zod2.z.boolean();
|
|
4158
4171
|
break;
|
|
4159
4172
|
case "object":
|
|
4160
|
-
zodType =
|
|
4173
|
+
zodType = import_zod2.z.object({});
|
|
4161
4174
|
break;
|
|
4162
4175
|
case "array":
|
|
4163
|
-
zodType =
|
|
4176
|
+
zodType = import_zod2.z.array(import_zod2.z.any());
|
|
4164
4177
|
break;
|
|
4165
4178
|
default:
|
|
4166
|
-
zodType =
|
|
4179
|
+
zodType = import_zod2.z.any();
|
|
4167
4180
|
}
|
|
4168
4181
|
if (input.description) {
|
|
4169
4182
|
zodType = zodType.describe(input.description);
|
|
@@ -6663,7 +6676,7 @@ var MCPServerClass = class {
|
|
|
6663
6676
|
);
|
|
6664
6677
|
}
|
|
6665
6678
|
newServer.server.setRequestHandler(
|
|
6666
|
-
|
|
6679
|
+
import_zod3.z.object({ method: import_zod3.z.literal("logging/setLevel") }).passthrough(),
|
|
6667
6680
|
(async (request, extra) => {
|
|
6668
6681
|
const level = request.params?.level;
|
|
6669
6682
|
if (!level) {
|
package/dist/src/server/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createEnhancedContext,
|
|
8
8
|
findSessionContext,
|
|
9
9
|
isValidLogLevel
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-744QI6FX.js";
|
|
11
11
|
import {
|
|
12
12
|
convertToolResultToResourceResult
|
|
13
13
|
} from "../../chunk-362PI25Z.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
getPackageVersion,
|
|
31
31
|
isDeno,
|
|
32
32
|
pathHelpers
|
|
33
|
-
} from "../../chunk-
|
|
33
|
+
} from "../../chunk-JQMHLTXF.js";
|
|
34
34
|
import "../../chunk-FRUZDWXH.js";
|
|
35
35
|
import {
|
|
36
36
|
__name
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
McpError,
|
|
46
46
|
ErrorCode
|
|
47
47
|
} from "@mcp-use/modelcontextprotocol-sdk/types.js";
|
|
48
|
-
import { z as
|
|
48
|
+
import { z as z3 } from "zod";
|
|
49
49
|
|
|
50
50
|
// src/server/utils/response-helpers.ts
|
|
51
51
|
function text(content) {
|
|
@@ -996,7 +996,7 @@ function processWidgetHtml(html2, widgetName, baseUrl) {
|
|
|
996
996
|
}
|
|
997
997
|
__name(processWidgetHtml, "processWidgetHtml");
|
|
998
998
|
function createWidgetRegistration(widgetName, metadata, html2, serverConfig, isDev = false) {
|
|
999
|
-
const props = metadata.
|
|
999
|
+
const props = metadata.inputs || metadata.props || metadata.schema || {};
|
|
1000
1000
|
const description = metadata.description || `Widget: ${widgetName}`;
|
|
1001
1001
|
const title = metadata.title || widgetName;
|
|
1002
1002
|
const exposeAsTool = metadata.exposeAsTool !== void 0 ? metadata.exposeAsTool : true;
|
|
@@ -1514,12 +1514,17 @@ export default PostHog;
|
|
|
1514
1514
|
const mod = await viteServer.ssrLoadModule(widget2.entry);
|
|
1515
1515
|
if (mod.widgetMetadata) {
|
|
1516
1516
|
metadata = mod.widgetMetadata;
|
|
1517
|
-
|
|
1517
|
+
const schemaField = metadata.inputs || metadata.props;
|
|
1518
|
+
if (schemaField) {
|
|
1518
1519
|
try {
|
|
1519
|
-
|
|
1520
|
+
const extractedShape = schemaField.shape || schemaField;
|
|
1521
|
+
metadata.inputs = extractedShape;
|
|
1522
|
+
if (!metadata.inputs && metadata.props) {
|
|
1523
|
+
metadata.inputs = metadata.props;
|
|
1524
|
+
}
|
|
1520
1525
|
} catch (error2) {
|
|
1521
1526
|
console.warn(
|
|
1522
|
-
`[WIDGET] Failed to extract
|
|
1527
|
+
`[WIDGET] Failed to extract schema for ${widget2.name}:`,
|
|
1523
1528
|
error2
|
|
1524
1529
|
);
|
|
1525
1530
|
}
|
|
@@ -1707,6 +1712,7 @@ function setupWidgetRoutes(app, serverConfig) {
|
|
|
1707
1712
|
__name(setupWidgetRoutes, "setupWidgetRoutes");
|
|
1708
1713
|
|
|
1709
1714
|
// src/server/widgets/ui-resource-registration.ts
|
|
1715
|
+
import z from "zod";
|
|
1710
1716
|
function uiResourceRegistration(server, definition) {
|
|
1711
1717
|
const displayName = definition.title || definition.name;
|
|
1712
1718
|
if (definition.type === "appsSdk" && definition._meta) {
|
|
@@ -1812,69 +1818,76 @@ function uiResourceRegistration(server, definition) {
|
|
|
1812
1818
|
}
|
|
1813
1819
|
}
|
|
1814
1820
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1821
|
+
const widgetMetadata2 = definition._meta?.["mcp-use/widget"];
|
|
1822
|
+
const propsOrSchema = definition.props || widgetMetadata2?.props || widgetMetadata2?.inputs || widgetMetadata2?.schema;
|
|
1823
|
+
const isZodSchema = propsOrSchema && typeof propsOrSchema === "object" && propsOrSchema instanceof z.ZodObject;
|
|
1824
|
+
const toolDefinition = {
|
|
1825
|
+
name: definition.name,
|
|
1826
|
+
title: definition.title,
|
|
1827
|
+
description: definition.description,
|
|
1828
|
+
annotations: definition.toolAnnotations,
|
|
1829
|
+
_meta: Object.keys(toolMetadata).length > 0 ? toolMetadata : void 0
|
|
1830
|
+
};
|
|
1831
|
+
if (isZodSchema) {
|
|
1832
|
+
toolDefinition.schema = propsOrSchema;
|
|
1833
|
+
} else if (propsOrSchema) {
|
|
1834
|
+
toolDefinition.inputs = convertPropsToInputs(
|
|
1835
|
+
propsOrSchema
|
|
1836
|
+
);
|
|
1837
|
+
}
|
|
1838
|
+
server.tool(toolDefinition, async (params) => {
|
|
1839
|
+
const uiResource = await createWidgetUIResource(
|
|
1840
|
+
definition,
|
|
1841
|
+
params,
|
|
1842
|
+
serverConfig
|
|
1843
|
+
);
|
|
1844
|
+
if (definition.type === "appsSdk") {
|
|
1845
|
+
const randomId = Math.random().toString(36).substring(2, 15);
|
|
1846
|
+
const uniqueUri = generateWidgetUri(
|
|
1847
|
+
definition.name,
|
|
1848
|
+
server.buildId,
|
|
1849
|
+
".html",
|
|
1850
|
+
randomId
|
|
1829
1851
|
);
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
} else {
|
|
1848
|
-
toolOutputResult = {
|
|
1849
|
-
content: [
|
|
1850
|
-
{
|
|
1851
|
-
type: "text",
|
|
1852
|
-
text: `Displaying ${displayName}`
|
|
1853
|
-
}
|
|
1854
|
-
]
|
|
1855
|
-
};
|
|
1856
|
-
}
|
|
1857
|
-
const content = toolOutputResult.content || [
|
|
1858
|
-
{ type: "text", text: `Displaying ${displayName}` }
|
|
1859
|
-
];
|
|
1860
|
-
return {
|
|
1861
|
-
_meta: uniqueToolMetadata,
|
|
1862
|
-
content,
|
|
1863
|
-
structuredContent: toolOutputResult.structuredContent
|
|
1852
|
+
const uniqueToolMetadata = {
|
|
1853
|
+
...toolMetadata,
|
|
1854
|
+
"openai/outputTemplate": uniqueUri,
|
|
1855
|
+
"mcp-use/props": params
|
|
1856
|
+
// Pass params as widget props
|
|
1857
|
+
};
|
|
1858
|
+
let toolOutputResult;
|
|
1859
|
+
if (definition.toolOutput) {
|
|
1860
|
+
toolOutputResult = typeof definition.toolOutput === "function" ? definition.toolOutput(params) : definition.toolOutput;
|
|
1861
|
+
} else {
|
|
1862
|
+
toolOutputResult = {
|
|
1863
|
+
content: [
|
|
1864
|
+
{
|
|
1865
|
+
type: "text",
|
|
1866
|
+
text: `Displaying ${displayName}`
|
|
1867
|
+
}
|
|
1868
|
+
]
|
|
1864
1869
|
};
|
|
1865
1870
|
}
|
|
1871
|
+
const content = toolOutputResult.content || [
|
|
1872
|
+
{ type: "text", text: `Displaying ${displayName}` }
|
|
1873
|
+
];
|
|
1866
1874
|
return {
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
text: `Displaying ${displayName}`,
|
|
1871
|
-
description: `Show MCP-UI widget for ${displayName}`
|
|
1872
|
-
},
|
|
1873
|
-
uiResource
|
|
1874
|
-
]
|
|
1875
|
+
_meta: uniqueToolMetadata,
|
|
1876
|
+
content,
|
|
1877
|
+
structuredContent: toolOutputResult.structuredContent
|
|
1875
1878
|
};
|
|
1876
1879
|
}
|
|
1877
|
-
|
|
1880
|
+
return {
|
|
1881
|
+
content: [
|
|
1882
|
+
{
|
|
1883
|
+
type: "text",
|
|
1884
|
+
text: `Displaying ${displayName}`,
|
|
1885
|
+
description: `Show MCP-UI widget for ${displayName}`
|
|
1886
|
+
},
|
|
1887
|
+
uiResource
|
|
1888
|
+
]
|
|
1889
|
+
};
|
|
1890
|
+
});
|
|
1878
1891
|
}
|
|
1879
1892
|
return server;
|
|
1880
1893
|
}
|
|
@@ -1936,9 +1949,9 @@ async function mountInspectorUI(app, serverHost, serverPort, isProduction) {
|
|
|
1936
1949
|
__name(mountInspectorUI, "mountInspectorUI");
|
|
1937
1950
|
|
|
1938
1951
|
// src/server/tools/schema-helpers.ts
|
|
1939
|
-
import { z } from "zod";
|
|
1952
|
+
import { z as z2 } from "zod";
|
|
1940
1953
|
function convertZodSchemaToParams(zodSchema) {
|
|
1941
|
-
if (!(zodSchema instanceof
|
|
1954
|
+
if (!(zodSchema instanceof z2.ZodObject)) {
|
|
1942
1955
|
throw new Error("schema must be a Zod object schema (z.object({...}))");
|
|
1943
1956
|
}
|
|
1944
1957
|
const shape = zodSchema.shape;
|
|
@@ -1955,22 +1968,22 @@ function createParamsSchema(inputs) {
|
|
|
1955
1968
|
let zodType;
|
|
1956
1969
|
switch (input.type) {
|
|
1957
1970
|
case "string":
|
|
1958
|
-
zodType =
|
|
1971
|
+
zodType = z2.string();
|
|
1959
1972
|
break;
|
|
1960
1973
|
case "number":
|
|
1961
|
-
zodType =
|
|
1974
|
+
zodType = z2.number();
|
|
1962
1975
|
break;
|
|
1963
1976
|
case "boolean":
|
|
1964
|
-
zodType =
|
|
1977
|
+
zodType = z2.boolean();
|
|
1965
1978
|
break;
|
|
1966
1979
|
case "object":
|
|
1967
|
-
zodType =
|
|
1980
|
+
zodType = z2.object({});
|
|
1968
1981
|
break;
|
|
1969
1982
|
case "array":
|
|
1970
|
-
zodType =
|
|
1983
|
+
zodType = z2.array(z2.any());
|
|
1971
1984
|
break;
|
|
1972
1985
|
default:
|
|
1973
|
-
zodType =
|
|
1986
|
+
zodType = z2.any();
|
|
1974
1987
|
}
|
|
1975
1988
|
if (input.description) {
|
|
1976
1989
|
zodType = zodType.describe(input.description);
|
|
@@ -2205,7 +2218,7 @@ function registerResource(resourceDefinition, callback) {
|
|
|
2205
2218
|
const explicitMimeType = resourceDefinition.mimeType;
|
|
2206
2219
|
const wrappedCallback = /* @__PURE__ */ __name(async () => {
|
|
2207
2220
|
const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-NA4MHWOZ.js");
|
|
2208
|
-
const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-
|
|
2221
|
+
const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-F56E75XW.js");
|
|
2209
2222
|
const initialRequestContext = getRequestContext2();
|
|
2210
2223
|
const sessions = this.sessions || /* @__PURE__ */ new Map();
|
|
2211
2224
|
const { requestContext } = findSessionContext2(
|
|
@@ -2283,7 +2296,7 @@ function registerResourceTemplate(resourceTemplateDefinition, callback) {
|
|
|
2283
2296
|
async (uri) => {
|
|
2284
2297
|
const params = this.parseTemplateUri(uriTemplate, uri.toString());
|
|
2285
2298
|
const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-NA4MHWOZ.js");
|
|
2286
|
-
const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-
|
|
2299
|
+
const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-F56E75XW.js");
|
|
2287
2300
|
const initialRequestContext = getRequestContext2();
|
|
2288
2301
|
const sessions = this.sessions || /* @__PURE__ */ new Map();
|
|
2289
2302
|
const { requestContext } = findSessionContext2(
|
|
@@ -2338,7 +2351,7 @@ function registerPrompt(promptDefinition, callback) {
|
|
|
2338
2351
|
}
|
|
2339
2352
|
const wrappedCallback = /* @__PURE__ */ __name(async (params, extra) => {
|
|
2340
2353
|
const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-NA4MHWOZ.js");
|
|
2341
|
-
const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-
|
|
2354
|
+
const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-F56E75XW.js");
|
|
2342
2355
|
const initialRequestContext = getRequestContext2();
|
|
2343
2356
|
const sessions = this.sessions || /* @__PURE__ */ new Map();
|
|
2344
2357
|
const { requestContext } = findSessionContext2(
|
|
@@ -4452,7 +4465,7 @@ var MCPServerClass = class {
|
|
|
4452
4465
|
);
|
|
4453
4466
|
}
|
|
4454
4467
|
newServer.server.setRequestHandler(
|
|
4455
|
-
|
|
4468
|
+
z3.object({ method: z3.literal("logging/setLevel") }).passthrough(),
|
|
4456
4469
|
(async (request, extra) => {
|
|
4457
4470
|
const level = request.params?.level;
|
|
4458
4471
|
if (!level) {
|
|
@@ -6,11 +6,11 @@ import type { z } from "zod";
|
|
|
6
6
|
export interface WidgetMetadata {
|
|
7
7
|
title?: string;
|
|
8
8
|
description?: string;
|
|
9
|
-
/** Zod schema for widget
|
|
10
|
-
props?: z.ZodObject<any> | InputDefinition[];
|
|
11
|
-
/** @deprecated Use `props` instead - Zod schema for input validation */
|
|
9
|
+
/** Zod schema for widget input validation (preferred) or InputDefinition array */
|
|
12
10
|
inputs?: z.ZodObject<any> | InputDefinition[];
|
|
13
|
-
/** @deprecated Use `
|
|
11
|
+
/** @deprecated Use `inputs` instead - Zod schema for widget props validation */
|
|
12
|
+
props?: z.ZodObject<any> | InputDefinition[];
|
|
13
|
+
/** @deprecated Use `inputs` instead - Alias for inputs to align with tool naming convention */
|
|
14
14
|
schema?: z.ZodObject<any> | InputDefinition[];
|
|
15
15
|
/**
|
|
16
16
|
* For auto-registered widgets: function or helper that generates the tool output (what the model sees).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../../src/server/types/widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../../src/server/types/widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,eAAe,EAAE,CAAC;IAC9C,gFAAgF;IAChF,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,eAAe,EAAE,CAAC;IAC7C,+FAA+F;IAC/F,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,eAAe,EAAE,CAAC;IAC9C;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,EACP,CAAC,CACC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAEzB,cAAc,GACd,OAAO,8BAA8B,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC,GACpE,cAAc,GACd,OAAO,8BAA8B,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACpE,6DAA6D;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qGAAqG;IACrG,WAAW,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount-widgets-dev.d.ts","sourceRoot":"","sources":["../../../../src/server/widgets/mount-widgets-dev.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAiB,MAAM,MAAM,CAAC;AAS5D,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAI3B;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,sBAAsB,EACtC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"mount-widgets-dev.d.ts","sourceRoot":"","sources":["../../../../src/server/widgets/mount-widgets-dev.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAiB,MAAM,MAAM,CAAC;AAS5D,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAI3B;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,sBAAsB,EACtC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAkhBf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-resource-registration.d.ts","sourceRoot":"","sources":["../../../../src/server/widgets/ui-resource-registration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,iCAAiC,EACjC,0BAA0B,EAC1B,yCAAyC,EACzC,8BAA8B,EAC9B,6CAA6C,EAC7C,cAAc,EACf,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ui-resource-registration.d.ts","sourceRoot":"","sources":["../../../../src/server/widgets/ui-resource-registration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,iCAAiC,EACjC,0BAA0B,EAC1B,yCAAyC,EACzC,8BAA8B,EAC9B,6CAA6C,EAC7C,cAAc,EACf,MAAM,mBAAmB,CAAC;AAU3B;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,kFAAkF;IAClF,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxD,QAAQ,EAAE,CACR,UAAU,EAAE,kBAAkB,GAAG,iCAAiC,EAClE,QAAQ,CAAC,EAAE,GAAG,KACX,GAAG,CAAC;IACT,gBAAgB,EAAE,CAChB,UAAU,EACN,0BAA0B,GAC1B,yCAAyC,GACzC,8BAA8B,GAC9B,6CAA6C,EACjD,QAAQ,CAAC,EAAE,GAAG,KACX,GAAG,CAAC;IACT,IAAI,EAAE,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;CAC3D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,gBAAgB,EAC/D,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,oBAAoB,GAC/B,CAAC,CAkQH"}
|
package/dist/src/version.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
sendProgressNotification,
|
|
11
11
|
shouldLogMessage,
|
|
12
12
|
withTimeout
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-744QI6FX.js";
|
|
14
14
|
import "./chunk-KUEVOU4M.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-JQMHLTXF.js";
|
|
16
16
|
import "./chunk-FRUZDWXH.js";
|
|
17
17
|
import "./chunk-3GQAWCBQ.js";
|
|
18
18
|
export {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-use",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.11.0-canary.
|
|
4
|
+
"version": "1.11.0-canary.17",
|
|
5
5
|
"description": "Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.",
|
|
6
6
|
"author": "mcp-use, Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
"posthog-node": "^5.17.2",
|
|
138
138
|
"ws": "^8.18.3",
|
|
139
139
|
"zod": "^4.2.0",
|
|
140
|
-
"@mcp-use/cli": "2.6.0-canary.
|
|
141
|
-
"@mcp-use/inspector": "0.13.0-canary.
|
|
140
|
+
"@mcp-use/cli": "2.6.0-canary.17",
|
|
141
|
+
"@mcp-use/inspector": "0.13.0-canary.17"
|
|
142
142
|
},
|
|
143
143
|
"optionalDependencies": {
|
|
144
144
|
"chalk": "^5.6.2",
|