@agimon-ai/mcp-proxy 0.7.2 → 0.8.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/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- const require_src = require('./src-BXEt-Hpg.cjs');
2
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_src = require("./src-dZuRf3Wt.cjs");
3
3
  exports.ConfigFetcherService = require_src.ConfigFetcherService;
4
4
  exports.DefinitionsCacheService = require_src.DefinitionsCacheService;
5
5
  exports.DescribeToolsTool = require_src.DescribeToolsTool;
@@ -24,4 +24,4 @@ exports.createStdioHttpTransportHandler = require_src.createStdioHttpTransportHa
24
24
  exports.createStdioTransportHandler = require_src.createStdioTransportHandler;
25
25
  exports.findConfigFile = require_src.findConfigFile;
26
26
  exports.generateServerId = require_src.generateServerId;
27
- exports.initializeSharedServices = require_src.initializeSharedServices;
27
+ exports.initializeSharedServices = require_src.initializeSharedServices;
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import * as _modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
1
+ import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
2
2
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
  import { CallToolResult, GetPromptResult, ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
4
+ import { z } from "zod";
4
5
  import { NodeTelemetryHandle } from "@agimon-ai/log-sink-mcp";
5
6
 
6
7
  //#region src/types/index.d.ts
7
-
8
8
  /**
9
9
  * Tool definition for MCP
10
10
  * @property name - The unique name of the tool
@@ -14,12 +14,7 @@ import { NodeTelemetryHandle } from "@agimon-ai/log-sink-mcp";
14
14
  interface ToolDefinition {
15
15
  name: string;
16
16
  description: string;
17
- inputSchema: {
18
- type: string;
19
- properties: Record<string, unknown>;
20
- required?: string[];
21
- additionalProperties?: boolean;
22
- };
17
+ inputSchema: Record<string, unknown>;
23
18
  _meta?: Record<string, unknown>;
24
19
  }
25
20
  /**
@@ -28,6 +23,7 @@ interface ToolDefinition {
28
23
  */
29
24
  interface Tool<TInput = unknown> {
30
25
  getDefinition(): ToolDefinition | Promise<ToolDefinition>;
26
+ getInputSchema(): z.ZodObject<z.ZodRawShape>;
31
27
  execute(input: TInput): Promise<CallToolResult>;
32
28
  }
33
29
  /**
@@ -743,6 +739,7 @@ declare class DefinitionsCacheService {
743
739
  getDefinitions(): Promise<DefinitionsCacheFile>;
744
740
  getServerDefinitions(): Promise<CachedServerDefinition[]>;
745
741
  getServersForTool(toolName: string): Promise<string[]>;
742
+ getToolSchema(serverName: string, toolName: string): Promise<Record<string, unknown> | undefined>;
746
743
  getServersForResource(uri: string): Promise<string[]>;
747
744
  getPromptSkillByName(skillName: string): Promise<PromptSkillMatch | undefined>;
748
745
  getCachedFileSkills(): Promise<CachedFileSkillInfo[]>;
@@ -890,9 +887,10 @@ declare class StopServerService {
890
887
  * Input schema for the DescribeToolsTool
891
888
  * @property toolNames - Array of tool names to get detailed information about
892
889
  */
893
- interface DescribeToolsToolInput {
894
- toolNames: string[];
895
- }
890
+ declare const DescribeToolsToolInputSchema: z.ZodObject<{
891
+ toolNames: z.ZodArray<z.ZodString>;
892
+ }, z.core.$strip>;
893
+ type DescribeToolsToolInput = z.infer<typeof DescribeToolsToolInputSchema>;
896
894
  /**
897
895
  * DescribeToolsTool provides progressive disclosure of MCP tools and skills.
898
896
  *
@@ -998,7 +996,9 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
998
996
  *
999
997
  * @returns Tool definition with description and input schema
1000
998
  */
999
+ getInputSchema(): z.ZodObject<z.ZodRawShape>;
1001
1000
  getDefinition(): Promise<ToolDefinition>;
1001
+ private runLookups;
1002
1002
  /**
1003
1003
  * Executes tool description lookup for the requested tool and skill names.
1004
1004
  *
@@ -1010,22 +1010,24 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
1010
1010
  * @param input - Object containing toolNames array
1011
1011
  * @returns CallToolResult with tool/skill descriptions or error
1012
1012
  */
1013
- execute(input: DescribeToolsToolInput): Promise<CallToolResult>;
1013
+ execute(rawInput: Record<string, unknown>): Promise<CallToolResult>;
1014
1014
  }
