skybridge 0.0.0-dev.f881c56 → 0.0.0-dev.fa642c4

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 (88) hide show
  1. package/dist/src/server/devtoolsStaticServer.d.ts +15 -0
  2. package/dist/src/server/devtoolsStaticServer.js +43 -0
  3. package/dist/src/server/devtoolsStaticServer.js.map +1 -0
  4. package/dist/src/server/index.d.ts +3 -2
  5. package/dist/src/server/index.js +1 -0
  6. package/dist/src/server/index.js.map +1 -1
  7. package/dist/src/server/inferUtilityTypes.d.ts +10 -0
  8. package/dist/src/server/server.d.ts +30 -16
  9. package/dist/src/server/server.js +4 -4
  10. package/dist/src/server/server.js.map +1 -1
  11. package/dist/src/server/templateHelper.js +5 -4
  12. package/dist/src/server/templateHelper.js.map +1 -1
  13. package/dist/src/server/templates/development.hbs +1 -1
  14. package/dist/src/server/widgetsDevServer.js +3 -3
  15. package/dist/src/server/widgetsDevServer.js.map +1 -1
  16. package/dist/src/test/utils.d.ts +44 -9
  17. package/dist/src/test/utils.js +66 -8
  18. package/dist/src/test/utils.js.map +1 -1
  19. package/dist/src/test/widget.test.js +26 -21
  20. package/dist/src/test/widget.test.js.map +1 -1
  21. package/dist/src/web/create-store.js +1 -1
  22. package/dist/src/web/create-store.js.map +1 -1
  23. package/dist/src/web/create-store.test.js +1 -1
  24. package/dist/src/web/create-store.test.js.map +1 -1
  25. package/dist/src/web/data-llm.js +2 -2
  26. package/dist/src/web/data-llm.js.map +1 -1
  27. package/dist/src/web/data-llm.test.js.map +1 -1
  28. package/dist/src/web/generate-helpers.d.ts +9 -7
  29. package/dist/src/web/generate-helpers.js +4 -2
  30. package/dist/src/web/generate-helpers.js.map +1 -1
  31. package/dist/src/web/generate-helpers.test-d.js +29 -2
  32. package/dist/src/web/generate-helpers.test-d.js.map +1 -1
  33. package/dist/src/web/generate-helpers.test.js +1 -1
  34. package/dist/src/web/generate-helpers.test.js.map +1 -1
  35. package/dist/src/web/helpers/state.js +1 -1
  36. package/dist/src/web/helpers/state.js.map +1 -1
  37. package/dist/src/web/helpers/state.test.js +2 -2
  38. package/dist/src/web/helpers/state.test.js.map +1 -1
  39. package/dist/src/web/hooks/index.d.ts +2 -2
  40. package/dist/src/web/hooks/index.js +1 -1
  41. package/dist/src/web/hooks/index.js.map +1 -1
  42. package/dist/src/web/hooks/use-call-tool.d.ts +1 -1
  43. package/dist/src/web/hooks/use-call-tool.js.map +1 -1
  44. package/dist/src/web/hooks/use-call-tool.test-d.js +1 -1
  45. package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -1
  46. package/dist/src/web/hooks/use-call-tool.test.js +9 -15
  47. package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
  48. package/dist/src/web/hooks/use-display-mode.js.map +1 -1
  49. package/dist/src/web/hooks/use-display-mode.test.js +2 -2
  50. package/dist/src/web/hooks/use-display-mode.test.js.map +1 -1
  51. package/dist/src/web/hooks/use-files.test.js +1 -1
  52. package/dist/src/web/hooks/use-files.test.js.map +1 -1
  53. package/dist/src/web/hooks/use-locale.js.map +1 -1
  54. package/dist/src/web/hooks/use-locale.test.js +2 -2
  55. package/dist/src/web/hooks/use-locale.test.js.map +1 -1
  56. package/dist/src/web/hooks/use-open-external.test.js +2 -2
  57. package/dist/src/web/hooks/use-open-external.test.js.map +1 -1
  58. package/dist/src/web/hooks/use-openai-global.d.ts +2 -2
  59. package/dist/src/web/hooks/use-openai-global.js +7 -5
  60. package/dist/src/web/hooks/use-openai-global.js.map +1 -1
  61. package/dist/src/web/hooks/use-request-modal.test.js +2 -2
  62. package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
  63. package/dist/src/web/hooks/use-theme.js.map +1 -1
  64. package/dist/src/web/hooks/use-theme.test.js +2 -2
  65. package/dist/src/web/hooks/use-theme.test.js.map +1 -1
  66. package/dist/src/web/hooks/use-tool-info.d.ts +1 -1
  67. package/dist/src/web/hooks/use-tool-info.js +4 -6
  68. package/dist/src/web/hooks/use-tool-info.js.map +1 -1
  69. package/dist/src/web/hooks/use-tool-info.test-d.js +0 -1
  70. package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
  71. package/dist/src/web/hooks/use-tool-info.test.js +2 -2
  72. package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
  73. package/dist/src/web/hooks/use-user-agent.js.map +1 -1
  74. package/dist/src/web/hooks/use-user-agent.test.js +2 -2
  75. package/dist/src/web/hooks/use-user-agent.test.js.map +1 -1
  76. package/dist/src/web/hooks/use-widget-state.js +2 -2
  77. package/dist/src/web/hooks/use-widget-state.js.map +1 -1
  78. package/dist/src/web/hooks/use-widget-state.test.js +2 -2
  79. package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
  80. package/dist/src/web/index.d.ts +4 -4
  81. package/dist/src/web/index.js +4 -4
  82. package/dist/src/web/index.js.map +1 -1
  83. package/dist/src/web/proxy.js +1 -1
  84. package/dist/src/web/proxy.js.map +1 -1
  85. package/dist/src/web/types.d.ts +6 -6
  86. package/package.json +9 -8
  87. package/LICENSE +0 -674
  88. package/README.md +0 -415
