n8n-nodes-agnicwallet 1.0.10 → 1.0.12

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/README.md CHANGED
@@ -33,18 +33,31 @@ AgnicWallet is a non-custodial Web3 wallet service that handles blockchain payme
33
33
 
34
34
  ## Installation
35
35
 
36
- ### For self-hosted N8N:
36
+ ### For self-hosted n8n (Recommended Method):
37
+
38
+ Install in the n8n custom nodes directory:
37
39
 
38
40
  ```bash
39
- npm install -g n8n-nodes-agnicwallet
41
+ cd ~/.n8n/nodes
42
+ npm init -y # Only needed first time
43
+ npm install n8n-nodes-agnicwallet --legacy-peer-deps
40
44
  ```
41
45
 
42
- Then restart N8N:
46
+ Then restart n8n:
43
47
 
44
48
  ```bash
45
49
  n8n start
46
50
  ```
47
51
 
52
+ > **Why `--legacy-peer-deps`?**
53
+ >
54
+ > This flag prevents npm from installing conflicting versions of `langchain`. Our node uses n8n's built-in `langchain@0.3.x`, but other community nodes may require `langchain@1.x`. Without this flag, npm may fail with dependency conflicts or install an incompatible version.
55
+ >
56
+ > You can also set this globally:
57
+ > ```bash
58
+ > echo "legacy-peer-deps=true" >> ~/.npmrc
59
+ > ```
60
+
48
61
  ### For Docker:
49
62
 
50
63
  Add to your Dockerfile:
@@ -53,13 +66,21 @@ Add to your Dockerfile:
53
66
  FROM n8nio/n8n:latest
54
67
 
55
68
  USER root
56
- RUN npm install -g n8n-nodes-agnicwallet
69
+ RUN cd /home/node/.n8n/nodes && \
70
+ npm init -y && \
71
+ npm install n8n-nodes-agnicwallet --legacy-peer-deps
57
72
  USER node
58
73
  ```
59
74
 
75
+ ### Global Installation (Alternative):
76
+
77
+ ```bash
78
+ npm install -g n8n-nodes-agnicwallet --legacy-peer-deps
79
+ ```
80
+
60
81
  ### For n8n.cloud:
61
82
 
62
- Not yet available. This node must first be approved as a community node by the N8N team.
83
+ Not yet available. This node must first be approved as a community node by the n8n team.
63
84
 
64
85
  ## Setup
65
86
 
@@ -234,6 +255,30 @@ This is standard practice and well-documented in the node's README.
234
255
 
235
256
  ## Troubleshooting
236
257
 
258
+ ### "ERESOLVE unable to resolve dependency tree" or "Package subpath './agents' is not defined"
259
+
260
+ **Cause:**
261
+ Conflicting `langchain` versions between community nodes. Some nodes require `langchain@1.x` while our AI Agent tools require `langchain@0.3.x` (n8n's built-in version).
262
+
263
+ **Solution:**
264
+ Always install with `--legacy-peer-deps`:
265
+ ```bash
266
+ cd ~/.n8n/nodes
267
+ npm install n8n-nodes-agnicwallet --legacy-peer-deps
268
+ ```
269
+
270
+ Or set it globally:
271
+ ```bash
272
+ echo "legacy-peer-deps=true" >> ~/.npmrc
273
+ ```
274
+
275
+ If you already installed without this flag, clean up and reinstall:
276
+ ```bash
277
+ cd ~/.n8n/nodes
278
+ rm -rf node_modules package-lock.json
279
+ npm install --legacy-peer-deps
280
+ ```
281
+
237
282
  ### "Payment signing failed"
238
283
 
239
284
  **Causes:**
@@ -242,7 +287,7 @@ This is standard practice and well-documented in the node's README.
242
287
  - Backend server down
243
288
 
244
289
  **Solutions:**
245
- 1. Reconnect credentials in N8N
290
+ 1. Reconnect credentials in n8n
246
291
  2. Check balance at [AgnicWallet](https://app.agnicpay.xyz)
247
292
  3. Check backend status
248
293
 
@@ -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 tools directly (not wrapped in Toolkit)
316
- // This avoids langchain version conflicts with other community nodes
328
+ // Return toolkit with cleanup function
317
329
  return {
318
- response: langchainTools,
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.10",
3
+ "version": "1.0.12",
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"