mcp-use 1.2.5-dev.4 → 1.3.0-canary.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/{chunk-37MPZ3D6.js → chunk-TIUSJAAE.js} +12 -0
- package/dist/{chunk-X2HJQBDI.js → chunk-VNEGDXZO.js} +26 -1
- package/dist/index.cjs +37 -0
- package/dist/index.js +2 -2
- package/dist/src/browser.cjs +12 -0
- package/dist/src/browser.js +1 -1
- package/dist/src/connectors/base.d.ts +11 -0
- package/dist/src/connectors/base.d.ts.map +1 -1
- package/dist/src/react/index.cjs +37 -0
- package/dist/src/react/index.js +2 -2
- package/dist/src/react/types.d.ts +7 -0
- package/dist/src/react/types.d.ts.map +1 -1
- package/dist/src/react/useMcp.d.ts.map +1 -1
- package/dist/src/server/connect-adapter.d.ts +31 -0
- package/dist/src/server/connect-adapter.d.ts.map +1 -0
- package/dist/src/server/index.cjs +358 -139
- package/dist/src/server/index.d.ts +2 -1
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +358 -139
- package/dist/src/server/logging.d.ts.map +1 -1
- package/dist/src/server/mcp-server.d.ts +2 -2
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/tsup.config.d.ts.map +1 -1
- package/package.json +44 -45
|
@@ -42,6 +42,7 @@ var BaseConnector = class {
|
|
|
42
42
|
connectionManager = null;
|
|
43
43
|
toolsCache = null;
|
|
44
44
|
capabilitiesCache = null;
|
|
45
|
+
serverInfoCache = null;
|
|
45
46
|
connected = false;
|
|
46
47
|
opts;
|
|
47
48
|
constructor(opts = {}) {
|
|
@@ -76,6 +77,8 @@ var BaseConnector = class {
|
|
|
76
77
|
logger.debug("Caching server capabilities & tools");
|
|
77
78
|
const capabilities = this.client.getServerCapabilities();
|
|
78
79
|
this.capabilitiesCache = capabilities;
|
|
80
|
+
const serverInfo = this.client.getServerVersion();
|
|
81
|
+
this.serverInfoCache = serverInfo || null;
|
|
79
82
|
const listToolsRes = await this.client.listTools(
|
|
80
83
|
void 0,
|
|
81
84
|
defaultRequestOptions
|
|
@@ -83,6 +86,7 @@ var BaseConnector = class {
|
|
|
83
86
|
this.toolsCache = listToolsRes.tools ?? [];
|
|
84
87
|
logger.debug(`Fetched ${this.toolsCache.length} tools from server`);
|
|
85
88
|
logger.debug("Server capabilities:", capabilities);
|
|
89
|
+
logger.debug("Server info:", serverInfo);
|
|
86
90
|
return capabilities;
|
|
87
91
|
}
|
|
88
92
|
/** Lazily expose the cached tools list. */
|
|
@@ -92,6 +96,14 @@ var BaseConnector = class {
|
|
|
92
96
|
}
|
|
93
97
|
return this.toolsCache;
|
|
94
98
|
}
|
|
99
|
+
/** Expose cached server capabilities. */
|
|
100
|
+
get serverCapabilities() {
|
|
101
|
+
return this.capabilitiesCache;
|
|
102
|
+
}
|
|
103
|
+
/** Expose cached server info. */
|
|
104
|
+
get serverInfo() {
|
|
105
|
+
return this.serverInfoCache;
|
|
106
|
+
}
|
|
95
107
|
/** Call a tool on the server. */
|
|
96
108
|
async callTool(name, args, options) {
|
|
97
109
|
if (!this.client) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BrowserMCPClient,
|
|
3
3
|
BrowserOAuthClientProvider
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TIUSJAAE.js";
|
|
5
5
|
import {
|
|
6
6
|
__name
|
|
7
7
|
} from "./chunk-3GQAWCBQ.js";
|
|
@@ -50,6 +50,8 @@ function useMcp(options) {
|
|
|
50
50
|
const [resources, setResources] = useState([]);
|
|
51
51
|
const [resourceTemplates, setResourceTemplates] = useState([]);
|
|
52
52
|
const [prompts, setPrompts] = useState([]);
|
|
53
|
+
const [serverInfo, setServerInfo] = useState();
|
|
54
|
+
const [capabilities, setCapabilities] = useState();
|
|
53
55
|
const [error, setError] = useState(void 0);
|
|
54
56
|
const [log, setLog] = useState([]);
|
|
55
57
|
const [authUrl, setAuthUrl] = useState(void 0);
|
|
@@ -198,6 +200,17 @@ function useMcp(options) {
|
|
|
198
200
|
const session = await clientRef.current.createSession(serverName);
|
|
199
201
|
await session.initialize();
|
|
200
202
|
addLog("info", "\u2705 Successfully connected to MCP server");
|
|
203
|
+
addLog("info", "Server info:", session.connector.serverInfo);
|
|
204
|
+
addLog(
|
|
205
|
+
"info",
|
|
206
|
+
"Server capabilities:",
|
|
207
|
+
session.connector.serverCapabilities
|
|
208
|
+
);
|
|
209
|
+
console.log("[useMcp] Server info:", session.connector.serverInfo);
|
|
210
|
+
console.log(
|
|
211
|
+
"[useMcp] Server capabilities:",
|
|
212
|
+
session.connector.serverCapabilities
|
|
213
|
+
);
|
|
201
214
|
setState("ready");
|
|
202
215
|
successfulTransportRef.current = transportTypeParam;
|
|
203
216
|
setTools(session.connector.tools || []);
|
|
@@ -205,6 +218,16 @@ function useMcp(options) {
|
|
|
205
218
|
setResources(resourcesResult.resources || []);
|
|
206
219
|
const promptsResult = await session.connector.listPrompts();
|
|
207
220
|
setPrompts(promptsResult.prompts || []);
|
|
221
|
+
const serverInfo2 = session.connector.serverInfo;
|
|
222
|
+
const capabilities2 = session.connector.serverCapabilities;
|
|
223
|
+
if (serverInfo2) {
|
|
224
|
+
console.log("[useMcp] Server info:", serverInfo2);
|
|
225
|
+
setServerInfo(serverInfo2);
|
|
226
|
+
}
|
|
227
|
+
if (capabilities2) {
|
|
228
|
+
console.log("[useMcp] Server capabilities:", capabilities2);
|
|
229
|
+
setCapabilities(capabilities2);
|
|
230
|
+
}
|
|
208
231
|
return "success";
|
|
209
232
|
} catch (err) {
|
|
210
233
|
const errorMessage = err?.message || String(err);
|
|
@@ -567,6 +590,8 @@ function useMcp(options) {
|
|
|
567
590
|
resources,
|
|
568
591
|
resourceTemplates,
|
|
569
592
|
prompts,
|
|
593
|
+
serverInfo,
|
|
594
|
+
capabilities,
|
|
570
595
|
error,
|
|
571
596
|
log,
|
|
572
597
|
authUrl,
|
package/dist/index.cjs
CHANGED
|
@@ -3593,6 +3593,7 @@ var BaseConnector = class {
|
|
|
3593
3593
|
connectionManager = null;
|
|
3594
3594
|
toolsCache = null;
|
|
3595
3595
|
capabilitiesCache = null;
|
|
3596
|
+
serverInfoCache = null;
|
|
3596
3597
|
connected = false;
|
|
3597
3598
|
opts;
|
|
3598
3599
|
constructor(opts = {}) {
|
|
@@ -3627,6 +3628,8 @@ var BaseConnector = class {
|
|
|
3627
3628
|
logger.debug("Caching server capabilities & tools");
|
|
3628
3629
|
const capabilities = this.client.getServerCapabilities();
|
|
3629
3630
|
this.capabilitiesCache = capabilities;
|
|
3631
|
+
const serverInfo = this.client.getServerVersion();
|
|
3632
|
+
this.serverInfoCache = serverInfo || null;
|
|
3630
3633
|
const listToolsRes = await this.client.listTools(
|
|
3631
3634
|
void 0,
|
|
3632
3635
|
defaultRequestOptions
|
|
@@ -3634,6 +3637,7 @@ var BaseConnector = class {
|
|
|
3634
3637
|
this.toolsCache = listToolsRes.tools ?? [];
|
|
3635
3638
|
logger.debug(`Fetched ${this.toolsCache.length} tools from server`);
|
|
3636
3639
|
logger.debug("Server capabilities:", capabilities);
|
|
3640
|
+
logger.debug("Server info:", serverInfo);
|
|
3637
3641
|
return capabilities;
|
|
3638
3642
|
}
|
|
3639
3643
|
/** Lazily expose the cached tools list. */
|
|
@@ -3643,6 +3647,14 @@ var BaseConnector = class {
|
|
|
3643
3647
|
}
|
|
3644
3648
|
return this.toolsCache;
|
|
3645
3649
|
}
|
|
3650
|
+
/** Expose cached server capabilities. */
|
|
3651
|
+
get serverCapabilities() {
|
|
3652
|
+
return this.capabilitiesCache;
|
|
3653
|
+
}
|
|
3654
|
+
/** Expose cached server info. */
|
|
3655
|
+
get serverInfo() {
|
|
3656
|
+
return this.serverInfoCache;
|
|
3657
|
+
}
|
|
3646
3658
|
/** Call a tool on the server. */
|
|
3647
3659
|
async callTool(name, args, options) {
|
|
3648
3660
|
if (!this.client) {
|
|
@@ -5330,6 +5342,8 @@ function useMcp(options) {
|
|
|
5330
5342
|
const [resources, setResources] = (0, import_react.useState)([]);
|
|
5331
5343
|
const [resourceTemplates, setResourceTemplates] = (0, import_react.useState)([]);
|
|
5332
5344
|
const [prompts, setPrompts] = (0, import_react.useState)([]);
|
|
5345
|
+
const [serverInfo, setServerInfo] = (0, import_react.useState)();
|
|
5346
|
+
const [capabilities, setCapabilities] = (0, import_react.useState)();
|
|
5333
5347
|
const [error, setError] = (0, import_react.useState)(void 0);
|
|
5334
5348
|
const [log, setLog] = (0, import_react.useState)([]);
|
|
5335
5349
|
const [authUrl, setAuthUrl] = (0, import_react.useState)(void 0);
|
|
@@ -5478,6 +5492,17 @@ function useMcp(options) {
|
|
|
5478
5492
|
const session = await clientRef.current.createSession(serverName);
|
|
5479
5493
|
await session.initialize();
|
|
5480
5494
|
addLog("info", "\u2705 Successfully connected to MCP server");
|
|
5495
|
+
addLog("info", "Server info:", session.connector.serverInfo);
|
|
5496
|
+
addLog(
|
|
5497
|
+
"info",
|
|
5498
|
+
"Server capabilities:",
|
|
5499
|
+
session.connector.serverCapabilities
|
|
5500
|
+
);
|
|
5501
|
+
console.log("[useMcp] Server info:", session.connector.serverInfo);
|
|
5502
|
+
console.log(
|
|
5503
|
+
"[useMcp] Server capabilities:",
|
|
5504
|
+
session.connector.serverCapabilities
|
|
5505
|
+
);
|
|
5481
5506
|
setState("ready");
|
|
5482
5507
|
successfulTransportRef.current = transportTypeParam;
|
|
5483
5508
|
setTools(session.connector.tools || []);
|
|
@@ -5485,6 +5510,16 @@ function useMcp(options) {
|
|
|
5485
5510
|
setResources(resourcesResult.resources || []);
|
|
5486
5511
|
const promptsResult = await session.connector.listPrompts();
|
|
5487
5512
|
setPrompts(promptsResult.prompts || []);
|
|
5513
|
+
const serverInfo2 = session.connector.serverInfo;
|
|
5514
|
+
const capabilities2 = session.connector.serverCapabilities;
|
|
5515
|
+
if (serverInfo2) {
|
|
5516
|
+
console.log("[useMcp] Server info:", serverInfo2);
|
|
5517
|
+
setServerInfo(serverInfo2);
|
|
5518
|
+
}
|
|
5519
|
+
if (capabilities2) {
|
|
5520
|
+
console.log("[useMcp] Server capabilities:", capabilities2);
|
|
5521
|
+
setCapabilities(capabilities2);
|
|
5522
|
+
}
|
|
5488
5523
|
return "success";
|
|
5489
5524
|
} catch (err) {
|
|
5490
5525
|
const errorMessage = err?.message || String(err);
|
|
@@ -5847,6 +5882,8 @@ function useMcp(options) {
|
|
|
5847
5882
|
resources,
|
|
5848
5883
|
resourceTemplates,
|
|
5849
5884
|
prompts,
|
|
5885
|
+
serverInfo,
|
|
5886
|
+
capabilities,
|
|
5850
5887
|
error,
|
|
5851
5888
|
log,
|
|
5852
5889
|
authUrl,
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
useWidgetProps,
|
|
25
25
|
useWidgetState,
|
|
26
26
|
useWidgetTheme
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-VNEGDXZO.js";
|
|
28
28
|
import {
|
|
29
29
|
BaseConnector,
|
|
30
30
|
BaseMCPClient,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
MCPSession,
|
|
35
35
|
WebSocketConnector,
|
|
36
36
|
onMcpAuthorization
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-TIUSJAAE.js";
|
|
38
38
|
import "./chunk-YURRUCIM.js";
|
|
39
39
|
import {
|
|
40
40
|
Logger,
|
package/dist/src/browser.cjs
CHANGED
|
@@ -814,6 +814,7 @@ var BaseConnector = class {
|
|
|
814
814
|
connectionManager = null;
|
|
815
815
|
toolsCache = null;
|
|
816
816
|
capabilitiesCache = null;
|
|
817
|
+
serverInfoCache = null;
|
|
817
818
|
connected = false;
|
|
818
819
|
opts;
|
|
819
820
|
constructor(opts = {}) {
|
|
@@ -848,6 +849,8 @@ var BaseConnector = class {
|
|
|
848
849
|
logger.debug("Caching server capabilities & tools");
|
|
849
850
|
const capabilities = this.client.getServerCapabilities();
|
|
850
851
|
this.capabilitiesCache = capabilities;
|
|
852
|
+
const serverInfo = this.client.getServerVersion();
|
|
853
|
+
this.serverInfoCache = serverInfo || null;
|
|
851
854
|
const listToolsRes = await this.client.listTools(
|
|
852
855
|
void 0,
|
|
853
856
|
defaultRequestOptions
|
|
@@ -855,6 +858,7 @@ var BaseConnector = class {
|
|
|
855
858
|
this.toolsCache = listToolsRes.tools ?? [];
|
|
856
859
|
logger.debug(`Fetched ${this.toolsCache.length} tools from server`);
|
|
857
860
|
logger.debug("Server capabilities:", capabilities);
|
|
861
|
+
logger.debug("Server info:", serverInfo);
|
|
858
862
|
return capabilities;
|
|
859
863
|
}
|
|
860
864
|
/** Lazily expose the cached tools list. */
|
|
@@ -864,6 +868,14 @@ var BaseConnector = class {
|
|
|
864
868
|
}
|
|
865
869
|
return this.toolsCache;
|
|
866
870
|
}
|
|
871
|
+
/** Expose cached server capabilities. */
|
|
872
|
+
get serverCapabilities() {
|
|
873
|
+
return this.capabilitiesCache;
|
|
874
|
+
}
|
|
875
|
+
/** Expose cached server info. */
|
|
876
|
+
get serverInfo() {
|
|
877
|
+
return this.serverInfoCache;
|
|
878
|
+
}
|
|
867
879
|
/** Call a tool on the server. */
|
|
868
880
|
async callTool(name, args, options) {
|
|
869
881
|
if (!this.client) {
|
package/dist/src/browser.js
CHANGED
|
@@ -25,6 +25,10 @@ export declare abstract class BaseConnector {
|
|
|
25
25
|
protected connectionManager: ConnectionManager<any> | null;
|
|
26
26
|
protected toolsCache: Tool[] | null;
|
|
27
27
|
protected capabilitiesCache: any;
|
|
28
|
+
protected serverInfoCache: {
|
|
29
|
+
name: string;
|
|
30
|
+
version?: string;
|
|
31
|
+
} | null;
|
|
28
32
|
protected connected: boolean;
|
|
29
33
|
protected readonly opts: ConnectorInitOptions;
|
|
30
34
|
constructor(opts?: ConnectorInitOptions);
|
|
@@ -46,6 +50,13 @@ export declare abstract class BaseConnector {
|
|
|
46
50
|
initialize(defaultRequestOptions?: RequestOptions): Promise<ReturnType<Client["getServerCapabilities"]>>;
|
|
47
51
|
/** Lazily expose the cached tools list. */
|
|
48
52
|
get tools(): Tool[];
|
|
53
|
+
/** Expose cached server capabilities. */
|
|
54
|
+
get serverCapabilities(): any;
|
|
55
|
+
/** Expose cached server info. */
|
|
56
|
+
get serverInfo(): {
|
|
57
|
+
name: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
} | null;
|
|
49
60
|
/** Call a tool on the server. */
|
|
50
61
|
callTool(name: string, args: Record<string, any>, options?: RequestOptions): Promise<CallToolResult>;
|
|
51
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/connectors/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACd,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC;;OAEG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,8BAAsB,aAAa;IACjC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IACvC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAClE,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,CAAQ;IAC3C,SAAS,CAAC,iBAAiB,EAAE,GAAG,CAAQ;IACxC,SAAS,CAAC,SAAS,UAAS;IAC5B,SAAS,CAAC,QAAQ,CAAC,IAAI,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASvD,6CAA6C;IACvC,OAAO,CACX,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAW,EACzC,OAAO,CAAC,EAAE,cAAc;IAc1B;;OAEG;cACa,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAkClD"}
|
package/dist/src/react/index.cjs
CHANGED
|
@@ -542,6 +542,7 @@ var BaseConnector = class {
|
|
|
542
542
|
connectionManager = null;
|
|
543
543
|
toolsCache = null;
|
|
544
544
|
capabilitiesCache = null;
|
|
545
|
+
serverInfoCache = null;
|
|
545
546
|
connected = false;
|
|
546
547
|
opts;
|
|
547
548
|
constructor(opts = {}) {
|
|
@@ -576,6 +577,8 @@ var BaseConnector = class {
|
|
|
576
577
|
logger.debug("Caching server capabilities & tools");
|
|
577
578
|
const capabilities = this.client.getServerCapabilities();
|
|
578
579
|
this.capabilitiesCache = capabilities;
|
|
580
|
+
const serverInfo = this.client.getServerVersion();
|
|
581
|
+
this.serverInfoCache = serverInfo || null;
|
|
579
582
|
const listToolsRes = await this.client.listTools(
|
|
580
583
|
void 0,
|
|
581
584
|
defaultRequestOptions
|
|
@@ -583,6 +586,7 @@ var BaseConnector = class {
|
|
|
583
586
|
this.toolsCache = listToolsRes.tools ?? [];
|
|
584
587
|
logger.debug(`Fetched ${this.toolsCache.length} tools from server`);
|
|
585
588
|
logger.debug("Server capabilities:", capabilities);
|
|
589
|
+
logger.debug("Server info:", serverInfo);
|
|
586
590
|
return capabilities;
|
|
587
591
|
}
|
|
588
592
|
/** Lazily expose the cached tools list. */
|
|
@@ -592,6 +596,14 @@ var BaseConnector = class {
|
|
|
592
596
|
}
|
|
593
597
|
return this.toolsCache;
|
|
594
598
|
}
|
|
599
|
+
/** Expose cached server capabilities. */
|
|
600
|
+
get serverCapabilities() {
|
|
601
|
+
return this.capabilitiesCache;
|
|
602
|
+
}
|
|
603
|
+
/** Expose cached server info. */
|
|
604
|
+
get serverInfo() {
|
|
605
|
+
return this.serverInfoCache;
|
|
606
|
+
}
|
|
595
607
|
/** Call a tool on the server. */
|
|
596
608
|
async callTool(name, args, options) {
|
|
597
609
|
if (!this.client) {
|
|
@@ -1619,6 +1631,8 @@ function useMcp(options) {
|
|
|
1619
1631
|
const [resources, setResources] = (0, import_react.useState)([]);
|
|
1620
1632
|
const [resourceTemplates, setResourceTemplates] = (0, import_react.useState)([]);
|
|
1621
1633
|
const [prompts, setPrompts] = (0, import_react.useState)([]);
|
|
1634
|
+
const [serverInfo, setServerInfo] = (0, import_react.useState)();
|
|
1635
|
+
const [capabilities, setCapabilities] = (0, import_react.useState)();
|
|
1622
1636
|
const [error, setError] = (0, import_react.useState)(void 0);
|
|
1623
1637
|
const [log, setLog] = (0, import_react.useState)([]);
|
|
1624
1638
|
const [authUrl, setAuthUrl] = (0, import_react.useState)(void 0);
|
|
@@ -1767,6 +1781,17 @@ function useMcp(options) {
|
|
|
1767
1781
|
const session = await clientRef.current.createSession(serverName);
|
|
1768
1782
|
await session.initialize();
|
|
1769
1783
|
addLog("info", "\u2705 Successfully connected to MCP server");
|
|
1784
|
+
addLog("info", "Server info:", session.connector.serverInfo);
|
|
1785
|
+
addLog(
|
|
1786
|
+
"info",
|
|
1787
|
+
"Server capabilities:",
|
|
1788
|
+
session.connector.serverCapabilities
|
|
1789
|
+
);
|
|
1790
|
+
console.log("[useMcp] Server info:", session.connector.serverInfo);
|
|
1791
|
+
console.log(
|
|
1792
|
+
"[useMcp] Server capabilities:",
|
|
1793
|
+
session.connector.serverCapabilities
|
|
1794
|
+
);
|
|
1770
1795
|
setState("ready");
|
|
1771
1796
|
successfulTransportRef.current = transportTypeParam;
|
|
1772
1797
|
setTools(session.connector.tools || []);
|
|
@@ -1774,6 +1799,16 @@ function useMcp(options) {
|
|
|
1774
1799
|
setResources(resourcesResult.resources || []);
|
|
1775
1800
|
const promptsResult = await session.connector.listPrompts();
|
|
1776
1801
|
setPrompts(promptsResult.prompts || []);
|
|
1802
|
+
const serverInfo2 = session.connector.serverInfo;
|
|
1803
|
+
const capabilities2 = session.connector.serverCapabilities;
|
|
1804
|
+
if (serverInfo2) {
|
|
1805
|
+
console.log("[useMcp] Server info:", serverInfo2);
|
|
1806
|
+
setServerInfo(serverInfo2);
|
|
1807
|
+
}
|
|
1808
|
+
if (capabilities2) {
|
|
1809
|
+
console.log("[useMcp] Server capabilities:", capabilities2);
|
|
1810
|
+
setCapabilities(capabilities2);
|
|
1811
|
+
}
|
|
1777
1812
|
return "success";
|
|
1778
1813
|
} catch (err) {
|
|
1779
1814
|
const errorMessage = err?.message || String(err);
|
|
@@ -2136,6 +2171,8 @@ function useMcp(options) {
|
|
|
2136
2171
|
resources,
|
|
2137
2172
|
resourceTemplates,
|
|
2138
2173
|
prompts,
|
|
2174
|
+
serverInfo,
|
|
2175
|
+
capabilities,
|
|
2139
2176
|
error,
|
|
2140
2177
|
log,
|
|
2141
2178
|
authUrl,
|
package/dist/src/react/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
useWidgetProps,
|
|
5
5
|
useWidgetState,
|
|
6
6
|
useWidgetTheme
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-VNEGDXZO.js";
|
|
8
8
|
import {
|
|
9
9
|
onMcpAuthorization
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-TIUSJAAE.js";
|
|
11
11
|
import "../../chunk-34R6SIER.js";
|
|
12
12
|
import "../../chunk-3GQAWCBQ.js";
|
|
13
13
|
export {
|
|
@@ -52,6 +52,13 @@ export type UseMcpResult = {
|
|
|
52
52
|
resourceTemplates: ResourceTemplate[];
|
|
53
53
|
/** List of prompts available from the connected MCP server */
|
|
54
54
|
prompts: Prompt[];
|
|
55
|
+
/** Server information from the initialize response */
|
|
56
|
+
serverInfo?: {
|
|
57
|
+
name: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
};
|
|
60
|
+
/** Server capabilities from the initialize response */
|
|
61
|
+
capabilities?: Record<string, any>;
|
|
55
62
|
/**
|
|
56
63
|
* The current state of the MCP connection:
|
|
57
64
|
* - 'discovering': Checking server existence and capabilities (including auth requirements).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,IAAI,EACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,MAAM,aAAa,GAAG;IAC1B,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6HAA6H;IAC7H,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iGAAiG;IACjG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uDAAuD;IACvD,YAAY,CAAC,EAAE;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAA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K,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CA+
|
|
1
|
+
{"version":3,"file":"useMcp.d.ts","sourceRoot":"","sources":["../../../src/react/useMcp.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CA+0B3D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MiddlewareHandler } from "hono";
|
|
2
|
+
/**
|
|
3
|
+
* Detects if a middleware is Express/Connect style or Hono style
|
|
4
|
+
*
|
|
5
|
+
* Express/Connect middleware: (req, res, next) => void or (err, req, res, next) => void
|
|
6
|
+
* Hono middleware: (c, next) => Promise<Response | void> or (c, next) => Response | void
|
|
7
|
+
*
|
|
8
|
+
* @param middleware - The middleware function to check
|
|
9
|
+
* @returns true if it's Express/Connect middleware, false if it's Hono middleware
|
|
10
|
+
*/
|
|
11
|
+
export declare function isExpressMiddleware(middleware: any): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Automatically adapts middleware to work with Hono
|
|
14
|
+
* Detects if the middleware is Express/Connect style and adapts it accordingly
|
|
15
|
+
* If it's already Hono-compatible middleware, returns it as-is
|
|
16
|
+
*
|
|
17
|
+
* @param middleware - The middleware function (Express/Connect or Hono)
|
|
18
|
+
* @param middlewarePath - The path pattern the middleware is mounted at (optional, only used for Express/Connect middleware)
|
|
19
|
+
* @returns A Hono middleware function
|
|
20
|
+
*/
|
|
21
|
+
export declare function adaptMiddleware(middleware: any, middlewarePath?: string): Promise<MiddlewareHandler>;
|
|
22
|
+
/**
|
|
23
|
+
* Adapts Connect/Express middleware to work with Hono
|
|
24
|
+
* Based on @hono/connect approach using node-mocks-http
|
|
25
|
+
*
|
|
26
|
+
* @param connectMiddleware - The Connect middleware handler
|
|
27
|
+
* @param middlewarePath - The path pattern the middleware is mounted at (e.g., "/mcp-use/widgets/*")
|
|
28
|
+
* @returns A Hono middleware function
|
|
29
|
+
*/
|
|
30
|
+
export declare function adaptConnectMiddleware(connectMiddleware: any, middlewarePath: string): Promise<MiddlewareHandler>;
|
|
31
|
+
//# sourceMappingURL=connect-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-adapter.d.ts","sourceRoot":"","sources":["../../../src/server/connect-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,iBAAiB,EAAQ,MAAM,MAAM,CAAC;AAE7D;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,CA0C5D;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,GAAG,EACf,cAAc,GAAE,MAAY,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAQ5B;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,iBAAiB,EAAE,GAAG,EACtB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,iBAAiB,CAAC,CAqJ5B"}
|