mcp-use 1.2.4 → 1.2.5-dev.1

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.
@@ -1,4 +1,4 @@
1
- import type { Request, Response, NextFunction } from "express";
1
+ import type { Context, Next } from "hono";
2
2
  /**
3
3
  * Request logging middleware with timestamp, colored status codes, and MCP method info
4
4
  *
@@ -8,9 +8,8 @@ import type { Request, Response, NextFunction } from "express";
8
8
  * - MCP method name in brackets for POST requests to /mcp
9
9
  * - Color-coded status codes (green 2xx, yellow 3xx, red 4xx, magenta 5xx)
10
10
  *
11
- * @param req - Express request object
12
- * @param res - Express response object
13
- * @param next - Express next function
11
+ * @param c - Hono context object
12
+ * @param next - Hono next function
14
13
  */
15
- export declare function requestLogger(req: Request, res: Response, next: NextFunction): void;
14
+ export declare function requestLogger(c: Context, next: Next): Promise<void>;
16
15
  //# sourceMappingURL=logging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/server/logging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,GACjB,IAAI,CAkCN"}
1
+ {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/server/logging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAuCzE"}
@@ -1,5 +1,5 @@
1
+ import { type Hono as HonoType } from "hono";
1
2
  import type { PromptDefinition, ResourceDefinition, ResourceTemplateDefinition, ServerConfig, ToolDefinition, UIResourceDefinition } from "./types/index.js";
2
- import { type Express } from "express";
3
3
  export declare class McpServer {
4
4
  private server;
5
5
  private config;
@@ -10,14 +10,14 @@ export declare class McpServer {
10
10
  private serverHost;
11
11
  private serverBaseUrl?;
12
12
  /**
13
- * Creates a new MCP server instance with Express integration
13
+ * Creates a new MCP server instance with Hono integration
14
14
  *
15
15
  * Initializes the server with the provided configuration, sets up CORS headers,
16
16
  * configures widget serving routes, and creates a proxy that allows direct
17
- * access to Express methods while preserving MCP server functionality.
17
+ * access to Hono methods while preserving MCP server functionality.
18
18
  *
19
19
  * @param config - Server configuration including name, version, and description
20
- * @returns A proxied McpServer instance that supports both MCP and Express methods
20
+ * @returns A proxied McpServer instance that supports both MCP and Hono methods
21
21
  */
22
22
  constructor(config: ServerConfig);
23
23
  /**
@@ -361,10 +361,10 @@ export declare class McpServer {
361
361
  */
362
362
  private mountMcp;
363
363
  /**
364
- * Start the Express server with MCP endpoints
364
+ * Start the Hono server with MCP endpoints
365
365
  *
366
366
  * Initiates the server startup process by mounting MCP endpoints, configuring
367
- * the inspector UI (if available), and starting the Express server to listen
367
+ * the inspector UI (if available), and starting the server to listen
368
368
  * for incoming connections. This is the main entry point for running the server.
369
369
  *
370
370
  * The server will be accessible at the specified port with MCP endpoints at /mcp
@@ -382,6 +382,38 @@ export declare class McpServer {
382
382
  * ```
383
383
  */
384
384
  listen(port?: number): Promise<void>;
385
+ /**
386
+ * Get the fetch handler for the server after mounting all endpoints
387
+ *
388
+ * This method prepares the server by mounting MCP endpoints, widgets, and inspector
389
+ * (if available), then returns the fetch handler. This is useful for integrating
390
+ * with external server frameworks like Supabase Edge Functions, Cloudflare Workers,
391
+ * or other platforms that handle the server lifecycle themselves.
392
+ *
393
+ * Unlike `listen()`, this method does not start a server - it only prepares the
394
+ * routes and returns the handler function that can be used with external servers.
395
+ *
396
+ * @returns Promise that resolves to the fetch handler function
397
+ *
398
+ * @example
399
+ * ```typescript
400
+ * // For Supabase Edge Functions
401
+ * const server = createMCPServer('my-server');
402
+ * server.tool({ ... });
403
+ * const handler = await server.getHandler();
404
+ * Deno.serve(handler);
405
+ * ```
406
+ *
407
+ * @example
408
+ * ```typescript
409
+ * // For Cloudflare Workers
410
+ * const server = createMCPServer('my-server');
411
+ * server.tool({ ... });
412
+ * const handler = await server.getHandler();
413
+ * export default { fetch: handler };
414
+ * ```
415
+ */
416
+ getHandler(): Promise<(req: Request) => Promise<Response>>;
385
417
  /**
386
418
  * Mount MCP Inspector UI at /inspector
387
419
  *
@@ -408,7 +440,7 @@ export declare class McpServer {
408
440
  /**
409
441
  * Setup default widget serving routes
410
442
  *
411
- * Configures Express routes to serve MCP UI widgets and their static assets.
443
+ * Configures Hono routes to serve MCP UI widgets and their static assets.
412
444
  * Widgets are served from the dist/resources/widgets directory and can
413
445
  * be accessed via HTTP endpoints for embedding in web applications.
414
446
  *
@@ -519,7 +551,7 @@ export declare class McpServer {
519
551
  */
520
552
  private parseTemplateUri;
521
553
  }
522
- export type McpServerInstance = Omit<McpServer, keyof Express> & Express;
554
+ export type McpServerInstance = Omit<McpServer, keyof HonoType> & HonoType;
523
555
  /**
524
556
  * Create a new MCP server instance
525
557
  *
@@ -529,7 +561,7 @@ export type McpServerInstance = Omit<McpServer, keyof Express> & Express;
529
561
  * @param config.description - Server description
530
562
  * @param config.host - Hostname for widget URLs and server endpoints (defaults to 'localhost')
531
563
  * @param config.baseUrl - Full base URL (e.g., 'https://myserver.com') - overrides host:port for widget URLs
532
- * @returns McpServerInstance with both MCP and Express methods
564
+ * @returns McpServerInstance with both MCP and Hono methods
533
565
  *
534
566
  * @example
535
567
  * ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,oBAAoB,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AAI,EAAE,MAAM,EACZ,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM,GACjC,iBAAiB,CASnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"tsup.config.d.ts","sourceRoot":"","sources":["../tsup.config.ts"],"names":[],"mappings":";AAEA,wBA0BG"}
1
+ {"version":3,"file":"tsup.config.d.ts","sourceRoot":"","sources":["../tsup.config.ts"],"names":[],"mappings":";AAEA,wBA+BG"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcp-use",
3
3
  "type": "module",
4
- "version": "1.2.4",
4
+ "version": "1.2.5-dev.1",
5
5
  "description": "Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents and Clients + MCP Servers with support for MCP-UI.",
6
6
  "author": "mcp-use, Inc.",
7
7
  "license": "MIT",
@@ -65,8 +65,6 @@
65
65
  "peerDependencies": {
66
66
  "@langchain/anthropic": "^1.0.0",
67
67
  "@langchain/openai": "^1.0.0",
68
- "cors": "^2.8.5",
69
- "express": "^4.18.2",
70
68
  "langfuse": "^3.38.6",
71
69
  "langfuse-langchain": "^3.38.6",
72
70
  "react": "^18.0.0 || ^19.0.0"
@@ -78,12 +76,6 @@
78
76
  "@langchain/openai": {
79
77
  "optional": true
80
78
  },
81
- "cors": {
82
- "optional": true
83
- },
84
- "express": {
85
- "optional": true
86
- },
87
79
  "langfuse": {
88
80
  "optional": true
89
81
  },
@@ -93,16 +85,16 @@
93
85
  },
94
86
  "dependencies": {
95
87
  "@dmitryrechkin/json-schema-to-zod": "^1.0.1",
88
+ "@hono/node-server": "^1.13.0",
96
89
  "@langchain/core": "^1.0.1",
97
90
  "@mcp-ui/server": "^5.12.0",
98
91
  "@modelcontextprotocol/sdk": "1.20.0",
99
92
  "@scarf/scarf": "^1.4.0",
100
- "@tailwindcss/vite": "^4.1.15",
101
- "@vitejs/plugin-react": "^5.0.4",
102
93
  "ai": "^4.3.19",
103
94
  "commander": "^14.0.1",
104
95
  "dotenv": "^16.5.0",
105
96
  "esbuild": ">=0.25.0",
97
+ "hono": "^4.6.0",
106
98
  "langchain": "^1.0.1",
107
99
  "lodash-es": "^4.17.21",
108
100
  "posthog-node": "^5.1.1",
@@ -110,7 +102,6 @@
110
102
  "ts-node": "^10.9.2",
111
103
  "tsx": "^4.20.6",
112
104
  "uuid": "^11.1.0",
113
- "vite": ">=5.4.21",
114
105
  "winston": "^3.17.0",
115
106
  "winston-transport-browserconsole": "^1.0.5",
116
107
  "ws": "^8.18.2",
@@ -119,6 +110,11 @@
119
110
  "@mcp-use/cli": "2.1.25",
120
111
  "@mcp-use/inspector": "0.4.13"
121
112
  },
113
+ "optionalDependencies": {
114
+ "@tailwindcss/vite": "^4.1.15",
115
+ "@vitejs/plugin-react": "^5.0.4",
116
+ "vite": ">=5.4.21"
117
+ },
122
118
  "devDependencies": {
123
119
  "@antfu/eslint-config": "^4.13.2",
124
120
  "@langchain/anthropic": "^1.0.0",