@mcp-ts/sdk 1.5.3 → 1.6.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.
- package/dist/adapters/agui-adapter.d.mts +2 -2
- package/dist/adapters/agui-adapter.d.ts +2 -2
- package/dist/adapters/agui-adapter.js +69 -18
- package/dist/adapters/agui-adapter.js.map +1 -1
- package/dist/adapters/agui-adapter.mjs +69 -18
- package/dist/adapters/agui-adapter.mjs.map +1 -1
- package/dist/adapters/agui-middleware.d.mts +2 -2
- package/dist/adapters/agui-middleware.d.ts +2 -2
- package/dist/adapters/ai-adapter.d.mts +2 -2
- package/dist/adapters/ai-adapter.d.ts +2 -2
- package/dist/adapters/ai-adapter.js +69 -18
- package/dist/adapters/ai-adapter.js.map +1 -1
- package/dist/adapters/ai-adapter.mjs +69 -18
- package/dist/adapters/ai-adapter.mjs.map +1 -1
- package/dist/adapters/langchain-adapter.d.mts +2 -2
- package/dist/adapters/langchain-adapter.d.ts +2 -2
- package/dist/adapters/langchain-adapter.js +69 -18
- package/dist/adapters/langchain-adapter.js.map +1 -1
- package/dist/adapters/langchain-adapter.mjs +69 -18
- package/dist/adapters/langchain-adapter.mjs.map +1 -1
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/react.d.mts +4 -4
- package/dist/client/react.d.ts +4 -4
- package/dist/client/react.js.map +1 -1
- package/dist/client/react.mjs.map +1 -1
- package/dist/client/vue.d.mts +4 -4
- package/dist/client/vue.d.ts +4 -4
- package/dist/{index-GfC_eNEv.d.ts → index-DhA-OEAe.d.ts} +1 -1
- package/dist/{index-DcYfpY3H.d.mts → index-bFL4ZF2N.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +212 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +212 -45
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +13 -5
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +13 -5
- package/dist/server/index.mjs.map +1 -1
- package/dist/shared/index.d.mts +17 -10
- package/dist/shared/index.d.ts +17 -10
- package/dist/shared/index.js +199 -39
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +199 -40
- package/dist/shared/index.mjs.map +1 -1
- package/dist/{tool-router-DsKhRmJm.d.ts → tool-router-BVaV1udm.d.mts} +57 -8
- package/dist/{tool-router-DK0RJblO.d.mts → tool-router-Dh2804tM.d.ts} +57 -8
- package/dist/{types-CfCoIsWI.d.mts → types-rIuN1CQi.d.mts} +1 -0
- package/dist/{types-CfCoIsWI.d.ts → types-rIuN1CQi.d.ts} +1 -0
- package/package.json +3 -1
- package/src/server/handlers/sse-handler.ts +12 -0
- package/src/server/mcp/oauth-client.ts +10 -6
- package/src/shared/index.ts +4 -0
- package/src/shared/meta-tools.ts +163 -37
- package/src/shared/tool-index.ts +123 -7
- package/src/shared/tool-router.ts +40 -7
- package/src/shared/types.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import { u as ToolClientProvider, T as ToolClient } from './types-
|
|
2
|
+
import { u as ToolClientProvider, T as ToolClient } from './types-rIuN1CQi.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* SchemaCompressor — Utilities for reducing tool schema token overhead.
|
|
@@ -80,6 +80,39 @@ interface ToolSummary {
|
|
|
80
80
|
/** Estimated token cost of the full inputSchema */
|
|
81
81
|
estimatedTokens: number;
|
|
82
82
|
}
|
|
83
|
+
/** Server-level summary derived from indexed tools. */
|
|
84
|
+
interface ToolServerSummary {
|
|
85
|
+
/** Human-readable server name */
|
|
86
|
+
serverName: string;
|
|
87
|
+
/** Stable server identifier */
|
|
88
|
+
serverId: string;
|
|
89
|
+
/** Session the server belongs to */
|
|
90
|
+
sessionId: string;
|
|
91
|
+
/** Number of indexed tools for this server */
|
|
92
|
+
toolCount: number;
|
|
93
|
+
}
|
|
94
|
+
/** Optional filters for search and listing. */
|
|
95
|
+
interface ToolSearchOptions {
|
|
96
|
+
/** Restrict results to this server ID. */
|
|
97
|
+
serverId?: string;
|
|
98
|
+
/** Restrict results to servers whose name or ID matches this value. */
|
|
99
|
+
serverName?: string;
|
|
100
|
+
}
|
|
101
|
+
/** Paginated tool listing result. */
|
|
102
|
+
interface ToolListResult {
|
|
103
|
+
tools: ToolSummary[];
|
|
104
|
+
totalCount: number;
|
|
105
|
+
returnedCount: number;
|
|
106
|
+
nextCursor?: string;
|
|
107
|
+
servers: ToolServerSummary[];
|
|
108
|
+
}
|
|
109
|
+
interface ToolLookupOptions {
|
|
110
|
+
/**
|
|
111
|
+
* Allow namespace to match a fragment of serverName after exact
|
|
112
|
+
* sessionId/serverId matching fails.
|
|
113
|
+
*/
|
|
114
|
+
allowServerNameFragment?: boolean;
|
|
115
|
+
}
|
|
83
116
|
/** A tool with routing metadata attached during indexing. */
|
|
84
117
|
interface IndexedTool extends Tool {
|
|
85
118
|
sessionId: string;
|
|
@@ -147,7 +180,7 @@ declare class ToolIndex {
|
|
|
147
180
|
*
|
|
148
181
|
* `score = keywordWeight × keyword_score + (1 - keywordWeight) × cosine_score`
|
|
149
182
|
*/
|
|
150
|
-
search(query: string, topK?: number): Promise<ToolSummary[]>;
|
|
183
|
+
search(query: string, topK?: number, options?: ToolSearchOptions): Promise<ToolSummary[]>;
|
|
151
184
|
/**
|
|
152
185
|
* Search tools using a regex pattern.
|
|
153
186
|
* Matches against name, description, and parameter metadata.
|
|
@@ -155,11 +188,19 @@ declare class ToolIndex {
|
|
|
155
188
|
searchRegex(pattern: string, topK?: number): ToolSummary[];
|
|
156
189
|
/**
|
|
157
190
|
* Get tool definition(s) by name.
|
|
158
|
-
* If namespace is provided,
|
|
191
|
+
* If namespace is provided, exact sessionId/serverId matches take precedence.
|
|
192
|
+
* Falls back to serverName fragment matching only when explicitly allowed.
|
|
159
193
|
*/
|
|
160
|
-
getTool(name: string, namespace?: string): IndexedTool[];
|
|
194
|
+
getTool(name: string, namespace?: string, options?: ToolLookupOptions): IndexedTool[];
|
|
161
195
|
/** All indexed tool names. */
|
|
162
196
|
getToolNames(): string[];
|
|
197
|
+
/** List indexed servers with tool counts. */
|
|
198
|
+
listServers(options?: ToolSearchOptions): ToolServerSummary[];
|
|
199
|
+
/** List tools deterministically, optionally scoped to a server. */
|
|
200
|
+
listTools(options?: ToolSearchOptions & {
|
|
201
|
+
limit?: number;
|
|
202
|
+
cursor?: string;
|
|
203
|
+
}): ToolListResult;
|
|
163
204
|
/** Number of indexed tools (including duplicates). */
|
|
164
205
|
get size(): number;
|
|
165
206
|
/** Total estimated token cost of all indexed tool schemas. */
|
|
@@ -174,6 +215,7 @@ declare class ToolIndex {
|
|
|
174
215
|
/** Build a single searchable string from tool metadata. */
|
|
175
216
|
private buildSearchableText;
|
|
176
217
|
private getDocumentKey;
|
|
218
|
+
private matchesServer;
|
|
177
219
|
/** Simple whitespace + camelCase + snake_case tokenizer. */
|
|
178
220
|
private tokenize;
|
|
179
221
|
/** Cosine similarity between two vectors. */
|
|
@@ -262,7 +304,7 @@ declare class ToolRouter {
|
|
|
262
304
|
* This is the main method adapters should call.
|
|
263
305
|
*
|
|
264
306
|
* - `all` → returns all tools (unchanged behavior)
|
|
265
|
-
* - `search` → returns only meta-tools (
|
|
307
|
+
* - `search` → returns only meta-tools (mcp_search_tools, mcp_get_tool_schema, mcp_execute_tool)
|
|
266
308
|
* - `groups` → returns tools from active groups only
|
|
267
309
|
*/
|
|
268
310
|
getFilteredTools(): Promise<Tool[]>;
|
|
@@ -270,17 +312,24 @@ declare class ToolRouter {
|
|
|
270
312
|
* Search tools by natural-language query.
|
|
271
313
|
* Works regardless of strategy.
|
|
272
314
|
*/
|
|
273
|
-
searchTools(query: string, topK?: number): Promise<ToolSummary[]>;
|
|
315
|
+
searchTools(query: string, topK?: number, options?: ToolSearchOptions): Promise<ToolSummary[]>;
|
|
274
316
|
/**
|
|
275
317
|
* Search tools by regex pattern.
|
|
276
318
|
* Matches against name, description, and parameter metadata.
|
|
277
319
|
*/
|
|
278
320
|
searchToolsRegex(pattern: string, topK?: number): Promise<ToolSummary[]>;
|
|
321
|
+
/** List connected MCP servers with indexed tool counts. */
|
|
322
|
+
listServers(options?: ToolSearchOptions): Promise<ToolServerSummary[]>;
|
|
323
|
+
/** List tools deterministically, optionally scoped to a server. */
|
|
324
|
+
listTools(options?: ToolSearchOptions & {
|
|
325
|
+
limit?: number;
|
|
326
|
+
cursor?: string;
|
|
327
|
+
}): Promise<ToolListResult>;
|
|
279
328
|
/**
|
|
280
329
|
* Get the full tool definition by name.
|
|
281
330
|
* If tool name is ambiguous, use namespace to specify the server.
|
|
282
331
|
*/
|
|
283
|
-
getToolSchema(toolName: string, namespace?: string): IndexedTool | undefined;
|
|
332
|
+
getToolSchema(toolName: string, namespace?: string, options?: ToolLookupOptions): IndexedTool | undefined;
|
|
284
333
|
/**
|
|
285
334
|
* Get compact (schema-less) summaries for all tools.
|
|
286
335
|
*/
|
|
@@ -325,4 +374,4 @@ declare class ToolRouter {
|
|
|
325
374
|
private getMetaToolDefinitions;
|
|
326
375
|
}
|
|
327
376
|
|
|
328
|
-
export { type CompactTool as C, type EmbedFn as E, type IndexedTool as I, SchemaCompressor as S, type ToolGroupInfo as T, type CompressionStats as a, ToolIndex as b, type ToolIndexOptions as c,
|
|
377
|
+
export { type CompactTool as C, type EmbedFn as E, type IndexedTool as I, SchemaCompressor as S, type ToolGroupInfo as T, type CompressionStats as a, ToolIndex as b, type ToolIndexOptions as c, type ToolListResult as d, ToolRouter as e, type ToolRouterClientInput as f, type ToolRouterOptions as g, type ToolRouterStrategy as h, type ToolSearchOptions as i, type ToolServerSummary as j, type ToolSummary as k };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import { u as ToolClientProvider, T as ToolClient } from './types-
|
|
2
|
+
import { u as ToolClientProvider, T as ToolClient } from './types-rIuN1CQi.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* SchemaCompressor — Utilities for reducing tool schema token overhead.
|
|
@@ -80,6 +80,39 @@ interface ToolSummary {
|
|
|
80
80
|
/** Estimated token cost of the full inputSchema */
|
|
81
81
|
estimatedTokens: number;
|
|
82
82
|
}
|
|
83
|
+
/** Server-level summary derived from indexed tools. */
|
|
84
|
+
interface ToolServerSummary {
|
|
85
|
+
/** Human-readable server name */
|
|
86
|
+
serverName: string;
|
|
87
|
+
/** Stable server identifier */
|
|
88
|
+
serverId: string;
|
|
89
|
+
/** Session the server belongs to */
|
|
90
|
+
sessionId: string;
|
|
91
|
+
/** Number of indexed tools for this server */
|
|
92
|
+
toolCount: number;
|
|
93
|
+
}
|
|
94
|
+
/** Optional filters for search and listing. */
|
|
95
|
+
interface ToolSearchOptions {
|
|
96
|
+
/** Restrict results to this server ID. */
|
|
97
|
+
serverId?: string;
|
|
98
|
+
/** Restrict results to servers whose name or ID matches this value. */
|
|
99
|
+
serverName?: string;
|
|
100
|
+
}
|
|
101
|
+
/** Paginated tool listing result. */
|
|
102
|
+
interface ToolListResult {
|
|
103
|
+
tools: ToolSummary[];
|
|
104
|
+
totalCount: number;
|
|
105
|
+
returnedCount: number;
|
|
106
|
+
nextCursor?: string;
|
|
107
|
+
servers: ToolServerSummary[];
|
|
108
|
+
}
|
|
109
|
+
interface ToolLookupOptions {
|
|
110
|
+
/**
|
|
111
|
+
* Allow namespace to match a fragment of serverName after exact
|
|
112
|
+
* sessionId/serverId matching fails.
|
|
113
|
+
*/
|
|
114
|
+
allowServerNameFragment?: boolean;
|
|
115
|
+
}
|
|
83
116
|
/** A tool with routing metadata attached during indexing. */
|
|
84
117
|
interface IndexedTool extends Tool {
|
|
85
118
|
sessionId: string;
|
|
@@ -147,7 +180,7 @@ declare class ToolIndex {
|
|
|
147
180
|
*
|
|
148
181
|
* `score = keywordWeight × keyword_score + (1 - keywordWeight) × cosine_score`
|
|
149
182
|
*/
|
|
150
|
-
search(query: string, topK?: number): Promise<ToolSummary[]>;
|
|
183
|
+
search(query: string, topK?: number, options?: ToolSearchOptions): Promise<ToolSummary[]>;
|
|
151
184
|
/**
|
|
152
185
|
* Search tools using a regex pattern.
|
|
153
186
|
* Matches against name, description, and parameter metadata.
|
|
@@ -155,11 +188,19 @@ declare class ToolIndex {
|
|
|
155
188
|
searchRegex(pattern: string, topK?: number): ToolSummary[];
|
|
156
189
|
/**
|
|
157
190
|
* Get tool definition(s) by name.
|
|
158
|
-
* If namespace is provided,
|
|
191
|
+
* If namespace is provided, exact sessionId/serverId matches take precedence.
|
|
192
|
+
* Falls back to serverName fragment matching only when explicitly allowed.
|
|
159
193
|
*/
|
|
160
|
-
getTool(name: string, namespace?: string): IndexedTool[];
|
|
194
|
+
getTool(name: string, namespace?: string, options?: ToolLookupOptions): IndexedTool[];
|
|
161
195
|
/** All indexed tool names. */
|
|
162
196
|
getToolNames(): string[];
|
|
197
|
+
/** List indexed servers with tool counts. */
|
|
198
|
+
listServers(options?: ToolSearchOptions): ToolServerSummary[];
|
|
199
|
+
/** List tools deterministically, optionally scoped to a server. */
|
|
200
|
+
listTools(options?: ToolSearchOptions & {
|
|
201
|
+
limit?: number;
|
|
202
|
+
cursor?: string;
|
|
203
|
+
}): ToolListResult;
|
|
163
204
|
/** Number of indexed tools (including duplicates). */
|
|
164
205
|
get size(): number;
|
|
165
206
|
/** Total estimated token cost of all indexed tool schemas. */
|
|
@@ -174,6 +215,7 @@ declare class ToolIndex {
|
|
|
174
215
|
/** Build a single searchable string from tool metadata. */
|
|
175
216
|
private buildSearchableText;
|
|
176
217
|
private getDocumentKey;
|
|
218
|
+
private matchesServer;
|
|
177
219
|
/** Simple whitespace + camelCase + snake_case tokenizer. */
|
|
178
220
|
private tokenize;
|
|
179
221
|
/** Cosine similarity between two vectors. */
|
|
@@ -262,7 +304,7 @@ declare class ToolRouter {
|
|
|
262
304
|
* This is the main method adapters should call.
|
|
263
305
|
*
|
|
264
306
|
* - `all` → returns all tools (unchanged behavior)
|
|
265
|
-
* - `search` → returns only meta-tools (
|
|
307
|
+
* - `search` → returns only meta-tools (mcp_search_tools, mcp_get_tool_schema, mcp_execute_tool)
|
|
266
308
|
* - `groups` → returns tools from active groups only
|
|
267
309
|
*/
|
|
268
310
|
getFilteredTools(): Promise<Tool[]>;
|
|
@@ -270,17 +312,24 @@ declare class ToolRouter {
|
|
|
270
312
|
* Search tools by natural-language query.
|
|
271
313
|
* Works regardless of strategy.
|
|
272
314
|
*/
|
|
273
|
-
searchTools(query: string, topK?: number): Promise<ToolSummary[]>;
|
|
315
|
+
searchTools(query: string, topK?: number, options?: ToolSearchOptions): Promise<ToolSummary[]>;
|
|
274
316
|
/**
|
|
275
317
|
* Search tools by regex pattern.
|
|
276
318
|
* Matches against name, description, and parameter metadata.
|
|
277
319
|
*/
|
|
278
320
|
searchToolsRegex(pattern: string, topK?: number): Promise<ToolSummary[]>;
|
|
321
|
+
/** List connected MCP servers with indexed tool counts. */
|
|
322
|
+
listServers(options?: ToolSearchOptions): Promise<ToolServerSummary[]>;
|
|
323
|
+
/** List tools deterministically, optionally scoped to a server. */
|
|
324
|
+
listTools(options?: ToolSearchOptions & {
|
|
325
|
+
limit?: number;
|
|
326
|
+
cursor?: string;
|
|
327
|
+
}): Promise<ToolListResult>;
|
|
279
328
|
/**
|
|
280
329
|
* Get the full tool definition by name.
|
|
281
330
|
* If tool name is ambiguous, use namespace to specify the server.
|
|
282
331
|
*/
|
|
283
|
-
getToolSchema(toolName: string, namespace?: string): IndexedTool | undefined;
|
|
332
|
+
getToolSchema(toolName: string, namespace?: string, options?: ToolLookupOptions): IndexedTool | undefined;
|
|
284
333
|
/**
|
|
285
334
|
* Get compact (schema-less) summaries for all tools.
|
|
286
335
|
*/
|
|
@@ -325,4 +374,4 @@ declare class ToolRouter {
|
|
|
325
374
|
private getMetaToolDefinitions;
|
|
326
375
|
}
|
|
327
376
|
|
|
328
|
-
export { type CompactTool as C, type EmbedFn as E, type IndexedTool as I, SchemaCompressor as S, type ToolGroupInfo as T, type CompressionStats as a, ToolIndex as b, type ToolIndexOptions as c,
|
|
377
|
+
export { type CompactTool as C, type EmbedFn as E, type IndexedTool as I, SchemaCompressor as S, type ToolGroupInfo as T, type CompressionStats as a, ToolIndex as b, type ToolIndexOptions as c, type ToolListResult as d, ToolRouter as e, type ToolRouterClientInput as f, type ToolRouterOptions as g, type ToolRouterStrategy as h, type ToolSearchOptions as i, type ToolServerSummary as j, type ToolSummary as k };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-ts/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -84,6 +84,8 @@
|
|
|
84
84
|
"test": "npx playwright test",
|
|
85
85
|
"test:ui": "npx playwright test --ui",
|
|
86
86
|
"test:debug": "npx playwright test --debug",
|
|
87
|
+
"benchmark:toolrouter": "npm run build && node benchmarks/toolrouter-efficiency.mjs",
|
|
88
|
+
"benchmark:toolrouter:live": "npm run build && node benchmarks/toolrouter-live.mjs",
|
|
87
89
|
"supabase:push": "supabase db push",
|
|
88
90
|
"supabase:reset": "supabase db reset",
|
|
89
91
|
"supabase:status": "supabase status",
|
|
@@ -73,6 +73,16 @@ export interface SSEHandlerOptions {
|
|
|
73
73
|
|
|
74
74
|
const DEFAULT_HEARTBEAT_INTERVAL = 30000;
|
|
75
75
|
|
|
76
|
+
function normalizeHeaders(headers?: Record<string, string>): Record<string, string> | undefined {
|
|
77
|
+
if (!headers || typeof headers !== 'object') return undefined;
|
|
78
|
+
|
|
79
|
+
const entries = Object.entries(headers)
|
|
80
|
+
.map(([key, value]) => [key.trim(), String(value).trim()] as const)
|
|
81
|
+
.filter(([key, value]) => key.length > 0 && value.length > 0);
|
|
82
|
+
|
|
83
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
76
86
|
// ============================================
|
|
77
87
|
// SSEConnectionManager Class
|
|
78
88
|
// ============================================
|
|
@@ -238,6 +248,7 @@ export class SSEConnectionManager {
|
|
|
238
248
|
*/
|
|
239
249
|
private async connect(params: ConnectParams): Promise<ConnectResult> {
|
|
240
250
|
const { serverName, serverUrl, callbackUrl, transportType } = params;
|
|
251
|
+
const headers = normalizeHeaders(params.headers);
|
|
241
252
|
|
|
242
253
|
// Normalize serverId to max 12 chars to keep tool names under 64 chars (DeepSeek/OpenAI limits)
|
|
243
254
|
// Tool name format: tool_<serverId>_<toolName> - with 12 char serverId leaves 46 chars for tool name
|
|
@@ -280,6 +291,7 @@ export class SSEConnectionManager {
|
|
|
280
291
|
serverUrl,
|
|
281
292
|
callbackUrl,
|
|
282
293
|
transportType,
|
|
294
|
+
headers,
|
|
283
295
|
...clientMetadata, // Spread client metadata (clientName, clientUri, logoUri, policyUri)
|
|
284
296
|
});
|
|
285
297
|
|
|
@@ -238,9 +238,11 @@ export class MCPClient {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
const baseUrl = new URL(this.serverUrl);
|
|
241
|
+
const hasAuthorizationHeader = Object.keys(this.headers || {})
|
|
242
|
+
.some((key) => key.toLowerCase() === 'authorization');
|
|
241
243
|
const transportOptions = {
|
|
242
|
-
authProvider: this.oauthProvider
|
|
243
|
-
...(this.headers && { headers: this.headers }),
|
|
244
|
+
...(!hasAuthorizationHeader && { authProvider: this.oauthProvider! }),
|
|
245
|
+
...(this.headers && { requestInit: { headers: this.headers } }),
|
|
244
246
|
/**
|
|
245
247
|
* Custom fetch implementation to handle connection timeouts.
|
|
246
248
|
* Observation: SDK 1.24.0+ connections may hang indefinitely in some environments.
|
|
@@ -359,6 +361,7 @@ export class MCPClient {
|
|
|
359
361
|
serverUrl: this.serverUrl,
|
|
360
362
|
callbackUrl: this.callbackUrl,
|
|
361
363
|
transportType: this.transportType || 'streamable_http',
|
|
364
|
+
headers: this.headers,
|
|
362
365
|
createdAt: this.createdAt,
|
|
363
366
|
active: false,
|
|
364
367
|
}, Math.floor(STATE_EXPIRATION_MS / 1000)); // Short TTL until connection succeeds
|
|
@@ -388,6 +391,7 @@ export class MCPClient {
|
|
|
388
391
|
serverUrl: this.serverUrl,
|
|
389
392
|
callbackUrl: this.callbackUrl,
|
|
390
393
|
transportType: (this.transportType || 'streamable_http') as TransportType,
|
|
394
|
+
headers: this.headers,
|
|
391
395
|
createdAt: this.createdAt || Date.now(),
|
|
392
396
|
active,
|
|
393
397
|
};
|
|
@@ -1126,9 +1130,10 @@ export class MCPClient {
|
|
|
1126
1130
|
* @returns Server name or undefined
|
|
1127
1131
|
*/
|
|
1128
1132
|
getServerName(): string | undefined {
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
return info?.title ?? info?.name ?? this.serverName;
|
|
1133
|
+
// Temporarily avoid deriving serverName from serverVersion metadata.
|
|
1134
|
+
// const info = (this.client as any)?.getServerVersion();
|
|
1135
|
+
// return info?.title ?? info?.name ?? this.serverName;
|
|
1136
|
+
return this.serverName;
|
|
1132
1137
|
}
|
|
1133
1138
|
|
|
1134
1139
|
/**
|
|
@@ -1228,4 +1233,3 @@ export class MCPClient {
|
|
|
1228
1233
|
}
|
|
1229
1234
|
|
|
1230
1235
|
}
|
|
1231
|
-
|
package/src/shared/index.ts
CHANGED
|
@@ -87,6 +87,9 @@ export {
|
|
|
87
87
|
export {
|
|
88
88
|
ToolIndex,
|
|
89
89
|
type ToolSummary,
|
|
90
|
+
type ToolServerSummary,
|
|
91
|
+
type ToolSearchOptions,
|
|
92
|
+
type ToolListResult,
|
|
90
93
|
type IndexedTool,
|
|
91
94
|
type ToolIndexOptions,
|
|
92
95
|
type EmbedFn,
|
|
@@ -100,6 +103,7 @@ export {
|
|
|
100
103
|
|
|
101
104
|
export {
|
|
102
105
|
createSearchToolDefinition,
|
|
106
|
+
createListServersToolDefinition,
|
|
103
107
|
createRegexSearchToolDefinition,
|
|
104
108
|
createGetSchemaToolDefinition,
|
|
105
109
|
createExecuteToolDefinition,
|