refactor: clean up file names and fix version management
- Renamed files to remove unnecessary suffixes: - tools-update.ts → tools.ts - server-update.ts → server.ts - http-server-fixed.ts → http-server.ts - Created version utility to read from package.json as single source of truth - Updated all imports across 21+ files - Removed legacy files: - src/http-server.ts (legacy HTTP server with known issues) - src/utils/n8n-client.ts (unused legacy API client) - Added n8n_diagnostic tool to help troubleshoot management tools visibility - Added script to sync package.runtime.json version - Fixed version mismatch issue (was hardcoded 2.4.1, now reads 2.7.0 from package.json) This addresses GitHub issue #5 regarding version mismatch and provides better diagnostics for users. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -831,4 +831,108 @@ export async function handleListAvailableTools(): Promise<McpToolResponse> {
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Handler: n8n_diagnostic
|
||||
export async function handleDiagnostic(request: any): Promise<McpToolResponse> {
|
||||
const verbose = request.params?.arguments?.verbose || false;
|
||||
|
||||
// Check environment variables
|
||||
const envVars = {
|
||||
N8N_API_URL: process.env.N8N_API_URL || null,
|
||||
N8N_API_KEY: process.env.N8N_API_KEY ? '***configured***' : null,
|
||||
NODE_ENV: process.env.NODE_ENV || 'production',
|
||||
MCP_MODE: process.env.MCP_MODE || 'stdio'
|
||||
};
|
||||
|
||||
// Check API configuration
|
||||
const apiConfigured = n8nApiConfig !== null;
|
||||
const apiClient = getN8nApiClient();
|
||||
|
||||
// Test API connectivity if configured
|
||||
let apiStatus = {
|
||||
configured: apiConfigured,
|
||||
connected: false,
|
||||
error: null as string | null,
|
||||
version: null as string | null
|
||||
};
|
||||
|
||||
if (apiClient) {
|
||||
try {
|
||||
const health = await apiClient.healthCheck();
|
||||
apiStatus.connected = true;
|
||||
apiStatus.version = health.n8nVersion || 'unknown';
|
||||
} catch (error) {
|
||||
apiStatus.error = error instanceof Error ? error.message : 'Unknown error';
|
||||
}
|
||||
}
|
||||
|
||||
// Check which tools are available
|
||||
const documentationTools = 22; // Base documentation tools
|
||||
const managementTools = apiConfigured ? 16 : 0;
|
||||
const totalTools = documentationTools + managementTools;
|
||||
|
||||
// Build diagnostic report
|
||||
const diagnostic: any = {
|
||||
timestamp: new Date().toISOString(),
|
||||
environment: envVars,
|
||||
apiConfiguration: {
|
||||
configured: apiConfigured,
|
||||
status: apiStatus,
|
||||
config: apiConfigured && n8nApiConfig ? {
|
||||
baseUrl: n8nApiConfig.baseUrl,
|
||||
timeout: n8nApiConfig.timeout,
|
||||
maxRetries: n8nApiConfig.maxRetries
|
||||
} : null
|
||||
},
|
||||
toolsAvailability: {
|
||||
documentationTools: {
|
||||
count: documentationTools,
|
||||
enabled: true,
|
||||
description: 'Always available - node info, search, validation, etc.'
|
||||
},
|
||||
managementTools: {
|
||||
count: managementTools,
|
||||
enabled: apiConfigured,
|
||||
description: apiConfigured ?
|
||||
'Management tools are ENABLED - create, update, execute workflows' :
|
||||
'Management tools are DISABLED - configure N8N_API_URL and N8N_API_KEY to enable'
|
||||
},
|
||||
totalAvailable: totalTools
|
||||
},
|
||||
troubleshooting: {
|
||||
steps: apiConfigured ? [
|
||||
'API is configured and should work',
|
||||
'If tools are not showing in Claude Desktop:',
|
||||
'1. Restart Claude Desktop completely',
|
||||
'2. Check if using latest Docker image',
|
||||
'3. Verify environment variables are passed correctly',
|
||||
'4. Try running n8n_health_check to test connectivity'
|
||||
] : [
|
||||
'To enable management tools:',
|
||||
'1. Set N8N_API_URL environment variable (e.g., https://your-n8n-instance.com)',
|
||||
'2. Set N8N_API_KEY environment variable (get from n8n API settings)',
|
||||
'3. Restart the MCP server',
|
||||
'4. Management tools will automatically appear'
|
||||
],
|
||||
documentation: 'For detailed setup instructions, see: https://github.com/czlonkowski/n8n-mcp#n8n-management-tools-new-v260---requires-api-configuration'
|
||||
}
|
||||
};
|
||||
|
||||
// Add verbose debug info if requested
|
||||
if (verbose) {
|
||||
diagnostic['debug'] = {
|
||||
processEnv: Object.keys(process.env).filter(key =>
|
||||
key.startsWith('N8N_') || key.startsWith('MCP_')
|
||||
),
|
||||
nodeVersion: process.version,
|
||||
platform: process.platform,
|
||||
workingDirectory: process.cwd()
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: diagnostic
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user