@mcp-ts/sdk 2.3.1 → 2.3.3
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 +1 -1
- package/dist/adapters/agui-adapter.d.ts +1 -1
- package/dist/adapters/agui-middleware.d.mts +1 -1
- package/dist/adapters/agui-middleware.d.ts +1 -1
- package/dist/adapters/ai-adapter.d.mts +1 -1
- package/dist/adapters/ai-adapter.d.ts +1 -1
- package/dist/adapters/langchain-adapter.d.mts +1 -1
- package/dist/adapters/langchain-adapter.d.ts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -1
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.js +15 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +15 -0
- package/dist/server/index.mjs.map +1 -1
- package/dist/shared/index.d.mts +2 -2
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +18 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +18 -1
- package/dist/shared/index.mjs.map +1 -1
- package/dist/{tool-router-CP7qLk1J.d.ts → tool-router-BMzhoNYt.d.ts} +2 -0
- package/dist/{tool-router-BfE_9tay.d.mts → tool-router-BhHsvBfP.d.mts} +2 -0
- package/package.json +1 -1
- package/src/server/mcp/oauth-client.ts +22 -0
- package/src/shared/tool-router.ts +32 -1
package/dist/shared/index.mjs
CHANGED
|
@@ -1141,7 +1141,7 @@ var ToolRouter = class {
|
|
|
1141
1141
|
* If tool name is ambiguous, use namespace to specify the server.
|
|
1142
1142
|
*/
|
|
1143
1143
|
getToolSchema(toolName, namespace, options = {}) {
|
|
1144
|
-
const matches = this.
|
|
1144
|
+
const matches = this.getIndexedToolMatches(toolName, namespace, options);
|
|
1145
1145
|
if (matches.length === 0) return void 0;
|
|
1146
1146
|
if (matches.length > 1) {
|
|
1147
1147
|
const servers = matches.map((m) => m.serverId).join(", ");
|
|
@@ -1348,6 +1348,23 @@ var ToolRouter = class {
|
|
|
1348
1348
|
getDirectlyVisibleTools() {
|
|
1349
1349
|
return this.allTools.filter((tool) => !this.matchesDeferredTool(tool) || this.matchesPinnedTool(tool.name));
|
|
1350
1350
|
}
|
|
1351
|
+
getIndexedToolMatches(toolName, namespace, options = {}) {
|
|
1352
|
+
const indexedMatches = this.index.getTool(toolName, namespace, options);
|
|
1353
|
+
if (indexedMatches.length > 0 || !this.matchesPinnedTool(toolName)) {
|
|
1354
|
+
return indexedMatches;
|
|
1355
|
+
}
|
|
1356
|
+
return this.matchTools(this.pinnedTools.filter((tool) => tool.name === toolName), namespace, options);
|
|
1357
|
+
}
|
|
1358
|
+
matchTools(tools, namespace, options = {}) {
|
|
1359
|
+
if (!namespace) return tools;
|
|
1360
|
+
const exactMatches = tools.filter(
|
|
1361
|
+
(tool) => tool.sessionId === namespace || tool.serverId === namespace
|
|
1362
|
+
);
|
|
1363
|
+
if (exactMatches.length > 0) return exactMatches;
|
|
1364
|
+
if (!options.allowServerNameFragment) return [];
|
|
1365
|
+
const namespaceLower = namespace.toLowerCase();
|
|
1366
|
+
return tools.filter((tool) => tool.serverName.toLowerCase().includes(namespaceLower));
|
|
1367
|
+
}
|
|
1351
1368
|
};
|
|
1352
1369
|
function globToRegExp(pattern) {
|
|
1353
1370
|
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|