@mondaydotcomorg/atp-mcp-adapter 0.19.4 → 0.19.6
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/atp-to-mcp.d.ts +52 -0
- package/dist/atp-to-mcp.d.ts.map +1 -0
- package/dist/atp-to-mcp.js +71 -0
- package/dist/atp-to-mcp.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +14 -5
- package/src/atp-to-mcp.ts +100 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { AgentToolProtocolClient, Tool } from '@mondaydotcomorg/atp-client';
|
|
2
|
+
/**
|
|
3
|
+
* MCP tool handler result
|
|
4
|
+
*/
|
|
5
|
+
export interface MCPToolResult {
|
|
6
|
+
content: Array<{
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
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.
|
|
17
|
+
*/
|
|
18
|
+
export interface MCPServerLike {
|
|
19
|
+
registerTool?: Function;
|
|
20
|
+
tool?: Function;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Registers ATP tools with an MCP server.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
28
|
+
* import { AgentToolProtocolClient } from '@mondaydotcomorg/atp-client';
|
|
29
|
+
* import { registerATPTools } from '@mondaydotcomorg/atp-mcp-adapter';
|
|
30
|
+
*
|
|
31
|
+
* const client = new AgentToolProtocolClient({ baseUrl: 'http://localhost:3000' });
|
|
32
|
+
* await client.init();
|
|
33
|
+
* await client.connect();
|
|
34
|
+
*
|
|
35
|
+
* const mcpServer = new Server({ name: 'my-server', version: '1.0.0' }, { capabilities: { tools: {} } });
|
|
36
|
+
* registerATPTools(client, mcpServer);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function registerATPTools(client: AgentToolProtocolClient, mcpServer: MCPServerLike): void;
|
|
40
|
+
/**
|
|
41
|
+
* Registers an array of ATP tools with an MCP server.
|
|
42
|
+
* Use this if you want more control over which tools to register.
|
|
43
|
+
* Supports both MCP SDK v0.x and v1.x APIs.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const tools = client.getATPTools().filter(t => t.name !== 'search_api');
|
|
48
|
+
* registerToolsWithMCP(tools, mcpServer);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function registerToolsWithMCP(tools: Tool[], mcpServer: MCPServerLike): void;
|
|
52
|
+
//# sourceMappingURL=atp-to-mcp.d.ts.map
|
|
@@ -0,0 +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;;;;;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"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers ATP tools with an MCP server.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
|
+
* import { AgentToolProtocolClient } from '@mondaydotcomorg/atp-client';
|
|
8
|
+
* import { registerATPTools } from '@mondaydotcomorg/atp-mcp-adapter';
|
|
9
|
+
*
|
|
10
|
+
* const client = new AgentToolProtocolClient({ baseUrl: 'http://localhost:3000' });
|
|
11
|
+
* await client.init();
|
|
12
|
+
* await client.connect();
|
|
13
|
+
*
|
|
14
|
+
* const mcpServer = new Server({ name: 'my-server', version: '1.0.0' }, { capabilities: { tools: {} } });
|
|
15
|
+
* registerATPTools(client, mcpServer);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function registerATPTools(client, mcpServer) {
|
|
19
|
+
const tools = client.getATPTools();
|
|
20
|
+
registerToolsWithMCP(tools, mcpServer);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Registers an array of ATP tools with an MCP server.
|
|
24
|
+
* Use this if you want more control over which tools to register.
|
|
25
|
+
* Supports both MCP SDK v0.x and v1.x APIs.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const tools = client.getATPTools().filter(t => t.name !== 'search_api');
|
|
30
|
+
* registerToolsWithMCP(tools, mcpServer);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function registerToolsWithMCP(tools, mcpServer) {
|
|
34
|
+
for (const tool of tools) {
|
|
35
|
+
const handler = async (args) => {
|
|
36
|
+
try {
|
|
37
|
+
const result = await tool.func(args);
|
|
38
|
+
const resultText = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: 'text', text: resultText }],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
45
|
+
return {
|
|
46
|
+
content: [{ type: 'text', text: `Error: ${errorMessage}` }],
|
|
47
|
+
isError: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
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
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=atp-to-mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atp-to-mcp.js","sourceRoot":"","sources":["../src/atp-to-mcp.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;;;;;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,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AK,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/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { MCPConnector } from './mcp-connector.js';
|
|
2
2
|
export { MCPHttpConnector } from './http-connector.js';
|
|
3
|
+
export { registerATPTools, registerToolsWithMCP } from './atp-to-mcp.js';
|
|
3
4
|
export type { MCPTool, MCPPrompt } from './types.js';
|
|
5
|
+
export type { MCPToolResult, MCPServerLike } from './atp-to-mcp.js';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACzE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondaydotcomorg/atp-mcp-adapter",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.6",
|
|
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
|
-
"@
|
|
45
|
-
"@mondaydotcomorg/atp-
|
|
46
|
-
|
|
44
|
+
"@mondaydotcomorg/atp-protocol": "0.19.6",
|
|
45
|
+
"@mondaydotcomorg/atp-server": "0.19.6"
|
|
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
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { AgentToolProtocolClient, Tool } from '@mondaydotcomorg/atp-client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MCP tool handler result
|
|
5
|
+
*/
|
|
6
|
+
export interface MCPToolResult {
|
|
7
|
+
content: Array<{ type: 'text'; text: string }>;
|
|
8
|
+
isError?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
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.
|
|
16
|
+
*/
|
|
17
|
+
export interface MCPServerLike {
|
|
18
|
+
registerTool?: Function;
|
|
19
|
+
tool?: Function;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Registers ATP tools with an MCP server.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
28
|
+
* import { AgentToolProtocolClient } from '@mondaydotcomorg/atp-client';
|
|
29
|
+
* import { registerATPTools } from '@mondaydotcomorg/atp-mcp-adapter';
|
|
30
|
+
*
|
|
31
|
+
* const client = new AgentToolProtocolClient({ baseUrl: 'http://localhost:3000' });
|
|
32
|
+
* await client.init();
|
|
33
|
+
* await client.connect();
|
|
34
|
+
*
|
|
35
|
+
* const mcpServer = new Server({ name: 'my-server', version: '1.0.0' }, { capabilities: { tools: {} } });
|
|
36
|
+
* registerATPTools(client, mcpServer);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export function registerATPTools(client: AgentToolProtocolClient, mcpServer: MCPServerLike): void {
|
|
40
|
+
const tools = client.getATPTools();
|
|
41
|
+
registerToolsWithMCP(tools, mcpServer);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Registers an array of ATP tools with an MCP server.
|
|
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
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const tools = client.getATPTools().filter(t => t.name !== 'search_api');
|
|
52
|
+
* registerToolsWithMCP(tools, mcpServer);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function registerToolsWithMCP(tools: Tool[], mcpServer: MCPServerLike): void {
|
|
56
|
+
for (const tool of tools) {
|
|
57
|
+
const handler = async (args: Record<string, unknown>): Promise<MCPToolResult> => {
|
|
58
|
+
try {
|
|
59
|
+
const result = await tool.func(args);
|
|
60
|
+
const resultText = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: 'text' as const, text: resultText }],
|
|
63
|
+
};
|
|
64
|
+
} catch (error) {
|
|
65
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
66
|
+
return {
|
|
67
|
+
content: [{ type: 'text' as const, text: `Error: ${errorMessage}` }],
|
|
68
|
+
isError: true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
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
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { MCPConnector } from './mcp-connector.js';
|
|
2
2
|
export { MCPHttpConnector } from './http-connector.js';
|
|
3
|
+
export { registerATPTools, registerToolsWithMCP } from './atp-to-mcp.js';
|
|
3
4
|
export type { MCPTool, MCPPrompt } from './types.js';
|
|
5
|
+
export type { MCPToolResult, MCPServerLike } from './atp-to-mcp.js';
|