@thecodesaiyan/tcs-n8n-mcp 1.0.6 → 1.1.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.
Files changed (2) hide show
  1. package/build/index.js +57 -2
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -1,12 +1,67 @@
1
1
  #!/usr/bin/env node
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { createInterface } from "node:readline/promises";
4
5
  import { registerWorkflowTools } from "./tools/workflows.js";
5
6
  import { registerExecutionTools } from "./tools/executions.js";
6
7
  import { registerTagTools } from "./tools/tags.js";
7
8
  import { registerVariableTools } from "./tools/variables.js";
8
9
  import { registerCredentialTools } from "./tools/credentials.js";
9
10
  import { registerUserTools } from "./tools/users.js";
11
+ // --- Interactive setup mode ---
12
+ if (process.argv.includes("--setup")) {
13
+ runSetup().then(() => process.exit(0)).catch((e) => {
14
+ console.error("Setup failed:", e);
15
+ process.exit(1);
16
+ });
17
+ }
18
+ async function runSetup() {
19
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
20
+ console.log("\n @thecodesaiyan/tcs-n8n-mcp - Setup Wizard\n");
21
+ const url = (await rl.question(" n8n URL [http://localhost:5678]: ")).trim() || "http://localhost:5678";
22
+ const apiKey = (await rl.question(" n8n API Key: ")).trim();
23
+ rl.close();
24
+ if (!apiKey) {
25
+ console.error("\n API key is required. Generate one in n8n: Settings > API > Create API Key\n");
26
+ process.exit(1);
27
+ }
28
+ // Test connection
29
+ console.log("\n Testing connection...");
30
+ const testUrl = `${url.replace(/\/$/, "")}/api/v1/workflows?limit=1`;
31
+ try {
32
+ const res = await fetch(testUrl, {
33
+ headers: { "X-N8N-API-KEY": apiKey, "Content-Type": "application/json" },
34
+ signal: AbortSignal.timeout(10_000),
35
+ });
36
+ if (!res.ok) {
37
+ console.error(` Connection failed: HTTP ${res.status}`);
38
+ console.error(" Check your URL and API key, then try again.\n");
39
+ process.exit(1);
40
+ }
41
+ console.log(" Connected successfully!\n");
42
+ }
43
+ catch (e) {
44
+ console.error(` Connection failed: ${e instanceof Error ? e.message : e}`);
45
+ console.error(" Check your URL and API key, then try again.\n");
46
+ process.exit(1);
47
+ }
48
+ const pkg = "@thecodesaiyan/tcs-n8n-mcp";
49
+ const envJson = JSON.stringify({ N8N_API_URL: url, N8N_API_KEY: apiKey });
50
+ const stdioCfg = {
51
+ command: "npx",
52
+ args: ["-y", pkg],
53
+ env: { N8N_API_URL: url, N8N_API_KEY: apiKey },
54
+ };
55
+ console.log(" ── Claude Code ──");
56
+ console.log(` claude mcp add tcs-n8n-mcp -e N8N_API_URL=${url} -e N8N_API_KEY=${apiKey} -- npx -y ${pkg}\n`);
57
+ console.log(" ── Claude Desktop / Windsurf ──");
58
+ console.log(" Add to your config JSON under \"mcpServers\":\n");
59
+ console.log(` "tcs-n8n-mcp": ${JSON.stringify(stdioCfg, null, 4)}\n`);
60
+ console.log(" ── Cursor ──");
61
+ console.log(" Add to .cursor/mcp.json under \"mcpServers\":\n");
62
+ console.log(` "tcs-n8n-mcp": ${JSON.stringify(stdioCfg, null, 4)}\n`);
63
+ }
64
+ // --- Normal MCP server mode ---
10
65
  const N8N_API_URL = process.env.N8N_API_URL || "http://localhost:5678";
11
66
  const N8N_API_KEY = process.env.N8N_API_KEY || "";
12
67
  if (!N8N_API_KEY) {
@@ -30,7 +85,7 @@ const n8nFetch = (path, options = {}) => {
30
85
  };
31
86
  const server = new McpServer({
32
87
  name: "@thecodesaiyan/tcs-n8n-mcp",
33
- version: "1.0.6",
88
+ version: "1.1.0",
34
89
  });
35
90
  // Register all tool modules
36
91
  registerWorkflowTools(server, n8nFetch);
@@ -42,7 +97,7 @@ registerUserTools(server, n8nFetch);
42
97
  async function main() {
43
98
  const transport = new StdioServerTransport();
44
99
  await server.connect(transport);
45
- console.error("@thecodesaiyan/tcs-n8n-mcp v1.0.6 running on stdio (22 tools)");
100
+ console.error("@thecodesaiyan/tcs-n8n-mcp v1.1.0 running on stdio (22 tools)");
46
101
  }
47
102
  main().catch((error) => {
48
103
  console.error("Fatal error:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecodesaiyan/tcs-n8n-mcp",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "MCP server for n8n workflow automation. Manage workflows, executions, tags, variables, credentials and users via the Model Context Protocol.",
5
5
  "type": "module",
6
6
  "main": "build/index.js",