1015
1015
  //#endregion
1016
1016
  //#region src/tools/SearchListToolsTool.d.ts
1017
- interface SearchListToolsToolInput {
1018
- capability?: string;
1019
- serverName?: string;
1020
- }
1017
+ declare const SearchListToolsToolInputSchema: z.ZodObject<{
1018
+ capability: z.ZodOptional<z.ZodString>;
1019
+ serverName: z.ZodOptional<z.ZodString>;
1020
+ }, z.core.$strip>;
1021
+ type SearchListToolsToolInput = z.infer<typeof SearchListToolsToolInputSchema>;
1021
1022
  declare class SearchListToolsTool implements Tool<SearchListToolsToolInput> {
1022
1023
  private readonly _clientManager;
1023
1024
  private readonly definitionsCacheService;
1024
1025
  static readonly TOOL_NAME = "list_tools";
1025
1026
  constructor(_clientManager: unknown, definitionsCacheService: DefinitionsCacheService);
1026
1027
  private formatToolName;
1028
+ getInputSchema(): z.ZodObject<z.ZodRawShape>;
1027
1029
  getDefinition(): Promise<ToolDefinition>;
1028
- execute(input: SearchListToolsToolInput): Promise<CallToolResult>;
1030
+ execute(rawInput: Record<string, unknown>): Promise<CallToolResult>;
1029
1031
  }
1030
1032
  //#endregion
1031
1033
  //#region src/tools/UseToolTool.d.ts
@@ -1034,10 +1036,11 @@ declare class SearchListToolsTool implements Tool<SearchListToolsToolInput> {
1034
1036
  * @property toolName - Name of the tool or skill to execute
1035
1037
  * @property toolArgs - Arguments to pass to the tool (from describe_tools schema)
1036
1038
  */
1037
- interface UseToolToolInput {
1038
- toolName: string;
1039
- toolArgs?: Record<string, unknown>;
1040
- }
1039
+ declare const UseToolToolInputSchema: z.ZodObject<{
1040
+ toolName: z.ZodString;
1041
+ toolArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1042
+ }, z.core.$strip>;
1043
+ type UseToolToolInput = z.infer<typeof UseToolToolInputSchema>;
1041
1044
  /**
1042
1045
  * UseToolTool executes MCP tools and skills with proper error handling.
1043
1046
  *
@@ -1073,6 +1076,7 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
1073
1076
  *
1074
1077
  * @returns The tool definition conforming to MCP spec
1075
1078
  */
1079
+ getInputSchema(): z.ZodObject<z.ZodRawShape>;
1076
1080
  getDefinition(): ToolDefinition;
1077
1081
  /**
1078
1082
  * Returns guidance message for skill invocation.
@@ -1084,6 +1088,12 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
1084
1088
  * @param skill - The skill that was requested
1085
1089
  * @returns CallToolResult with guidance message
1086
1090
  */
1091
+ /**
1092
+ * Coerce toolArgs using the downstream tool's cached JSON Schema.
1093
+ * Converts the schema to Zod and runs coerceArgs so that string-encoded
1094
+ * objects/arrays are parsed before being forwarded to the downstream server.
1095
+ */
1096
+ private coerceToolArgs;
1087
1097
  private executeSkill;
1088
1098
  /**
1089
1099
  * Finds a prompt-based skill by name from all connected MCP servers.
@@ -1115,7 +1125,7 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
1115
1125
  * @param input - The tool/skill name and optional arguments
1116
1126
  * @returns CallToolResult with execution output or error
1117
1127
  */
1118
- execute(input: UseToolToolInput): Promise<CallToolResult>;
1128
+ execute(rawInput: Record<string, unknown>): Promise<CallToolResult>;
1119
1129
  }
1120
1130
  //#endregion
1121
1131
  //#region src/transports/http.d.ts
@@ -1264,15 +1274,15 @@ declare function createProxyContainer(options?: ServerOptions): Promise<SharedSe
1264
1274
  /**
1265
1275
  * Create a sessionless stdio transport handler from the shared server factory.
1266
1276
  */