@@ -0,0 +1,15 @@
1
+ import { type RequestHandler } from "express";
2
+ /**
3
+ * Serve the built devtools React app
4
+ * This router serves static files from the devtools's dist directory.
5
+ * It should be installed at the application root, like so:
6
+ *
7
+ * const app = express();
8
+ *
9
+ * if (env.NODE_ENV !== "production") {
10
+ * app.use(await devtoolsStaticServer(server));
11
+ * app.use(await widgetsDevServer());
12
+ * ^^^^^^^^ Make sure to install the devtoolsStaticServer before the widgetsDevServer
13
+ * }
14
+ */
15
+ export declare const devtoolsStaticServer: () => Promise<RequestHandler>;
@@ -0,0 +1,43 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import cors from "cors";
5
+ import express, {} from "express";
6
+ const require = createRequire(import.meta.url);
7
+ /**
8
+ * Serve the built devtools React app
9
+ * This router serves static files from the devtools's dist directory.
10
+ * It should be installed at the application root, like so:
11
+ *
12
+ * const app = express();
13
+ *
14
+ * if (env.NODE_ENV !== "production") {
15
+ * app.use(await devtoolsStaticServer(server));
16
+ * app.use(await widgetsDevServer());
17
+ * ^^^^^^^^ Make sure to install the devtoolsStaticServer before the widgetsDevServer
18
+ * }
19
+ */
20
+ export const devtoolsStaticServer = async () => {
21
+ const router = express.Router();
22
+ let devtoolsPath;
23
+ const devtoolsPackagePath = require.resolve("@skybridge/devtools/package.json");
24
+ devtoolsPath = path.join(path.dirname(devtoolsPackagePath), "dist");
25
+ if (!existsSync(devtoolsPath)) {
26
+ throw new Error("@skybridge/devtools dist folder not found. The package is installed but not built. Please build it first.");
27
+ }
28
+ router.use(cors());
29
+ router.use(express.static(devtoolsPath));
30
+ router.get("/", (_req, res, next) => {
31
+ const indexHtmlPath = path.join(devtoolsPath, "index.html");
32
+ try {
33
+ const indexHtml = readFileSync(indexHtmlPath, "utf-8");
34
+ res.setHeader("Content-Type", "text/html");
35
+ res.send(indexHtml);
36
+ }
37
+ catch (error) {
38
+ next(error);
39
+ }
40
+ });
41
+ return router;
42
+ };
43
+ //# sourceMappingURL=devtoolsStaticServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtoolsStaticServer.js","sourceRoot":"","sources":["../../../src/server/devtoolsStaticServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,EAAE,EAAuB,MAAM,SAAS,CAAC;AAEvD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,IAA6B,EAAE;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAChC,IAAI,YAAoB,CAAC;IACzB,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,CACzC,kCAAkC,CACnC,CAAC;IACF,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,CAAC;IAEpE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,2GAA2G,CAC5G,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAEnB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IAEzC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAClC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YACvD,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;YAC3C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
+ export { devtoolsStaticServer } from "./devtoolsStaticServer.js";
2
+ export type { AnyToolRegistry, InferTools, ToolInput, ToolNames, ToolOutput, ToolResponseMetadata, } from "./inferUtilityTypes.js";
3
+ export type { McpServerTypes, ToolDef } from "./server.js";
1
4
  export { McpServer } from "./server.js";
