refactor: major cleanup of legacy and temporary files

- Removed ~965MB of temporary directories (temp/, extracted-nodes/, etc)
- Deleted outdated database files and backups (.bak files)
- Removed legacy shell scripts (mcp-server-v20.sh, rebuild-v20.sh)
- Cleaned up orphan test files and debugging scripts
- Removed duplicate schema file (src/db/schema.sql)
- Deleted old Dockerfile.old and empty database files
- Updated documentation structure in README.md
- Added n8n_diagnostic tool to documentation
- Condensed version history in CLAUDE.md
- Created release notes for v2.7.0

Total impact: Removed 34 files, saving ~965MB+ of disk space

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-06-29 19:06:31 +02:00
parent 91386b2d02
commit 1907e5ce8e
34 changed files with 112 additions and 2898 deletions

View File

@@ -1,88 +0,0 @@
#!/usr/bin/env node
/**
* Direct test of the server functionality without MCP protocol
*/
const { N8NDocumentationMCPServer } = require('../dist/mcp/server');
async function testDirect() {
console.log('🧪 Direct server test\n');
try {
// Initialize server
console.log('Initializing server...');
const server = new N8NDocumentationMCPServer();
// Wait for initialization
await new Promise(resolve => setTimeout(resolve, 1000));
console.log('Server initialized successfully\n');
// Test get_node_essentials
console.log('Testing get_node_essentials...');
try {
const result = await server.executeTool('get_node_essentials', {
nodeType: 'nodes-base.httpRequest'
});
console.log('✅ Success!');
console.log('Result type:', typeof result);
console.log('Result keys:', Object.keys(result || {}));
console.log('Node type:', result?.nodeType);
console.log('Required props:', result?.requiredProperties?.length || 0);
console.log('Common props:', result?.commonProperties?.length || 0);
console.log('Has examples:', !!result?.examples);
// Check sizes
const size = JSON.stringify(result).length;
console.log(`\nResponse size: ${(size / 1024).toFixed(1)} KB`);
} catch (error) {
console.error('❌ Error executing get_node_essentials:', error);
console.error('Error stack:', error.stack);
}
// Test search_node_properties
console.log('\n\nTesting search_node_properties...');
try {
const result = await server.executeTool('search_node_properties', {
nodeType: 'nodes-base.httpRequest',
query: 'auth'
});
console.log('✅ Success!');
console.log('Matches found:', result?.totalMatches || 0);
console.log('First match:', result?.matches?.[0]?.name);
} catch (error) {
console.error('❌ Error executing search_node_properties:', error);
}
// Test get_node_info for comparison
console.log('\n\nTesting get_node_info for comparison...');
try {
const result = await server.executeTool('get_node_info', {
nodeType: 'nodes-base.httpRequest'
});
const size = JSON.stringify(result).length;
console.log('✅ Success!');
console.log(`Full node info size: ${(size / 1024).toFixed(1)} KB`);
console.log('Properties count:', result?.properties?.length || 0);
} catch (error) {
console.error('❌ Error executing get_node_info:', error);
}
} catch (error) {
console.error('\n❌ Fatal error:', error);
console.error('Stack:', error.stack);
process.exit(1);
}
console.log('\n✨ Direct test completed');
process.exit(0);
}
// Run the test
testDirect().catch(console.error);

View File