1267
- declare function createStdioTransportHandler(createServer: () => Promise<_modelcontextprotocol_sdk_server_index_js0.Server>): Promise<StdioTransportHandler>;
1277
+ declare function createStdioTransportHandler(createServer: () => Promise<_$_modelcontextprotocol_sdk_server_index_js0.Server>): Promise<StdioTransportHandler>;
1268
1278
  /**
1269
1279
  * Create an SSE transport handler from the shared server factory.
1270
1280
  */
1271
- declare function createSseTransportHandler(createServer: () => Promise<_modelcontextprotocol_sdk_server_index_js0.Server>, config: TransportConfig): Promise<SseTransportHandler>;
1281
+ declare function createSseTransportHandler(createServer: () => Promise<_$_modelcontextprotocol_sdk_server_index_js0.Server>, config: TransportConfig): Promise<SseTransportHandler>;
1272
1282
  /**
1273
1283
  * Create an HTTP transport handler from shared services.
1274
1284
  */
1275
- declare function createHttpTransportHandler(createServer: () => Promise<_modelcontextprotocol_sdk_server_index_js0.Server>, config: TransportConfig, adminOptions?: HttpTransportAdminOptions$1): HttpTransportHandler;
1285
+ declare function createHttpTransportHandler(createServer: () => Promise<_$_modelcontextprotocol_sdk_server_index_js0.Server>, config: TransportConfig, adminOptions?: HttpTransportAdminOptions$1): HttpTransportHandler;
1276
1286
  /**
1277
1287
  * Create a stdio-http transport handler from an endpoint URL.
1278
1288
  */
package/dist/index.d.mts CHANGED
@@ -1,11 +1,10 @@
1
- import * as _modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
1
+ import * as _$_modelcontextprotocol_sdk_server_index_js0 from "@modelcontextprotocol/sdk/server/index.js";
2
2
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
  import { CallToolResult, GetPromptResult, ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
4
4
  import { z } from "zod";
5
5
  import { NodeTelemetryHandle } from "@agimon-ai/log-sink-mcp";
6
6
 
7
7
  //#region src/types/index.d.ts
8
-
9
8
  /**
10
9
  * Tool definition for MCP
11
10
  * @property name - The unique name of the tool
@@ -15,12 +14,7 @@ import { NodeTelemetryHandle } from "@agimon-ai/log-sink-mcp";
15
14
  interface ToolDefinition {
16
15
  name: string;
17
16
  description: string;
18
- inputSchema: {
19
- type: string;
20
- properties: Record<string, unknown>;
21
- required?: string[];
22
- additionalProperties?: boolean;
23
- };
17
+ inputSchema: Record<string, unknown>;
24
18
  _meta?: Record<string, unknown>;
25
19
  }
26
20
  /**
@@ -29,6 +23,7 @@ interface ToolDefinition {
29
23
  */
30
24
  interface Tool<TInput = unknown> {
31
25
  getDefinition(): ToolDefinition | Promise<ToolDefinition>;
26
+ getInputSchema(): z.ZodObject<z.ZodRawShape>;
32
27
  execute(input: TInput): Promise<CallToolResult>;
33
28
  }
34
29
  /**
@@ -744,6 +739,7 @@ declare class DefinitionsCacheService {
744
739
  getDefinitions(): Promise<DefinitionsCacheFile>;
745
740
  getServerDefinitions(): Promise<CachedServerDefinition[]>;
746
741
  getServersForTool(toolName: string): Promise<string[]>;
742
+ getToolSchema(serverName: string, toolName: string): Promise<Record<string, unknown> | undefined>;
747
743
  getServersForResource(uri: string): Promise<string[]>;
748
744
  getPromptSkillByName(skillName: string): Promise<PromptSkillMatch | undefined>;
749
745
  getCachedFileSkills(): Promise<CachedFileSkillInfo[]>;
@@ -891,9 +887,10 @@ declare class StopServerService {
891
887
  * Input schema for the DescribeToolsTool
892
888
  * @property toolNames - Array of tool names to get detailed information about
893
889
  */
894
- interface DescribeToolsToolInput {
895
- toolNames: string[];
896
- }
890
+ declare const DescribeToolsToolInputSchema: z.ZodObject<{
891
+ toolNames: z.ZodArray<z.ZodString>;
892
+ }, z.core.$strip>;
893
+ type DescribeToolsToolInput = z.infer<typeof DescribeToolsToolInputSchema>;
897
894
  /**
898
895
  * DescribeToolsTool provides progressive disclosure of MCP tools and skills.
899
896
  *
@@ -999,7 +996,9 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
999
996
  *
1000
997
  * @returns Tool definition with description and input schema
1001
998
  */
999
+ getInputSchema(): z.ZodObject<z.ZodRawShape>;
1002
1000
  getDefinition(): Promise<ToolDefinition>;
1001
+ private runLookups;
1003
1002
  /**
1004
1003
  * Executes tool description lookup for the requested tool and skill names.
1005
1004
  *
@@ -1011,22 +1010,24 @@ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
1011
1010
  * @param input - Object containing toolNames array
1012
1011
  * @returns CallToolResult with tool/skill descriptions or error
1013
1012
  */
1014
- execute(input: DescribeToolsToolInput): Promise<CallToolResult>;
1013
+ execute(rawInput: Record<string, unknown>): Promise<CallToolResult>;
1015
1014
  }