2
5
  export { widgetsDevServer } from "./widgetsDevServer.js";
3
- export type { ToolDef, McpServerTypes } from "./server.js";
4
- export type { InferTools, AnyToolRegistry, ToolNames, ToolInput, ToolOutput, } from "./inferUtilityTypes.js";
@@ -1,3 +1,4 @@
1
+ export { devtoolsStaticServer } from "./devtoolsStaticServer.js";
1
2
  export { McpServer } from "./server.js";
2
3
  export { widgetsDevServer } from "./widgetsDevServer.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAUjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -51,4 +51,14 @@ export type ToolInput<ServerType, ToolName extends ToolNames<ServerType>> = Extr
51
51
  * ```
52
52
  */
53
53
  export type ToolOutput<ServerType, ToolName extends ToolNames<ServerType>> = ExtractTool<ServerType, ToolName>["output"];
54
+ /**
55
+ * Get the responseMetadata type for a specific tool (widget or regular tool).
56
+ * This is inferred from the `_meta` property of the tool callback's return value.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * type SearchMeta = ToolResponseMetadata<MyServer, "search">;
61
+ * ```
62
+ */
63
+ export type ToolResponseMetadata<ServerType, ToolName extends ToolNames<ServerType>> = ExtractTool<ServerType, ToolName>["responseMetadata"];
54
64
  export {};