@@ -1,225 +0,0 @@
#!/usr/bin/env node
/**
* Simple test script for validating the essentials implementation
* This version runs the MCP server as a subprocess to test real behavior
*/
const { spawn } = require('child_process');
const path = require('path');
const colors = {
reset: '\x1b[0m',
bright: '\x1b[1m',
green: '\x1b[32m',
red: '\x1b[31m',
yellow: '\x1b[33m',
blue: '\x1b[34m',
cyan: '\x1b[36m'
};
function log(message, color = colors.reset) {
console.log(`${color}${message}${colors.reset}`);
}
function runMCPRequest(request) {
return new Promise((resolve, reject) => {
const mcp = spawn('npm', ['start'], {
cwd: path.join(__dirname, '..'),
stdio: ['pipe', 'pipe', 'pipe'],
env: { ...process.env, NODE_ENV: 'production' }
});
let output = '';
let error = '';
let timeout;
// Set timeout
timeout = setTimeout(() => {
mcp.kill();
reject(new Error('Request timed out after 10 seconds'));
}, 10000);
mcp.stdout.on('data', (data) => {
output += data.toString();
});
mcp.stderr.on('data', (data) => {
error += data.toString();
});
mcp.on('close', (code) => {
clearTimeout(timeout);
if (code !== 0) {
reject(new Error(`Process exited with code ${code}: ${error}`));
return;
}
try {
// Parse JSON-RPC response
const lines = output.split('\n');
for (const line of lines) {
if (line.trim() && line.includes('"jsonrpc"')) {
const response = JSON.parse(line);
if (response.result) {
const content = response.result.content[0].text;
resolve(JSON.parse(content));
return;
} else if (response.error) {
reject(new Error(response.error.message));
return;
}
}
}
reject(new Error('No valid response found in output:\n' + output));
} catch (err) {
reject(new Error(`Failed to parse response: ${err.message}\nOutput: ${output}`));
}
});
// Send request
mcp.stdin.write(JSON.stringify(request) + '\n');
mcp.stdin.end();
});
}
async function testEssentials() {
log('\n🚀 Testing n8n MCP Essentials Implementation\n', colors.bright + colors.cyan);
try {
// Test 1: Get node essentials
log('1⃣ Testing get_node_essentials for HTTP Request...', colors.yellow);
const essentialsRequest = {
jsonrpc: '2.0',
method: 'tools/call',
params: {
name: 'get_node_essentials',
arguments: {
nodeType: 'nodes-base.httpRequest'
}
},
id: 1
};
const essentials = await runMCPRequest(essentialsRequest);
log('✅ Success! Got essentials:', colors.green);
log(` Node Type: ${essentials.nodeType}`);
log(` Display Name: ${essentials.displayName}`);
log(` Required properties: ${essentials.requiredProperties?.map(p => p.name).join(', ') || 'None'}`);
log(` Common properties: ${essentials.commonProperties?.map(p => p.name).join(', ') || 'None'}`);
log(` Examples: ${Object.keys(essentials.examples || {}).join(', ')}`);
const essentialsSize = JSON.stringify(essentials).length;
log(` Response size: ${(essentialsSize / 1024).toFixed(1)} KB`, colors.green);
// Test 2: Compare with full node info
log('\n2⃣ Getting full node info for comparison...', colors.yellow);
const fullInfoRequest = {
jsonrpc: '2.0',
method: 'tools/call',
params: {
name: 'get_node_info',
arguments: {
nodeType: 'nodes-base.httpRequest'
}
},
id: 2
};
const fullInfo = await runMCPRequest(fullInfoRequest);
const fullSize = JSON.stringify(fullInfo).length;
log('✅ Got full node info:', colors.green);
log(` Properties count: ${fullInfo.properties?.length || 0}`);
log(` Response size: ${(fullSize / 1024).toFixed(1)} KB`);
const reduction = ((fullSize - essentialsSize) / fullSize * 100).toFixed(1);
log(`\n📊 Size Comparison:`, colors.bright);
log(` Full response: ${(fullSize / 1024).toFixed(1)} KB`);
log(` Essential response: ${(essentialsSize / 1024).toFixed(1)} KB`);
log(` Size reduction: ${reduction}% 🎉`, colors.bright + colors.green);
// Test 3: Search properties
log('\n3⃣ Testing search_node_properties...', colors.yellow);
const searchRequest = {
jsonrpc: '2.0',
method: 'tools/call',
params: {
name: 'search_node_properties',
arguments: {
nodeType: 'nodes-base.httpRequest',
query: 'auth'
}
},
id: 3
};
const searchResults = await runMCPRequest(searchRequest);
log('✅ Search completed:', colors.green);
log(` Query: "${searchResults.query}"`);
log(` Matches found: ${searchResults.totalMatches}`);
if (searchResults.matches && searchResults.matches.length > 0) {
log(' Top matches:');
searchResults.matches.slice(0, 3).forEach(match => {
log(` - ${match.name}: ${match.description || 'No description'}`);
});
}
// Summary
log('\n✨ All tests passed successfully!', colors.bright + colors.green);
log('\n📋 Summary:', colors.bright);
log(` - get_node_essentials works correctly`);
log(` - Size reduction achieved: ${reduction}%`);
log(` - Property search functioning`);
log(` - Examples included in response`);
// Test more nodes
log('\n4⃣ Testing additional nodes...', colors.yellow);
const additionalNodes = ['nodes-base.webhook', 'nodes-base.code', 'nodes-base.postgres'];
const results = [];
for (const nodeType of additionalNodes) {
try {
const req = {
jsonrpc: '2.0',
method: 'tools/call',
params: {
name: 'get_node_essentials',
arguments: { nodeType }
},
id: Math.random()
};
const result = await runMCPRequest(req);
const size = JSON.stringify(result).length;
results.push({
nodeType,
success: true,
propCount: (result.requiredProperties?.length || 0) + (result.commonProperties?.length || 0),
size: (size / 1024).toFixed(1)
});
log(`${nodeType}: ${results[results.length - 1].propCount} properties, ${results[results.length - 1].size} KB`);
} catch (error) {
results.push({ nodeType, success: false, error: error.message });
log(`${nodeType}: ${error.message}`, colors.red);
}
}
log('\n🎯 Implementation validated successfully!', colors.bright + colors.green);
} catch (error) {
log(`\n❌ Test failed: ${error.message}`, colors.red);
if (error.stack) {
log('Stack trace:', colors.red);
log(error.stack, colors.red);
}
process.exit(1);
}
}
// Run the test
testEssentials().catch(error => {
console.error('Unhandled error:', error);
process.exit(1);
});