1016
1015
  //#endregion
1017
1016
  //#region src/tools/SearchListToolsTool.d.ts
1018
- interface SearchListToolsToolInput {
1019
- capability?: string;
1020
- serverName?: string;
1021
- }
1017
+ declare const SearchListToolsToolInputSchema: z.ZodObject<{
1018
+ capability: z.ZodOptional<z.ZodString>;
1019
+ serverName: z.ZodOptional<z.ZodString>;
1020
+ }, z.core.$strip>;
1021
+ type SearchListToolsToolInput = z.infer<typeof SearchListToolsToolInputSchema>;
1022
1022
  declare class SearchListToolsTool implements Tool<SearchListToolsToolInput> {
1023
1023
  private readonly _clientManager;
1024
1024
  private readonly definitionsCacheService;
1025
1025
  static readonly TOOL_NAME = "list_tools";
1026
1026
  constructor(_clientManager: unknown, definitionsCacheService: DefinitionsCacheService);
1027
1027
  private formatToolName;
1028
+ getInputSchema(): z.ZodObject<z.ZodRawShape>;
1028
1029
  getDefinition(): Promise<ToolDefinition>;
1029
- execute(input: SearchListToolsToolInput): Promise<CallToolResult>;
1030
+ execute(rawInput: Record<string, unknown>): Promise<CallToolResult>;
1030
1031
  }
1031
1032
  //#endregion
1032
1033
  //#region src/tools/UseToolTool.d.ts
@@ -1035,10 +1036,11 @@ declare class SearchListToolsTool implements Tool<SearchListToolsToolInput> {
1035
1036
  * @property toolName - Name of the tool or skill to execute
1036
1037
  * @property toolArgs - Arguments to pass to the tool (from describe_tools schema)
1037
1038
  */
1038
- interface UseToolToolInput {
1039
- toolName: string;
1040
- toolArgs?: Record<string, unknown>;
1041
- }
1039
+ declare const UseToolToolInputSchema: z.ZodObject<{
1040
+ toolName: z.ZodString;
1041
+ toolArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1042
+ }, z.core.$strip>;
1043
+ type UseToolToolInput = z.infer<typeof UseToolToolInputSchema>;
1042
1044
  /**
1043
1045
  * UseToolTool executes MCP tools and skills with proper error handling.
1044
1046
  *
@@ -1074,6 +1076,7 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
1074
1076
  *
1075
1077
  * @returns The tool definition conforming to MCP spec
1076
1078
  */
1079
+ getInputSchema(): z.ZodObject<z.ZodRawShape>;
1077
1080
  getDefinition(): ToolDefinition;
1078
1081
  /**
1079
1082
  * Returns guidance message for skill invocation.
@@ -1085,6 +1088,12 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
1085
1088
  * @param skill - The skill that was requested
1086
1089
  * @returns CallToolResult with guidance message
1087
1090
  */
1091
+ /**
1092
+ * Coerce toolArgs using the downstream tool's cached JSON Schema.
1093
+ * Converts the schema to Zod and runs coerceArgs so that string-encoded
1094
+ * objects/arrays are parsed before being forwarded to the downstream server.
1095
+ */
1096
+ private coerceToolArgs;
1088
1097
  private executeSkill;
1089
1098
  /**
1090
1099
  * Finds a prompt-based skill by name from all connected MCP servers.
@@ -1116,7 +1125,7 @@ declare class UseToolTool implements Tool<UseToolToolInput> {
1116
1125
  * @param input - The tool/skill name and optional arguments
1117
1126
  * @returns CallToolResult with execution output or error
1118
1127
  */
1119
- execute(input: UseToolToolInput): Promise<CallToolResult>;
1128
+ execute(rawInput: Record<string, unknown>): Promise<CallToolResult>;
1120
1129
  }
