mcp-use 1.2.4-canary.1 → 1.2.5-dev.0
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/index.cjs +0 -38
- package/dist/src/agents/index.cjs +0 -6
- package/dist/src/browser.cjs +0 -20
- package/dist/src/react/index.cjs +0 -9
- package/dist/src/server/index.cjs +525 -152
- package/dist/src/server/index.js +523 -141
- package/dist/src/server/logging.d.ts +4 -5
- package/dist/src/server/logging.d.ts.map +1 -1
- package/dist/src/server/mcp-server.d.ts +41 -9
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/tsup.config.d.ts.map +1 -1
- package/package.json +5 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
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
|
|
12
|
-
* @param
|
|
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(
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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":"
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,IAAI,IAAI,QAAQ,EAAa,MAAM,MAAM,CAAC;AAQ5E,OAAO,KAAK,EAEV,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EAEd,oBAAoB,EAErB,MAAM,kBAAkB,CAAC;AAmG1B,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,GAAG,CAAW;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3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7B;;;;;;;;;;;OAWG;YACW,sBAAsB;IA8KpC;;;;;;;;;;;;;;;;;;;OAmBG;YACW,QAAQ;IAsOtB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqD1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,UAAU,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAgBhE;;;;;;;;;;;;;;;;;;;;;OAqBG;YACW,cAAc;IAgC5B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,iBAAiB;IAsHzB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,kBAAkB;IA+C1B;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,sBAAsB;IAqC9B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,qBAAqB;IAK7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,gBAAgB;CA4BzB;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,eAAe,CAC7B,IAAI,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,
|
|
1
|
+
{"version":3,"file":"tsup.config.d.ts","sourceRoot":"","sources":["../tsup.config.ts"],"names":[],"mappings":";AAEA,wBA8BG"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-use",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.5-dev.0",
|
|
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,6 +85,7 @@
|
|
|
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",
|
|
@@ -103,6 +96,7 @@
|
|
|
103
96
|
"commander": "^14.0.1",
|
|
104
97
|
"dotenv": "^16.5.0",
|
|
105
98
|
"esbuild": ">=0.25.0",
|
|
99
|
+
"hono": "^4.6.0",
|
|
106
100
|
"langchain": "^1.0.1",
|
|
107
101
|
"lodash-es": "^4.17.21",
|
|
108
102
|
"posthog-node": "^5.1.1",
|
|
@@ -116,8 +110,8 @@
|
|
|
116
110
|
"ws": "^8.18.2",
|
|
117
111
|
"zod": "^3.25.48",
|
|
118
112
|
"zod-to-json-schema": "^3.24.6",
|
|
119
|
-
"@mcp-use/cli": "2.1.25
|
|
120
|
-
"@mcp-use/inspector": "0.4.13
|
|
113
|
+
"@mcp-use/cli": "2.1.25",
|
|
114
|
+
"@mcp-use/inspector": "0.4.13"
|
|
121
115
|
},
|
|
122
116
|
"devDependencies": {
|
|
123
117
|
"@antfu/eslint-config": "^4.13.2",
|