@@ -1,16 +1,22 @@
1
1
  import { McpServer as McpServerBase, type RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import type { Resource, ToolAnnotations, CallToolResult, ServerRequest, ServerNotification } from "@modelcontextprotocol/sdk/types.js";
2
+ import type { AnySchema, SchemaOutput, ZodRawShapeCompat } from "@modelcontextprotocol/sdk/server/zod-compat.js";
3
3
  import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
4
- import type { ZodRawShape, ZodObject, infer as Infer } from "zod";
5
- export type ToolDef<TInput = unknown, TOutput = unknown> = {
4
+ import type { CallToolResult, Resource, ServerNotification, ServerRequest, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
5
+ export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unknown> = {
6
6
  input: TInput;
7
7
  output: TOutput;
8
+ responseMetadata: TResponseMetadata;
8
9
  };
9
10
  type McpServerOriginalResourceConfig = Omit<Resource, "uri" | "name" | "mimeType">;
10
- type McpServerOriginalToolConfig = Omit<Parameters<McpServerBase["registerTool"]>[1], "inputSchema" | "outputSchema">;
11
+ type McpServerOriginalToolConfig = Omit<Parameters<typeof McpServerBase.prototype.registerTool<ZodRawShapeCompat, ZodRawShapeCompat>>[1], "inputSchema" | "outputSchema">;
11
12
  type ExtractStructuredContent<T> = T extends {
12
13
  structuredContent: infer SC;
13
14
  } ? SC : never;
15
+ type ExtractMeta<T> = Extract<T, {
16
+ _meta: unknown;
17
+ }> extends {
18
+ _meta: infer M;
19
+ } ? M : unknown;
14
20
  /**
15
21
  * Type-level marker interface for cross-package type inference.
16
22
  * This enables TypeScript to infer tool types across package boundaries
@@ -20,29 +26,37 @@ type ExtractStructuredContent<T> = T extends {
20
26
  *
21
27
  * Inspired by tRPC's _def pattern and Hono's type markers.
22
28
  */
23
- export interface McpServerTypes<TTools extends Record<string, ToolDef> = {}> {
29
+ export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
24
30
  readonly tools: TTools;
25
31
  }
26
- type AddTool<TTools, TName extends string, TInput extends ZodRawShape, TOutput> = McpServer<TTools & {
27
- [K in TName]: ToolDef<Infer<ZodObject<TInput>>, TOutput>;
32
+ type Simplify<T> = {
33
+ [K in keyof T]: T[K];
34
+ };
35
+ type ShapeOutput<Shape extends ZodRawShapeCompat> = Simplify<{
36
+ [K in keyof Shape as undefined extends SchemaOutput<Shape[K]> ? never : K]: SchemaOutput<Shape[K]>;
37
+ } & {
38
+ [K in keyof Shape as undefined extends SchemaOutput<Shape[K]> ? K : never]?: SchemaOutput<Shape[K]>;
39
+ }>;
40
+ type AddTool<TTools, TName extends string, TInput extends ZodRawShapeCompat, TOutput, TResponseMetadata = unknown> = McpServer<TTools & {
41
+ [K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
28
42
  }>;
29
- type ToolConfig<TInput extends ZodRawShape> = {
43
+ type ToolConfig<TInput extends ZodRawShapeCompat | AnySchema> = {
30
44
  title?: string;
31
45
  description?: string;
32
46
  inputSchema?: TInput;
33
- outputSchema?: ZodRawShape;
47
+ outputSchema?: ZodRawShapeCompat | AnySchema;
34
48
  annotations?: ToolAnnotations;
35
49
  _meta?: Record<string, unknown>;
36
50
  };
37
- type ToolHandler<TInput extends ZodRawShape, TReturn extends CallToolResult = CallToolResult> = (args: Infer<ZodObject<TInput>>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => TReturn | Promise<TReturn>;
38
- export declare class McpServer<TTools extends Record<string, ToolDef> = {}> extends McpServerBase {
51
+ type ToolHandler<TInput extends ZodRawShapeCompat, TReturn extends CallToolResult = CallToolResult> = (args: ShapeOutput<TInput>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => TReturn | Promise<TReturn>;
52
+ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>> extends McpServerBase {
39
53
  readonly $types: McpServerTypes<TTools>;
40
- widget<TName extends string, TInput extends ZodRawShape, TReturn extends CallToolResult>(name: TName, resourceConfig: McpServerOriginalResourceConfig, toolConfig: McpServerOriginalToolConfig & {
54
+ registerWidget<TName extends string, TInput extends ZodRawShapeCompat, TReturn extends CallToolResult>(name: TName, resourceConfig: McpServerOriginalResourceConfig, toolConfig: McpServerOriginalToolConfig & {
41
55
  inputSchema?: TInput;
42
- outputSchema?: ZodRawShape;
43
- }, toolCallback: ToolHandler<TInput, TReturn>): AddTool<TTools, TName, TInput, ExtractStructuredContent<TReturn>>;
44
- registerTool<TName extends string, InputArgs extends ZodRawShape, TReturn extends CallToolResult>(name: TName, config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, TReturn>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>>;
45
- registerTool<InputArgs extends ZodRawShape>(name: string, config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs>): RegisteredTool;
56
+ outputSchema?: ZodRawShapeCompat | AnySchema;
57
+ }, toolCallback: ToolHandler<TInput, TReturn>): AddTool<TTools, TName, TInput, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>>;
58
+ registerTool<TName extends string, InputArgs extends ZodRawShapeCompat, TReturn extends CallToolResult>(name: TName, config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, TReturn>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>>;
59
+ registerTool<InputArgs extends ZodRawShapeCompat>(name: string, config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs>): RegisteredTool;
46
60
  private lookupDistFile;
47
61
  }
48
62
  export {};
@@ -1,9 +1,9 @@
1
- import { McpServer as McpServerBase, } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { templateHelper } from "./templateHelper.js";
3
1
  import { readFileSync } from "node:fs";
4
2
  import path from "node:path";
3
+ import { McpServer as McpServerBase, } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { templateHelper } from "./templateHelper.js";
5
5
  export class McpServer extends McpServerBase {
6
- widget(name, resourceConfig, toolConfig, toolCallback) {
6
+ registerWidget(name, resourceConfig, toolConfig, toolCallback) {
7
7
  const uri = `ui://widgets/${name}.html`;
8
8
  const resourceMetadata = {
9
9
  ...(resourceConfig._meta ?? {}),
@@ -11,7 +11,7 @@ export class McpServer extends McpServerBase {
11
11
  if (toolConfig.description !== undefined) {
12
12
  resourceMetadata["openai/widgetDescription"] = toolConfig.description;
13
13
  }
14
- this.resource(name, uri, {
14
+ this.registerResource(name, uri, {
15
15
  ...resourceConfig,
16
16
  _meta: resourceMetadata,
17
17
  }, async (_uri, extra) => {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,IAAI,aAAa,GAG3B,MAAM,yCAAyC,CAAC;AAUjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAkG7B,MAAM,OAAO,SAEX,SAAQ,aAAa;IAGrB,MAAM,CAKJ,IAAW,EACX,cAA+C,EAC/C,UAGC,EACD,YAA0C;QAE1C,MAAM,GAAG,GAAG,gBAAgB,IAAI,OAAO,CAAC;QACxC,MAAM,gBAAgB,GAAiB;YACrC,GAAG,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE,CAAC;SAChC,CAAC;QACF,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACzC,gBAAgB,CAAC,0BAA0B,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC;QACxE,CAAC;QAED,IAAI,CAAC,QAAQ,CACX,IAAI,EACJ,GAAG,EACH;YACE,GAAG,cAAc;YACjB,KAAK,EAAE,gBAAgB;SACxB,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;YACpB,MAAM,SAAS,GACb,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;gBACnC,CAAC,CAAC,WACE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBACjD,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,IAC/B,EAAE;gBACJ,CAAC,CAAC,uBAAuB,CAAC;YAE9B,MAAM,IAAI,GAC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IAAI,CAAC,cAAc,CAAC,WAAW,CAAC;iBAC5C,CAAC;gBACJ,CAAC,CAAC,cAAc,CAAC,iBAAiB,CAAC;oBAC/B,SAAS;oBACT,UAAU,EAAE,IAAI;iBACjB,CAAC,CAAC;YAET,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG;wBACH,QAAQ,EAAE,qBAAqB;wBAC/B,IAAI,EAAE,IAAI;qBACX;iBACF;aACF,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,MAAM,QAAQ,GAAa;YACzB,GAAG,UAAU,CAAC,KAAK;YACnB,uBAAuB,EAAE,GAAG;YAC5B,gBAAgB,EAAE,GAAG;SACtB,CAAC;QAEF,IAAI,CAAC,YAAY,CACf,IAAI,EACJ;YACE,GAAG,UAAU;YACb,KAAK,EAAE,QAAQ;SAChB,EACD,YAAY,CACb,CAAC;QAEF,OAAO,IAMN,CAAC;IACJ,CAAC;IAwBQ,YAAY,CACnB,IAAY,EACZ,MAA6B,EAC7B,EAA2B;QAE3B,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,cAAc,CAAC,GAAW;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,YAAY,CACV,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,CAAC,EACpE,OAAO,CACR,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;IAC7B,CAAC;CACF"}
@@ -1,14 +1,15 @@
1
- import Handlebars from "handlebars";
2
1
  import { readFileSync } from "node:fs";
3
- import { join, dirname } from "node:path";
2
+ import { dirname, join } from "node:path";
4
3
  import { fileURLToPath } from "node:url";
4
+ import Handlebars from "handlebars";
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = dirname(__filename);
7
7
  class TemplateHelper {
8
8
  templateCache = new Map();
9
9
  loadTemplate(templateName) {
10
- if (this.templateCache.has(templateName)) {
11
- return this.templateCache.get(templateName);
10
+ const cached = this.templateCache.get(templateName);
11
+ if (cached) {
12
+ return cached;
12
13
  }
13
14
  const templatePath = join(__dirname, "templates", `${templateName}.hbs`);
14
15
  const templateSource = readFileSync(templatePath, "utf-8");
@@ -1 +1 @@
1
- {"version":3,"file":"templateHelper.js","sourceRoot":"","sources":["../../../src/server/templateHelper.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAOtC,MAAM,cAAc;IACV,aAAa,GAAG,IAAI,GAAG,EAAsC,CAAC;IAE9D,YAAY,CAAC,YAAoB;QACvC,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC;QAC/C,CAAC;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,YAAY,MAAM,CAAC,CAAC;QACzE,MAAM,cAAc,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAEpD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC;IAClB,C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D,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,gBAAgB,CAAC,IAIhB;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,IAA+C;QAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QAClD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
@@ -7,6 +7,6 @@
7
7
  </script>
8
8
  <script type="module" src="{{serverUrl}}/@vite/client"></script>
9
9
  <div id="root"></div>
10
- <script type="module">
10
+ <script type="module" id="dev-widget-entry">
11
11
  import('{{serverUrl}}/src/widgets/{{widgetName}}.tsx');
12
12
  </script>
@@ -1,6 +1,6 @@
1
- import express, {} from "express";
2
- import cors from "cors";
3
1
  import path from "node:path";
2
+ import cors from "cors";
3
+ import express, {} from "express";
4
4
  /**
5
5
  * Install Vite dev server
6
6
  * This router MUST be installed at the application root, like so:
@@ -17,7 +17,7 @@ export const widgetsDevServer = async () => {
17
17
  const workspaceRoot = searchForWorkspaceRoot(process.cwd());
18
18
  const webAppRoot = path.join(workspaceRoot, "web");
19
19
  const configResult = await loadConfigFromFile({ command: "serve", mode: "development" }, path.join(webAppRoot, "vite.config.ts"), webAppRoot);
20
- // Remove build-specific options that don't apply to dev server
20
+ // biome-ignore lint/correctness/noUnusedVariables: Remove build-specific options that don't apply to dev server
21
21
  const { build, preview, ...devConfig } = configResult?.config || {};
22
22
  const vite = await createServer({
23
23
  ...devConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"widgetsDevServer.js","sourceRoot":"","sources":["../../../src/server/widgetsDevServer.ts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O,EAAE,kBAAkB,CAAC;SACvC;KACF,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACnB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -5,10 +5,10 @@ import { McpServer } from "../server/server.js";
5
5
  */
6
6
  export declare function createMockMcpServer(): {
7
7
  server: McpServer;
8
- mockResource: MockInstance<McpServer["resource"]>;
8
+ mockRegisterResource: MockInstance<McpServer["registerResource"]>;
9
9
  mockRegisterTool: MockInstance<McpServer["registerTool"]>;
10
10
  };
11
- export declare function createTestServer(): McpServer<{
11
+ export declare function createTestServer(): McpServer<Record<never, import("../server/server.js").ToolDef<unknown, unknown, unknown>> & {
12
12
  "search-voyage": import("../server/server.js").ToolDef<{
13
13
  destination: string;
14
14
  departureDate?: string | undefined;
@@ -20,7 +20,7 @@ export declare function createTestServer(): McpServer<{
20
20
  price: number;
21
21
  }[];
22
22
  totalCount: number;
23
- }>;
23
+ }, unknown>;
24
24
  } & {
25
25
  "get-trip-details": import("../server/server.js").ToolDef<{
26
26
  tripId: string;
@@ -28,9 +28,9 @@ export declare function createTestServer(): McpServer<{
28
28
  name: string;
29
29
  description: string;
30
30
  images: string[];
31
- }>;
31
+ }, unknown>;
32
32
  } & {
33
- "no-input-widget": import("../server/server.js").ToolDef<{}, {}>;
33
+ "no-input-widget": import("../server/server.js").ToolDef<{}, {}, unknown>;
34
34
  } & {
35
35
  "inferred-output-widget": import("../server/server.js").ToolDef<{
36
36
  query: string;
@@ -40,7 +40,7 @@ export declare function createTestServer(): McpServer<{
40
40
  score: number;
41
41
  }[];
42
42
  inferredCount: number;
43
- }>;
43
+ }, unknown>;
44
44
  } & {
45
45
  "calculate-price": import("../server/server.js").ToolDef<{
46
46
  tripId: string;
@@ -48,7 +48,7 @@ export declare function createTestServer(): McpServer<{
48
48
  }, {
49
49
  totalPrice: number;
50
50
  currency: string;
51
- }>;
51
+ }, unknown>;
52
52
  } & {
53
53
  "inferred-tool": import("../server/server.js").ToolDef<{
54
54
  itemId: string;
@@ -58,16 +58,51 @@ export declare function createTestServer(): McpServer<{
58
58
  available: boolean;
59
59
  };
60
60
  fetchedAt: string;
61
+ }, unknown>;
62
+ } & {
63
+ "widget-with-metadata": import("../server/server.js").ToolDef<{
64
+ resourceId: string;
65
+ }, {
66
+ data: {
67
+ id: string;
68
+ loaded: boolean;
69
+ };
70
+ }, {
71
+ requestId: string;
72
+ timestamp: number;
73
+ cached: boolean;
74
+ }>;
75
+ } & {
76
+ "tool-with-metadata": import("../server/server.js").ToolDef<{
77
+ query: string;
78
+ }, {
79
+ results: string[];
80
+ }, {
81
+ executionTime: number;
82
+ source: string;
83
+ }>;
84
+ } & {
85
+ "widget-with-mixed-returns": import("../server/server.js").ToolDef<{
86
+ shouldSucceed: boolean;
87
+ }, {
88
+ error: string;
89
+ data?: undefined;
90
+ } | {
91
+ data: string;
92
+ error?: undefined;
93
+ }, {
94
+ processedAt: number;
95
+ region: string;
61
96
  }>;
62
97
  }>;
63
- export declare function createMinimalTestServer(): McpServer<{
98
+ export declare function createMinimalTestServer(): McpServer<Record<never, import("../server/server.js").ToolDef<unknown, unknown, unknown>> & {
64
99
  "search-voyage": import("../server/server.js").ToolDef<{
65
100
  destination: string;
66
101
  }, {
67
102
  results: {
68
103
  id: string;
69
104
  }[];
70
- }>;
105
+ }, unknown>;
71
106
  }>;
72
107
  /**
73
108
  * Mock extra parameter for resource callback
@@ -1,6 +1,6 @@
1
1
  import { vi } from "vitest";
2
+ import * as z from "zod";
2
3
  import { McpServer } from "../server/server.js";
3
- import { z } from "zod";
4
4
  /**
5
5
  * Creates a real McpServer instance for testing
6
6
  */
@@ -11,17 +11,17 @@ export function createMockMcpServer() {
11
11
  version: "0.0.1",
12
12
  }, { capabilities: {} });
13
13
  // Mock the underlying methods to track calls
14
- const mockResource = vi.spyOn(server, "resource");
14
+ const mockRegisterResource = vi.spyOn(server, "registerResource");
15
15
  const mockRegisterTool = vi.spyOn(server, "registerTool");
16
16
  return {
17
17
  server,
18
- mockResource,
18
+ mockRegisterResource,
19
19
  mockRegisterTool,
20
20
  };
21
21
  }
22
22
  export function createTestServer() {
23
23
  return new McpServer({ name: "test-app", version: "1.0.0" }, {})
24
- .widget("search-voyage", {}, {
24
+ .registerWidget("search-voyage", {}, {
25
25
  description: "Search for voyages",
26
26
  inputSchema: {
27
27
  destination: z.string(),
@@ -45,7 +45,7 @@ export function createTestServer() {
45
45
  },
46
46
  };
47
47
  })
48
- .widget("get-trip-details", {}, {
48
+ .registerWidget("get-trip-details", {}, {
49
49
  description: "Get trip details",
50
50
  inputSchema: {
51
51
  tripId: z.string(),
@@ -65,7 +65,7 @@ export function createTestServer() {
65
65
  },
66
66
  };
67
67
  })
68
- .widget("no-input-widget", {}, {
68
+ .registerWidget("no-input-widget", {}, {
69
69
  description: "Widget with no input",
70
70
  inputSchema: {},
71
71
  outputSchema: {},
@@ -75,7 +75,7 @@ export function createTestServer() {
75
75
  structuredContent: {},
76
76
  };
77
77
  })
78
- .widget("inferred-output-widget", {}, {
78
+ .registerWidget("inferred-output-widget", {}, {
79
79
  description: "Widget with output inferred from callback",
80
80
  inputSchema: {
81
81
  query: z.string(),
@@ -121,10 +121,68 @@ export function createTestServer() {
121
121
  fetchedAt: "2024-01-01",
122
122
  },
123
123
  };
124
+ })
125
+ .registerWidget("widget-with-metadata", {}, {
126
+ description: "Widget that returns response metadata",
127
+ inputSchema: {
128
+ resourceId: z.string(),
129
+ },
130
+ }, async ({ resourceId }) => {
131
+ return {
132
+ content: [{ type: "text", text: `Resource: ${resourceId}` }],
133
+ structuredContent: {
134
+ data: { id: resourceId, loaded: true },
135
+ },
136
+ _meta: {
137
+ requestId: "req-123",
138
+ timestamp: 1704067200000,
139
+ cached: false,
140
+ },
141
+ };
142
+ })
143
+ .registerTool("tool-with-metadata", {
144
+ description: "Tool that returns response metadata",
145
+ inputSchema: {
146
+ query: z.string(),
147
+ },
148
+ }, async ({ query }) => {
149
+ return {
150
+ content: [{ type: "text", text: `Query: ${query}` }],
151
+ structuredContent: {
152
+ results: [query],
153
+ },
154
+ _meta: {
155
+ executionTime: 150,
156
+ source: "cache",
157
+ },
158
+ };
159
+ })
160
+ .registerWidget("widget-with-mixed-returns", {}, {
161
+ description: "Widget with mixed return paths (some with _meta, some without)",
162
+ inputSchema: {
163
+ shouldSucceed: z.boolean(),
164
+ },
165
+ }, async ({ shouldSucceed }) => {
166
+ if (!shouldSucceed) {
167
+ // Error path - no _meta
168
+ return {
169
+ content: [{ type: "text", text: "Error occurred" }],
170
+ structuredContent: { error: "Something went wrong" },
171
+ };
172
+ }
173
+ // Success path - has _meta
174
+ return {
175
+ content: [{ type: "text", text: "Success" }],
176
+ structuredContent: { data: "result" },
177
+ _meta: {
178
+ processedAt: 1704067200000,
179
+ region: "eu-west-1",
180
+ },
181
+ };
124
182
  });
125
183
  }
126
184
  export function createMinimalTestServer() {
127
- return new McpServer({ name: "test-app", version: "1.0.0" }, {}).widget("search-voyage", {}, {
185
+ return new McpServer({ name: "test-app", version: "1.0.0" }, {}).registerWidget("search-voyage", {}, {
128
186
  description: "Search for voyages",
129
187
  inputSchema: {
130
188
  destination: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/test/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAqB,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,UAAU,mBAAmB;IAKjC,mCAAmC;IACnC,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;QACE,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,OAAO;KACjB,EACD,EAAE,YAAY,EAAE,EAAE,EAAE,CACrB,CA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