@mondaydotcomorg/atp-mcp-adapter 0.19.5 → 0.19.7

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.
@@ -10,10 +10,14 @@ export interface MCPToolResult {
10
10
  isError?: boolean;
11
11
  }
12
12
  /**
13
- * MCP Server interface (minimal subset needed for tool registration)
13
+ * MCP Server interface - supports both legacy (v0.x) and modern (v1.x) SDK.
14
+ *
15
+ * Uses minimal duck-typing to avoid TypeScript variance issues with the
16
+ * MCP SDK's complex generic callback signatures.
14
17
  */
15
18
  export interface MCPServerLike {
16
- tool(name: string, description: string, schema: Record<string, unknown>, handler: (args: Record<string, unknown>) => Promise<MCPToolResult>): void;
19
+ registerTool?: Function;
20
+ tool?: Function;
17
21
  }
18
22
  /**
19
23
  * Registers ATP tools with an MCP server.
@@ -36,6 +40,7 @@ export declare function registerATPTools(client: AgentToolProtocolClient, mcpSer
36
40
  /**
37
41
  * Registers an array of ATP tools with an MCP server.
38
42
  * Use this if you want more control over which tools to register.
43
+ * Supports both MCP SDK v0.x and v1.x APIs.
39
44
  *
40
45
  * @example
41
46
  * ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"atp-to-mcp.d.ts","sourceRoot":"","sources":["../src/atp-to-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,IAAI,CACH,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,GAChE,IAAI,CAAC;CACR;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI,CAGhG;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI,CAwBlF"}
1
+ {"version":3,"file":"atp-to-mcp.d.ts","sourceRoot":"","sources":["../src/atp-to-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI,CAGhG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI,CA4ClF"}
@@ -22,6 +22,7 @@ export function registerATPTools(client, mcpServer) {
22
22
  /**
23
23
  * Registers an array of ATP tools with an MCP server.
24
24
  * Use this if you want more control over which tools to register.
25
+ * Supports both MCP SDK v0.x and v1.x APIs.
25
26
  *
26
27
  * @example
27
28
  * ```typescript
@@ -31,12 +32,7 @@ export function registerATPTools(client, mcpServer) {
31
32
  */
32
33
  export function registerToolsWithMCP(tools, mcpServer) {
33
34
  for (const tool of tools) {
34
- const schema = {
35
- type: tool.inputSchema.type,
36
- properties: tool.inputSchema.properties || {},
37
- required: tool.inputSchema.required || [],
38
- };
39
- mcpServer.tool(tool.name, tool.description || '', schema, async (args) => {
35
+ const handler = async (args) => {
40
36
  try {
41
37
  const result = await tool.func(args);
42
38
  const resultText = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
@@ -51,7 +47,25 @@ export function registerToolsWithMCP(tools, mcpServer) {
51
47
  isError: true,
52
48
  };
53
49
  }
54
- });
50
+ };
51
+ if (typeof mcpServer.registerTool === 'function') {
52
+ const inputSchema = tool.zodSchema?.shape ?? {};
53
+ mcpServer.registerTool(tool.name, {
54
+ description: tool.description || '',
55
+ inputSchema,
56
+ }, handler);
57
+ }
58
+ else if (typeof mcpServer.tool === 'function') {
59
+ const jsonSchema = {
60
+ type: tool.inputSchema.type,
61
+ properties: tool.inputSchema.properties || {},
62
+ required: tool.inputSchema.required || [],
63
+ };
64
+ mcpServer.tool(tool.name, tool.description || '', jsonSchema, handler);
65
+ }
66
+ else {
67
+ throw new Error('MCP server does not have a compatible tool registration method. Expected registerTool() or tool() method.');
68
+ }
55
69
  }
56
70
  }
57
71
  //# sourceMappingURL=atp-to-mcp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"atp-to-mcp.js","sourceRoot":"","sources":["../src/atp-to-mcp.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA+B,EAAE,SAAwB;IACzF,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACnC,oBAAoB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,SAAwB;IAC3E,KAA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ACT;gBACC,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;gBACnC,WAAW;aACX,EACD,OAAO,CACP,CAAC;QACH,CAAC;aAAM,IAAI,OAAO,SAAS,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACjD,MAAM,UAAU,GAAG;gBAClB,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;gBAC3B,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,IAAI,EAAE;gBAC7C,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,IAAI,EAAE;aACzC,CAAC;YACF,SAAS,CAAC,IAAI,CACb,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,IAAI,EAAE,EACtB,UAAU,EACV,OAAO,CACP,CAAC;QACH,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,2GAA2G,CAAC,CAAC;QAC9H,CAAC;IACF,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/atp-mcp-adapter",
