n8n-nodes-agnicwallet 1.0.10 → 1.0.11
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.
|
@@ -5,8 +5,20 @@ const n8n_workflow_1 = require("n8n-workflow");
|
|
|
5
5
|
const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
6
6
|
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
7
7
|
const tools_1 = require("@langchain/core/tools");
|
|
8
|
+
const agents_1 = require("langchain/agents");
|
|
8
9
|
const zod_1 = require("zod");
|
|
9
10
|
const json_schema_to_zod_1 = require("@n8n/json-schema-to-zod");
|
|
11
|
+
/**
|
|
12
|
+
* Toolkit class that wraps MCP tools for n8n AI Agent.
|
|
13
|
+
* MUST extend Toolkit for n8n's instanceof check to pass.
|
|
14
|
+
* Resolves to n8n's bundled langchain@0.3.x at runtime.
|
|
15
|
+
*/
|
|
16
|
+
class AgnicMcpToolkit extends agents_1.Toolkit {
|
|
17
|
+
constructor(tools) {
|
|
18
|
+
super();
|
|
19
|
+
this.tools = tools;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
10
22
|
// Pre-configured AgnicPay MCP endpoint (uses HTTP Streamable transport)
|
|
11
23
|
const AGNIC_MCP_ENDPOINT = "https://mcp.agnicpay.xyz/sse";
|
|
12
24
|
/**
|
|
@@ -306,16 +318,16 @@ class AgnicMCPTool {
|
|
|
306
318
|
return result;
|
|
307
319
|
};
|
|
308
320
|
// Convert MCP tools to LangChain DynamicStructuredTools
|
|
309
|
-
// Returns tools directly - n8n's getConnectedTools handles both
|
|
310
|
-
// Toolkit instances and raw tool arrays via flatMap
|
|
311
321
|
const langchainTools = mcpTools.map((tool) => mcpToolToDynamicTool(tool, callTool));
|
|
322
|
+
// Wrap in Toolkit for n8n AI Agent compatibility
|
|
323
|
+
// n8n checks: toolkit instanceof Toolkit, then calls getTools()
|
|
324
|
+
const toolkit = new AgnicMcpToolkit(langchainTools);
|
|
312
325
|
// Store references for cleanup
|
|
313
326
|
const clientRef = client;
|
|
314
327
|
const transportRef = transport;
|
|
315
|
-
// Return
|
|
316
|
-
// This avoids langchain version conflicts with other community nodes
|
|
328
|
+
// Return toolkit with cleanup function
|
|
317
329
|
return {
|
|
318
|
-
response:
|
|
330
|
+
response: toolkit,
|
|
319
331
|
closeFunction: async () => {
|
|
320
332
|
try {
|
|
321
333
|
await clientRef.close();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-agnicwallet",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "n8n community node for AgnicWallet - automated Web3 payments for X402 APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"eslint": "^8.54.0",
|
|
71
71
|
"eslint-plugin-n8n-nodes-base": "^1.16.1",
|
|
72
72
|
"gulp": "^4.0.2",
|
|
73
|
+
"langchain": "^0.3.33",
|
|
73
74
|
"n8n-workflow": "^1.40.0",
|
|
74
75
|
"prettier": "^3.1.0",
|
|
75
76
|
"typescript": "^5.3.0"
|