View File

@@ -1,101 +0,0 @@
#!/usr/bin/env node
/**
* Final validation test
*/
const { N8NDocumentationMCPServer } = require('../dist/mcp/server');
const colors = {
green: '\x1b[32m',
red: '\x1b[31m',
yellow: '\x1b[33m',
cyan: '\x1b[36m',
reset: '\x1b[0m',
bright: '\x1b[1m'
};
async function testNode(server, nodeType) {
console.log(`\n${colors.cyan}Testing ${nodeType}...${colors.reset}`);
try {
// Get essentials
const essentials = await server.executeTool('get_node_essentials', { nodeType });
// Get full info for comparison
const fullInfo = await server.executeTool('get_node_info', { nodeType });
const essentialSize = JSON.stringify(essentials).length;
const fullSize = JSON.stringify(fullInfo).length;
const reduction = ((fullSize - essentialSize) / fullSize * 100).toFixed(1);
console.log(`${nodeType}:`);
console.log(` Required: ${essentials.requiredProperties?.map(p => p.name).join(', ') || 'none'}`);
console.log(` Common: ${essentials.commonProperties?.map(p => p.name).join(', ') || 'none'}`);
console.log(` Size: ${(fullSize / 1024).toFixed(1)}KB → ${(essentialSize / 1024).toFixed(1)}KB (${reduction}% reduction)`);
console.log(` Examples: ${Object.keys(essentials.examples || {}).length}`);
return { success: true, reduction: parseFloat(reduction) };
} catch (error) {
console.log(`${nodeType}: ${error.message}`);
return { success: false };
}
}
async function main() {
console.log(`${colors.bright}${colors.cyan}🎯 Final Validation Test${colors.reset}\n`);
try {
const server = new N8NDocumentationMCPServer();
await new Promise(resolve => setTimeout(resolve, 500));
const nodes = [
'nodes-base.httpRequest',
'nodes-base.webhook',
'nodes-base.code',
'nodes-base.set',
'nodes-base.postgres',
'nodes-base.slack',
'nodes-base.openAi',
'nodes-base.googleSheets'
];
const results = [];
for (const node of nodes) {
const result = await testNode(server, node);
results.push(result);
}
// Summary
console.log(`\n${colors.bright}📊 Summary${colors.reset}`);
const successful = results.filter(r => r.success);
const avgReduction = successful.reduce((sum, r) => sum + r.reduction, 0) / successful.length;
console.log(`✅ Successful: ${successful.length}/${results.length}`);
console.log(`📉 Average size reduction: ${avgReduction.toFixed(1)}%`);
// Test property search
console.log(`\n${colors.bright}🔍 Testing Property Search${colors.reset}`);
const searchResult = await server.executeTool('search_node_properties', {
nodeType: 'nodes-base.httpRequest',
query: 'auth'
});
console.log(`✅ Found ${searchResult.totalMatches} properties matching "auth"`);
searchResult.matches.slice(0, 3).forEach(m => {
console.log(` - ${m.name}: ${m.type}`);
});
console.log(`\n${colors.bright}${colors.green}✨ Implementation validated successfully!${colors.reset}`);
console.log('\nThe MCP essentials tools are working correctly with:');
console.log(`- ${avgReduction.toFixed(1)}% average size reduction`);
console.log('- Property filtering working');
console.log('- Examples included');
console.log('- Search functionality operational');
} catch (error) {
console.error(`${colors.red}Fatal error: ${error.message}${colors.reset}`);
process.exit(1);
}
}
main().catch(console.error);