mcp-use 1.11.0-canary.14 → 1.11.0-canary.16

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.
@@ -7,7 +7,7 @@ import {
7
7
  createEnhancedContext,
8
8
  findSessionContext,
9
9
  isValidLogLevel
10
- } from "../../chunk-AEHNVFZG.js";
10
+ } from "../../chunk-RU7FIJVM.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-7TS5EJ4T.js";
33
+ } from "../../chunk-2FOTPDUJ.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 z2 } from "zod";
48
+ import { z as z3 } from "zod";
49
49
 
50
50
  // src/server/utils/response-helpers.ts
51
51
  function text(content) {
@@ -1707,6 +1707,7 @@ function setupWidgetRoutes(app, serverConfig) {
1707
1707
  __name(setupWidgetRoutes, "setupWidgetRoutes");
1708
1708
 
1709
1709
  // src/server/widgets/ui-resource-registration.ts
1710
+ import z from "zod";
1710
1711
  function uiResourceRegistration(server, definition) {
1711
1712
  const displayName = definition.title || definition.name;
1712
1713
  if (definition.type === "appsSdk" && definition._meta) {
@@ -1812,69 +1813,76 @@ function uiResourceRegistration(server, definition) {
1812
1813
  }
1813
1814
  }
1814
1815
  }
1815
- server.tool(
1816
- {
1817
- name: definition.name,
1818
- title: definition.title,
1819
- description: definition.description,
1820
- inputs: convertPropsToInputs(definition.props),
1821
- annotations: definition.toolAnnotations,
1822
- _meta: Object.keys(toolMetadata).length > 0 ? toolMetadata : void 0
1823
- },
1824
- async (params) => {
1825
- const uiResource = await createWidgetUIResource(
1826
- definition,
1827
- params,
1828
- serverConfig
1816
+ const widgetMetadata2 = definition._meta?.["mcp-use/widget"];
1817
+ const propsOrSchema = definition.props || widgetMetadata2?.props || widgetMetadata2?.inputs || widgetMetadata2?.schema;
1818
+ const isZodSchema = propsOrSchema && typeof propsOrSchema === "object" && propsOrSchema instanceof z.ZodObject;
1819
+ const toolDefinition = {
1820
+ name: definition.name,
1821
+ title: definition.title,
1822
+ description: definition.description,
1823
+ annotations: definition.toolAnnotations,
1824
+ _meta: Object.keys(toolMetadata).length > 0 ? toolMetadata : void 0
1825
+ };
1826
+ if (isZodSchema) {
1827
+ toolDefinition.schema = propsOrSchema;
1828
+ } else if (propsOrSchema) {
1829
+ toolDefinition.inputs = convertPropsToInputs(
1830
+ propsOrSchema
1831
+ );
1832
+ }
1833
+ server.tool(toolDefinition, async (params) => {
1834
+ const uiResource = await createWidgetUIResource(
1835
+ definition,
1836
+ params,
1837
+ serverConfig
1838
+ );
1839
+ if (definition.type === "appsSdk") {
1840
+ const randomId = Math.random().toString(36).substring(2, 15);
1841
+ const uniqueUri = generateWidgetUri(
1842
+ definition.name,
1843
+ server.buildId,
1844
+ ".html",
1845
+ randomId
1829
1846
  );
1830
- if (definition.type === "appsSdk") {
1831
- const randomId = Math.random().toString(36).substring(2, 15);
1832
- const uniqueUri = generateWidgetUri(
1833
- definition.name,
1834
- server.buildId,
1835
- ".html",
1836
- randomId
1837
- );
1838
- const uniqueToolMetadata = {
1839
- ...toolMetadata,
1840
- "openai/outputTemplate": uniqueUri,
1841
- "mcp-use/props": params
1842
- // Pass params as widget props
1843
- };
1844
- let toolOutputResult;
1845
- if (definition.toolOutput) {
1846
- toolOutputResult = typeof definition.toolOutput === "function" ? definition.toolOutput(params) : definition.toolOutput;
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
1847
+ const uniqueToolMetadata = {
1848
+ ...toolMetadata,
1849
+ "openai/outputTemplate": uniqueUri,
1850
+ "mcp-use/props": params
1851
+ // Pass params as widget props
1852
+ };
1853
+ let toolOutputResult;
1854
+ if (definition.toolOutput) {
1855
+ toolOutputResult = typeof definition.toolOutput === "function" ? definition.toolOutput(params) : definition.toolOutput;
1856
+ } else {
1857
+ toolOutputResult = {
1858
+ content: [
1859
+ {
1860
+ type: "text",
1861
+ text: `Displaying ${displayName}`
1862
+ }
1863
+ ]
1864
1864
  };
1865
1865
  }
1866
+ const content = toolOutputResult.content || [
1867
+ { type: "text", text: `Displaying ${displayName}` }
1868
+ ];
1866
1869
  return {
1867
- content: [
1868
- {
1869
- type: "text",
1870
- text: `Displaying ${displayName}`,
1871
- description: `Show MCP-UI widget for ${displayName}`
1872
- },
1873
- uiResource
1874
- ]
1870
+ _meta: uniqueToolMetadata,
1871
+ content,
1872
+ structuredContent: toolOutputResult.structuredContent
1875
1873
  };
1876
1874
  }
1877
- );
1875
+ return {
1876
+ content: [
1877
+ {
1878
+ type: "text",
1879
+ text: `Displaying ${displayName}`,
1880
+ description: `Show MCP-UI widget for ${displayName}`
1881
+ },
1882
+ uiResource
1883
+ ]
1884
+ };
1885
+ });
1878
1886
  }
1879
1887
  return server;
1880
1888
  }
@@ -1936,9 +1944,9 @@ async function mountInspectorUI(app, serverHost, serverPort, isProduction) {
1936
1944
  __name(mountInspectorUI, "mountInspectorUI");
1937
1945
 
1938
1946
  // src/server/tools/schema-helpers.ts
1939
- import { z } from "zod";
1947
+ import { z as z2 } from "zod";
1940
1948
  function convertZodSchemaToParams(zodSchema) {
1941
- if (!(zodSchema instanceof z.ZodObject)) {
1949
+ if (!(zodSchema instanceof z2.ZodObject)) {
1942
1950
  throw new Error("schema must be a Zod object schema (z.object({...}))");
1943
1951
  }
1944
1952
  const shape = zodSchema.shape;
@@ -1955,22 +1963,22 @@ function createParamsSchema(inputs) {
1955
1963
  let zodType;
1956
1964
  switch (input.type) {
1957
1965
  case "string":
1958
- zodType = z.string();
1966
+ zodType = z2.string();
1959
1967
  break;
1960
1968
  case "number":
1961
- zodType = z.number();
1969
+ zodType = z2.number();
1962
1970
  break;
1963
1971
  case "boolean":
1964
- zodType = z.boolean();
1972
+ zodType = z2.boolean();
1965
1973
  break;
1966
1974
  case "object":
1967
- zodType = z.object({});
1975
+ zodType = z2.object({});
1968
1976
  break;
1969
1977
  case "array":
1970
- zodType = z.array(z.any());
1978
+ zodType = z2.array(z2.any());
1971
1979
  break;
1972
1980
  default:
1973
- zodType = z.any();
1981
+ zodType = z2.any();
1974
1982
  }
1975
1983
  if (input.description) {
1976
1984
  zodType = zodType.describe(input.description);
@@ -2205,7 +2213,7 @@ function registerResource(resourceDefinition, callback) {
2205
2213
  const explicitMimeType = resourceDefinition.mimeType;
2206
2214
  const wrappedCallback = /* @__PURE__ */ __name(async () => {
2207
2215
  const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-NA4MHWOZ.js");
2208
- const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-RRECKMIN.js");
2216
+ const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-7ZZVUHAM.js");
2209
2217
  const initialRequestContext = getRequestContext2();
2210
2218
  const sessions = this.sessions || /* @__PURE__ */ new Map();
2211
2219
  const { requestContext } = findSessionContext2(
@@ -2283,7 +2291,7 @@ function registerResourceTemplate(resourceTemplateDefinition, callback) {
2283
2291
  async (uri) => {
2284
2292
  const params = this.parseTemplateUri(uriTemplate, uri.toString());
2285
2293
  const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-NA4MHWOZ.js");
2286
- const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-RRECKMIN.js");
2294
+ const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-7ZZVUHAM.js");
2287
2295
  const initialRequestContext = getRequestContext2();
2288
2296
  const sessions = this.sessions || /* @__PURE__ */ new Map();
2289
2297
  const { requestContext } = findSessionContext2(
@@ -2338,7 +2346,7 @@ function registerPrompt(promptDefinition, callback) {
2338
2346
  }
2339
2347
  const wrappedCallback = /* @__PURE__ */ __name(async (params, extra) => {
2340
2348
  const { getRequestContext: getRequestContext2, runWithContext: runWithContext2 } = await import("../../context-storage-NA4MHWOZ.js");
2341
- const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-RRECKMIN.js");
2349
+ const { findSessionContext: findSessionContext2 } = await import("../../tool-execution-helpers-7ZZVUHAM.js");
2342
2350
  const initialRequestContext = getRequestContext2();
2343
2351
  const sessions = this.sessions || /* @__PURE__ */ new Map();
2344
2352
  const { requestContext } = findSessionContext2(
@@ -4452,7 +4460,7 @@ var MCPServerClass = class {
4452
4460
  );
4453
4461
  }
4454
4462
  newServer.server.setRequestHandler(
4455
- z2.object({ method: z2.literal("logging/setLevel") }).passthrough(),
4463
+ z3.object({ method: z3.literal("logging/setLevel") }).passthrough(),
4456
4464
  (async (request, extra) => {
4457
4465
  const level = request.params?.level;
4458
4466
  if (!level) {
@@ -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;AAS3B;;;;;;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,CAsOH"}
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"}
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "1.11.0-canary.14";
1
+ export declare const VERSION = "1.11.0-canary.16";
2
2
  /**
3
3
  * Get the package version.
4
4
  * The version is embedded at build time via scripts/generate-version.mjs
@@ -10,9 +10,9 @@ import {
10
10
  sendProgressNotification,
11
11
  shouldLogMessage,
12
12
  withTimeout
13
- } from "./chunk-AEHNVFZG.js";
13
+ } from "./chunk-RU7FIJVM.js";
14
14
  import "./chunk-KUEVOU4M.js";
15
- import "./chunk-7TS5EJ4T.js";
15
+ import "./chunk-2FOTPDUJ.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.14",
4
+ "version": "1.11.0-canary.16",
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.14",
141
- "@mcp-use/inspector": "0.13.0-canary.14"
140
+ "@mcp-use/cli": "2.6.0-canary.16",
141
+ "@mcp-use/inspector": "0.13.0-canary.16"
142
142
  },
143
143
  "optionalDependencies": {
144
144
  "chalk": "^5.6.2",