1121
1130
  //#endregion
1122
1131
  //#region src/transports/http.d.ts
@@ -1265,15 +1274,15 @@ declare function createProxyContainer(options?: ServerOptions): Promise<SharedSe
1265
1274
  /**
1266
1275
  * Create a sessionless stdio transport handler from the shared server factory.
1267
1276
  */
1268
- declare function createStdioTransportHandler(createServer: () => Promise<_modelcontextprotocol_sdk_server_index_js0.Server>): Promise<StdioTransportHandler>;
1277
+ declare function createStdioTransportHandler(createServer: () => Promise<_$_modelcontextprotocol_sdk_server_index_js0.Server>): Promise<StdioTransportHandler>;
1269
1278
  /**
1270
1279
  * Create an SSE transport handler from the shared server factory.
1271
1280
  */
1272
- declare function createSseTransportHandler(createServer: () => Promise<_modelcontextprotocol_sdk_server_index_js0.Server>, config: TransportConfig): Promise<SseTransportHandler>;
1281
+ declare function createSseTransportHandler(createServer: () => Promise<_$_modelcontextprotocol_sdk_server_index_js0.Server>, config: TransportConfig): Promise<SseTransportHandler>;
1273
1282
  /**
1274
1283
  * Create an HTTP transport handler from shared services.
1275
1284
  */
1276
- declare function createHttpTransportHandler(createServer: () => Promise<_modelcontextprotocol_sdk_server_index_js0.Server>, config: TransportConfig, adminOptions?: HttpTransportAdminOptions$1): HttpTransportHandler;
1285
+ declare function createHttpTransportHandler(createServer: () => Promise<_$_modelcontextprotocol_sdk_server_index_js0.Server>, config: TransportConfig, adminOptions?: HttpTransportAdminOptions$1): HttpTransportHandler;
1277
1286
  /**
1278
1287
  * Create a stdio-http transport handler from an endpoint URL.
1279
1288
  */
package/dist/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { C as DefinitionsCacheService, E as ConfigFetcherService, S as createProxyLogger, T as findConfigFile, _ as DescribeToolsTool, a as createProxyContainer, b as RuntimeStateService, c as createStdioHttpTransportHandler, d as StdioHttpTransportHandler, f as StdioTransportHandler, g as SearchListToolsTool, h as UseToolTool, i as createHttpTransportHandler, l as createStdioTransportHandler, m as HttpTransportHandler, n as createServer, p as SseTransportHandler, r as createSessionServer, s as createSseTransportHandler, t as TRANSPORT_MODE, u as initializeSharedServices, v as SkillService, w as generateServerId, x as McpClientManagerService, y as StopServerService } from "./src-NZo_eM6U.mjs";
2
-
3
- export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createHttpTransportHandler, createProxyContainer, createProxyLogger, createServer, createSessionServer, createSseTransportHandler, createStdioHttpTransportHandler, createStdioTransportHandler, findConfigFile, generateServerId, initializeSharedServices };
1
+ import { C as DefinitionsCacheService, E as ConfigFetcherService, S as createProxyLogger, T as findConfigFile, _ as DescribeToolsTool, a as createProxyContainer, b as RuntimeStateService, c as createStdioHttpTransportHandler, d as StdioHttpTransportHandler, f as StdioTransportHandler, g as SearchListToolsTool, h as UseToolTool, i as createHttpTransportHandler, l as createStdioTransportHandler, m as HttpTransportHandler, n as createServer, p as SseTransportHandler, r as createSessionServer, s as createSseTransportHandler, t as TRANSPORT_MODE, u as initializeSharedServices, v as SkillService, w as generateServerId, x as McpClientManagerService, y as StopServerService } from "./src-Dorvm5bM.mjs";
2
+ export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createHttpTransportHandler, createProxyContainer, createProxyLogger, createServer, createSessionServer, createSseTransportHandler, createStdioHttpTransportHandler, createStdioTransportHandler, findConfigFile, generateServerId, initializeSharedServices };