3
- "version": "0.19.5",
3
+ "version": "0.19.7",
4
4
  "description": "MCP compatibility adapter for Agent Tool Protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -41,13 +41,22 @@
41
41
  ],
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
- "@modelcontextprotocol/sdk": "^0.5.0",
45
- "@mondaydotcomorg/atp-protocol": "0.19.5",
46
- "@mondaydotcomorg/atp-server": "0.19.5",
44
+ "@mondaydotcomorg/atp-protocol": "0.19.6",
45
+ "@mondaydotcomorg/atp-server": "0.19.7"
46
+ },
47
+ "peerDependencies": {
48
+ "@modelcontextprotocol/sdk": ">=0.5.0",
47
49
  "zod": "^3.25.0"
48
50
  },
51
+ "peerDependenciesMeta": {
52
+ "@modelcontextprotocol/sdk": {
53
+ "optional": true
54
+ }
55
+ },
49
56
  "devDependencies": {
57
+ "@modelcontextprotocol/sdk": "^1.23.0",
50
58
  "typescript": "^5.3.3",
51
- "vitest": "^1.2.1"
59
+ "vitest": "^1.2.1",
60
+ "zod": "^3.25.0"
52
61
  }
53
62
  }
package/src/atp-to-mcp.ts CHANGED
@@ -9,15 +9,14 @@ export interface MCPToolResult {
9
9
  }
10
10
 
11
11
  /**
12
- * MCP Server interface (minimal subset needed for tool registration)
12
+ * MCP Server interface - supports both legacy (v0.x) and modern (v1.x) SDK.
13
+ *
14
+ * Uses minimal duck-typing to avoid TypeScript variance issues with the
15
+ * MCP SDK's complex generic callback signatures.
13
16
  */
14
17
  export interface MCPServerLike {
15
- tool(
16
- name: string,
17
- description: string,
18
- schema: Record<string, unknown>,
19
- handler: (args: Record<string, unknown>) => Promise<MCPToolResult>
20
- ): void;
18
+ registerTool?: Function;
19
+ tool?: Function;
21
20
  }
22
21
 
23
22
  /**
@@ -45,6 +44,7 @@ export function registerATPTools(client: AgentToolProtocolClient, mcpServer: MCP
45
44
  /**
46
45
  * Registers an array of ATP tools with an MCP server.
47
46
  * Use this if you want more control over which tools to register.
47
+ * Supports both MCP SDK v0.x and v1.x APIs.
48
48
  *
49
49
  * @example
50
50
  * ```typescript
@@ -54,13 +54,7 @@ export function registerATPTools(client: AgentToolProtocolClient, mcpServer: MCP
54
54
  */
55
55
  export function registerToolsWithMCP(tools: Tool[], mcpServer: MCPServerLike): void {
56
56
  for (const tool of tools) {
57
- const schema = {
58
- type: tool.inputSchema.type,
59
- properties: tool.inputSchema.properties || {},
60
- required: tool.inputSchema.required || [],
61
- };
62
-
63
- mcpServer.tool(tool.name, tool.description || '', schema, async (args: Record<string, unknown>) => {
57
+ const handler = async (args: Record<string, unknown>): Promise<MCPToolResult> => {
64
58
  try {
65
59
  const result = await tool.func(args);
66
60
  const resultText = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
@@ -74,7 +68,33 @@ export function registerToolsWithMCP(tools: Tool[], mcpServer: MCPServerLike): v
74
68
  isError: true,
75
69
  };
76
70
  }
77
- });
71
+ };
72
+
73
+ if (typeof mcpServer.registerTool === 'function') {
74
+ const inputSchema = tool.zodSchema?.shape ?? {};
75
+ mcpServer.registerTool(
76
+ tool.name,
77
+ {
78
+ description: tool.description || '',
79
+ inputSchema,
80
+ },
81
+ handler
82
+ );
83
+ } else if (typeof mcpServer.tool === 'function') {
84
+ const jsonSchema = {
85
+ type: tool.inputSchema.type,
86
+ properties: tool.inputSchema.properties || {},
87
+ required: tool.inputSchema.required || [],
88
+ };
89
+ mcpServer.tool(
90
+ tool.name,
91
+ tool.description || '',
92
+ jsonSchema,
93
+ handler
94
+ );
95
+ } else {
96
+ throw new Error('MCP server does not have a compatible tool registration method. Expected registerTool() or tool() method.');
97
+ }
78
98
  }
79
99
  }
80
100