Refactor to focused n8n node documentation MCP server
Major refactoring to align with actual requirements: - Purpose: Serve n8n node code/documentation to AI agents only - No workflow execution or management features - Complete node information including source code, docs, and examples New features: - Node documentation service with SQLite FTS5 search - Documentation fetcher from n8n-docs repository - Example workflow generator for each node type - Simplified MCP tools focused on node information - Complete database rebuild with all node data MCP Tools: - list_nodes: List available nodes - get_node_info: Get complete node information - search_nodes: Full-text search across nodes - get_node_example: Get usage examples - get_node_source_code: Get source code only - get_node_documentation: Get documentation only - rebuild_database: Rebuild entire database - get_database_statistics: Database stats Database schema includes: - Node source code and metadata - Official documentation from n8n-docs - Generated usage examples - Full-text search capabilities - Category and type filtering Updated README with: - Clear purpose statement - Claude Desktop installation instructions - Complete tool documentation - Troubleshooting guide 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
62
tests/test-small-rebuild.js
Normal file
62
tests/test-small-rebuild.js
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { NodeDocumentationService } = require('../dist/services/node-documentation-service');
|
||||
|
||||
async function testSmallRebuild() {
|
||||
console.log('Testing small rebuild...\n');
|
||||
|
||||
const service = new NodeDocumentationService('./data/nodes-v2-test.db');
|
||||
|
||||
try {
|
||||
// First, let's just try the IF node specifically
|
||||
const extractor = service.extractor;
|
||||
console.log('1️⃣ Testing extraction of IF node...');
|
||||
|
||||
try {
|
||||
const ifNodeData = await extractor.extractNodeSource('n8n-nodes-base.If');
|
||||
console.log(' ✅ Successfully extracted IF node');
|
||||
console.log(' Source code length:', ifNodeData.sourceCode.length);
|
||||
console.log(' Has credentials:', !!ifNodeData.credentialCode);
|
||||
} catch (error) {
|
||||
console.log(' ❌ Failed to extract IF node:', error.message);
|
||||
}
|
||||
|
||||
// Try the Webhook node
|
||||
console.log('\n2️⃣ Testing extraction of Webhook node...');
|
||||
try {
|
||||
const webhookNodeData = await extractor.extractNodeSource('n8n-nodes-base.Webhook');
|
||||
console.log(' ✅ Successfully extracted Webhook node');
|
||||
console.log(' Source code length:', webhookNodeData.sourceCode.length);
|
||||
} catch (error) {
|
||||
console.log(' ❌ Failed to extract Webhook node:', error.message);
|
||||
}
|
||||
|
||||
// Now try storing just these nodes
|
||||
console.log('\n3️⃣ Testing storage of a single node...');
|
||||
const nodeInfo = {
|
||||
nodeType: 'n8n-nodes-base.If',
|
||||
name: 'If',
|
||||
displayName: 'If',
|
||||
description: 'Route items based on comparison operations',
|
||||
sourceCode: 'test source code',
|
||||
packageName: 'n8n-nodes-base',
|
||||
hasCredentials: false,
|
||||
isTrigger: false,
|
||||
isWebhook: false
|
||||
};
|
||||
|
||||
await service.storeNode(nodeInfo);
|
||||
console.log(' ✅ Successfully stored test node');
|
||||
|
||||
// Check if it was stored
|
||||
const retrievedNode = await service.getNodeInfo('n8n-nodes-base.If');
|
||||
console.log(' Retrieved node:', retrievedNode ? 'Found' : 'Not found');
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Test failed:', error);
|
||||
} finally {
|
||||
service.close();
|
||||
}
|
||||
}
|
||||
|
||||
testSmallRebuild();
|
||||
Reference in New Issue
Block a user