mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
Update n8n to 1.117.2 (#379)
This commit is contained in:
committed by
GitHub
parent
18b8747005
commit
3f427f9528
32
README.md
32
README.md
@@ -5,23 +5,23 @@
|
||||
[](https://www.npmjs.com/package/n8n-mcp)
|
||||
[](https://codecov.io/gh/czlonkowski/n8n-mcp)
|
||||
[](https://github.com/czlonkowski/n8n-mcp/actions)
|
||||
[](https://github.com/n8n-io/n8n)
|
||||
[](https://github.com/n8n-io/n8n)
|
||||
[](https://github.com/czlonkowski/n8n-mcp/pkgs/container/n8n-mcp)
|
||||
[](https://railway.com/deploy/n8n-mcp?referralCode=n8n-mcp)
|
||||
|
||||
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to n8n node documentation, properties, and operations. Deploy in minutes to give Claude and other AI assistants deep knowledge about n8n's 525+ workflow automation nodes.
|
||||
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to n8n node documentation, properties, and operations. Deploy in minutes to give Claude and other AI assistants deep knowledge about n8n's 541 workflow automation nodes.
|
||||
|
||||
## Overview
|
||||
|
||||
n8n-MCP serves as a bridge between n8n's workflow automation platform and AI models, enabling them to understand and work with n8n nodes effectively. It provides structured access to:
|
||||
|
||||
- 📚 **536 n8n nodes** from both n8n-nodes-base and @n8n/n8n-nodes-langchain
|
||||
- 📚 **541 n8n nodes** from both n8n-nodes-base and @n8n/n8n-nodes-langchain
|
||||
- 🔧 **Node properties** - 99% coverage with detailed schemas
|
||||
- ⚡ **Node operations** - 63.6% coverage of available actions
|
||||
- 📄 **Documentation** - 90% coverage from official n8n docs (including AI nodes)
|
||||
- 🤖 **AI tools** - 263 AI-capable nodes detected with full documentation
|
||||
- 📄 **Documentation** - 87% coverage from official n8n docs (including AI nodes)
|
||||
- 🤖 **AI tools** - 271 AI-capable nodes detected with full documentation
|
||||
- 💡 **Real-world examples** - 2,646 pre-extracted configurations from popular templates
|
||||
- 🎯 **Template library** - 2,500+ workflow templates with smart filtering
|
||||
- 🎯 **Template library** - 2,709 workflow templates with 100% metadata coverage
|
||||
|
||||
|
||||
## ⚠️ Important Safety Warning
|
||||
@@ -533,7 +533,7 @@ When operations are independent, execute them in parallel for maximum performanc
|
||||
❌ BAD: Sequential tool calls (await each one before the next)
|
||||
|
||||
### 3. Templates First
|
||||
ALWAYS check templates before building from scratch (2,500+ available).
|
||||
ALWAYS check templates before building from scratch (2,709 available).
|
||||
|
||||
### 4. Multi-Level Validation
|
||||
Use validate_node_minimal → validate_node_operation → validate_workflow pattern.
|
||||
@@ -842,7 +842,7 @@ n8n_update_partial_workflow({
|
||||
### Core Behavior
|
||||
1. **Silent execution** - No commentary between tools
|
||||
2. **Parallel by default** - Execute independent operations simultaneously
|
||||
3. **Templates first** - Always check before building (2,500+ available)
|
||||
3. **Templates first** - Always check before building (2,709 available)
|
||||
4. **Multi-level validation** - Quick check → Full validation → Workflow validation
|
||||
5. **Never trust defaults** - Explicitly configure ALL parameters
|
||||
|
||||
@@ -945,7 +945,7 @@ Once connected, Claude can use these powerful tools:
|
||||
- **`get_node_as_tool_info`** - Get guidance on using any node as an AI tool
|
||||
|
||||
### Template Tools
|
||||
- **`list_templates`** - Browse all templates with descriptions and optional metadata (2,500+ templates)
|
||||
- **`list_templates`** - Browse all templates with descriptions and optional metadata (2,709 templates)
|
||||
- **`search_templates`** - Text search across template names and descriptions
|
||||
- **`search_templates_by_metadata`** - Advanced filtering by complexity, setup time, services, audience
|
||||
- **`list_node_templates`** - Find templates using specific nodes
|
||||
@@ -1100,17 +1100,17 @@ npm run dev:http # HTTP dev mode
|
||||
|
||||
## 📊 Metrics & Coverage
|
||||
|
||||
Current database coverage (n8n v1.113.3):
|
||||
Current database coverage (n8n v1.117.2):
|
||||
|
||||
- ✅ **536/536** nodes loaded (100%)
|
||||
- ✅ **528** nodes with properties (98.7%)
|
||||
- ✅ **470** nodes with documentation (88%)
|
||||
- ✅ **267** AI-capable tools detected
|
||||
- ✅ **541/541** nodes loaded (100%)
|
||||
- ✅ **541** nodes with properties (100%)
|
||||
- ✅ **470** nodes with documentation (87%)
|
||||
- ✅ **271** AI-capable tools detected
|
||||
- ✅ **2,646** pre-extracted template configurations
|
||||
- ✅ **2,500+** workflow templates available
|
||||
- ✅ **2,709** workflow templates available (100% metadata coverage)
|
||||
- ✅ **AI Agent & LangChain nodes** fully documented
|
||||
- ⚡ **Average response time**: ~12ms
|
||||
- 💾 **Database size**: ~15MB (optimized)
|
||||
- 💾 **Database size**: ~68MB (includes templates with metadata)
|
||||
|
||||
## 🔄 Recent Updates
|
||||
|
||||
|
||||
BIN
data/nodes.db
BIN
data/nodes.db
Binary file not shown.
1778
package-lock.json
generated
1778
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "n8n-mcp",
|
||||
"version": "2.22.7",
|
||||
"version": "2.22.8",
|
||||
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -140,15 +140,15 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.20.1",
|
||||
"@n8n/n8n-nodes-langchain": "^1.115.1",
|
||||
"@n8n/n8n-nodes-langchain": "^1.116.2",
|
||||
"@supabase/supabase-js": "^2.57.4",
|
||||
"dotenv": "^16.5.0",
|
||||
"express": "^5.1.0",
|
||||
"express-rate-limit": "^7.1.5",
|
||||
"lru-cache": "^11.2.1",
|
||||
"n8n": "^1.116.2",
|
||||
"n8n-core": "^1.115.1",
|
||||
"n8n-workflow": "^1.113.0",
|
||||
"n8n": "^1.117.2",
|
||||
"n8n-core": "^1.116.0",
|
||||
"n8n-workflow": "^1.114.0",
|
||||
"openai": "^4.77.0",
|
||||
"sql.js": "^1.13.0",
|
||||
"tslib": "^2.6.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "n8n-mcp-runtime",
|
||||
"version": "2.22.7",
|
||||
"version": "2.22.8",
|
||||
"description": "n8n MCP Server Runtime Dependencies Only",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
||||
99
scripts/process-batch-metadata.ts
Normal file
99
scripts/process-batch-metadata.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env ts-node
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { createDatabaseAdapter } from '../src/database/database-adapter';
|
||||
|
||||
interface BatchResponse {
|
||||
id: string;
|
||||
custom_id: string;
|
||||
response: {
|
||||
status_code: number;
|
||||
body: {
|
||||
choices: Array<{
|
||||
message: {
|
||||
content: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
};
|
||||
error: any;
|
||||
}
|
||||
|
||||
async function processBatchMetadata(batchFile: string) {
|
||||
console.log(`📥 Processing batch file: ${batchFile}`);
|
||||
|
||||
// Read the JSONL file
|
||||
const content = fs.readFileSync(batchFile, 'utf-8');
|
||||
const lines = content.trim().split('\n');
|
||||
|
||||
console.log(`📊 Found ${lines.length} batch responses`);
|
||||
|
||||
// Initialize database
|
||||
const db = await createDatabaseAdapter('./data/nodes.db');
|
||||
|
||||
let updated = 0;
|
||||
let skipped = 0;
|
||||
let errors = 0;
|
||||
|
||||
for (const line of lines) {
|
||||
try {
|
||||
const response: BatchResponse = JSON.parse(line);
|
||||
|
||||
// Extract template ID from custom_id (format: "template-9100")
|
||||
const templateId = parseInt(response.custom_id.replace('template-', ''));
|
||||
|
||||
// Check for errors
|
||||
if (response.error || response.response.status_code !== 200) {
|
||||
console.warn(`⚠️ Template ${templateId}: API error`, response.error);
|
||||
errors++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Extract metadata from response
|
||||
const metadataJson = response.response.body.choices[0].message.content;
|
||||
|
||||
// Validate it's valid JSON
|
||||
JSON.parse(metadataJson); // Will throw if invalid
|
||||
|
||||
// Update database
|
||||
const stmt = db.prepare(`
|
||||
UPDATE templates
|
||||
SET metadata_json = ?
|
||||
WHERE id = ?
|
||||
`);
|
||||
|
||||
stmt.run(metadataJson, templateId);
|
||||
updated++;
|
||||
|
||||
console.log(`✅ Template ${templateId}: Updated metadata`);
|
||||
|
||||
} catch (error: any) {
|
||||
console.error(`❌ Error processing line:`, error.message);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
||||
// Close database
|
||||
if ('close' in db && typeof db.close === 'function') {
|
||||
db.close();
|
||||
}
|
||||
|
||||
console.log(`\n📈 Summary:`);
|
||||
console.log(` - Updated: ${updated}`);
|
||||
console.log(` - Skipped: ${skipped}`);
|
||||
console.log(` - Errors: ${errors}`);
|
||||
console.log(` - Total: ${lines.length}`);
|
||||
}
|
||||
|
||||
// Main
|
||||
const batchFile = process.argv[2] || '/Users/romualdczlonkowski/Pliki/n8n-mcp/n8n-mcp/docs/batch_68fff7242850819091cfed64f10fb6b4_output.jsonl';
|
||||
|
||||
processBatchMetadata(batchFile)
|
||||
.then(() => {
|
||||
console.log('\n✅ Batch processing complete!');
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('\n❌ Batch processing failed:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -76,9 +76,14 @@ async function fetchTemplatesRobust() {
|
||||
// Fetch detail
|
||||
const detail = await fetcher.fetchTemplateDetail(template.id);
|
||||
|
||||
if (detail !== null) {
|
||||
// Save immediately
|
||||
repository.saveTemplate(template, detail);
|
||||
saved++;
|
||||
} else {
|
||||
errors++;
|
||||
console.error(`\n❌ Failed to fetch template ${template.id} (${template.name}) after retries`);
|
||||
}
|
||||
|
||||
// Rate limiting
|
||||
await new Promise(resolve => setTimeout(resolve, 200));
|
||||
|
||||
@@ -40,6 +40,36 @@ export interface TemplateDetail {
|
||||
export class TemplateFetcher {
|
||||
private readonly baseUrl = 'https://api.n8n.io/api/templates';
|
||||
private readonly pageSize = 250; // Maximum allowed by API
|
||||
private readonly maxRetries = 3;
|
||||
private readonly retryDelay = 1000; // 1 second base delay
|
||||
|
||||
/**
|
||||
* Retry helper for API calls
|
||||
*/
|
||||
private async retryWithBackoff<T>(
|
||||
fn: () => Promise<T>,
|
||||
context: string,
|
||||
maxRetries: number = this.maxRetries
|
||||
): Promise<T | null> {
|
||||
let lastError: any;
|
||||
|
||||
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||
try {
|
||||
return await fn();
|
||||
} catch (error: any) {
|
||||
lastError = error;
|
||||
|
||||
if (attempt < maxRetries) {
|
||||
const delay = this.retryDelay * attempt; // Exponential backoff
|
||||
logger.warn(`${context} - Attempt ${attempt}/${maxRetries} failed, retrying in ${delay}ms...`);
|
||||
await this.sleep(delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.error(`${context} - All ${maxRetries} attempts failed, skipping`, lastError);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch all templates and filter to last 12 months
|
||||
@@ -77,7 +107,8 @@ export class TemplateFetcher {
|
||||
logger.info('Starting complete template fetch from n8n.io API');
|
||||
|
||||
while (hasMore) {
|
||||
try {
|
||||
const result = await this.retryWithBackoff(
|
||||
async () => {
|
||||
const response = await axios.get(`${this.baseUrl}/search`, {
|
||||
params: {
|
||||
page,
|
||||
@@ -85,9 +116,20 @@ export class TemplateFetcher {
|
||||
// Note: sort_by parameter doesn't work, templates come in popularity order
|
||||
}
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
`Fetching templates page ${page}`
|
||||
);
|
||||
|
||||
const { workflows } = response.data;
|
||||
totalWorkflows = response.data.totalWorkflows || totalWorkflows;
|
||||
if (result === null) {
|
||||
// All retries failed for this page, skip it and continue
|
||||
logger.warn(`Skipping page ${page} after ${this.maxRetries} failed attempts`);
|
||||
page++;
|
||||
continue;
|
||||
}
|
||||
|
||||
const { workflows } = result;
|
||||
totalWorkflows = result.totalWorkflows || totalWorkflows;
|
||||
|
||||
allTemplates.push(...workflows);
|
||||
|
||||
@@ -112,24 +154,22 @@ export class TemplateFetcher {
|
||||
if (hasMore) {
|
||||
await this.sleep(300); // 300ms between requests (was 500ms with 100 rows)
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`Error fetching templates page ${page}:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(`Fetched all ${allTemplates.length} templates from n8n.io`);
|
||||
return allTemplates;
|
||||
}
|
||||
|
||||
async fetchTemplateDetail(workflowId: number): Promise<TemplateDetail> {
|
||||
try {
|
||||
async fetchTemplateDetail(workflowId: number): Promise<TemplateDetail | null> {
|
||||
const result = await this.retryWithBackoff(
|
||||
async () => {
|
||||
const response = await axios.get(`${this.baseUrl}/workflows/${workflowId}`);
|
||||
return response.data.workflow;
|
||||
} catch (error) {
|
||||
logger.error(`Error fetching template detail for ${workflowId}:`, error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
`Fetching template detail for workflow ${workflowId}`
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async fetchAllTemplateDetails(
|
||||
@@ -137,15 +177,21 @@ export class TemplateFetcher {
|
||||
progressCallback?: (current: number, total: number) => void
|
||||
): Promise<Map<number, TemplateDetail>> {
|
||||
const details = new Map<number, TemplateDetail>();
|
||||
let skipped = 0;
|
||||
|
||||
logger.info(`Fetching details for ${workflows.length} templates`);
|
||||
|
||||
for (let i = 0; i < workflows.length; i++) {
|
||||
const workflow = workflows[i];
|
||||
|
||||
try {
|
||||
const detail = await this.fetchTemplateDetail(workflow.id);
|
||||
|
||||
if (detail !== null) {
|
||||
details.set(workflow.id, detail);
|
||||
} else {
|
||||
skipped++;
|
||||
logger.warn(`Skipped workflow ${workflow.id} after ${this.maxRetries} failed attempts`);
|
||||
}
|
||||
|
||||
if (progressCallback) {
|
||||
progressCallback(i + 1, workflows.length);
|
||||
@@ -153,13 +199,9 @@ export class TemplateFetcher {
|
||||
|
||||
// Rate limiting (conservative to avoid API throttling)
|
||||
await this.sleep(150); // 150ms between requests
|
||||
} catch (error) {
|
||||
logger.error(`Failed to fetch details for workflow ${workflow.id}:`, error);
|
||||
// Continue with other templates
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(`Successfully fetched ${details.size} template details`);
|
||||
logger.info(`Successfully fetched ${details.size} template details (${skipped} skipped)`);
|
||||
return details;
|
||||
}
|
||||
|
||||
|
||||
@@ -496,10 +496,17 @@ export class TemplateRepository {
|
||||
// Count node usage
|
||||
const nodeCount: Record<string, number> = {};
|
||||
topNodes.forEach(t => {
|
||||
if (!t.nodes_used) return;
|
||||
try {
|
||||
const nodes = JSON.parse(t.nodes_used);
|
||||
if (Array.isArray(nodes)) {
|
||||
nodes.forEach((n: string) => {
|
||||
nodeCount[n] = (nodeCount[n] || 0) + 1;
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
logger.warn(`Failed to parse nodes_used for template stats:`, error);
|
||||
}
|
||||
});
|
||||
|
||||
// Get top 10 most used nodes
|
||||
|
||||
Reference in New Issue
Block a user