n8n-mcp 2.18.5 → 2.18.7
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.
- package/data/nodes.db +0 -0
- package/dist/mcp/handlers-n8n-manager.d.ts.map +1 -1
- package/dist/mcp/handlers-n8n-manager.js +378 -31
- package/dist/mcp/handlers-n8n-manager.js.map +1 -1
- package/dist/mcp/tool-docs/system/n8n-diagnostic.d.ts.map +1 -1
- package/dist/mcp/tool-docs/system/n8n-diagnostic.js +32 -14
- package/dist/mcp/tool-docs/system/n8n-diagnostic.js.map +1 -1
- package/dist/mcp/tool-docs/system/n8n-health-check.d.ts.map +1 -1
- package/dist/mcp/tool-docs/system/n8n-health-check.js +23 -12
- package/dist/mcp/tool-docs/system/n8n-health-check.js.map +1 -1
- package/dist/telemetry/event-tracker.d.ts.map +1 -1
- package/dist/telemetry/event-tracker.js +3 -0
- package/dist/telemetry/event-tracker.js.map +1 -1
- package/dist/utils/enhanced-documentation-fetcher.d.ts +2 -1
- package/dist/utils/enhanced-documentation-fetcher.d.ts.map +1 -1
- package/dist/utils/enhanced-documentation-fetcher.js +75 -7
- package/dist/utils/enhanced-documentation-fetcher.js.map +1 -1
- package/dist/utils/npm-version-checker.d.ts +14 -0
- package/dist/utils/npm-version-checker.d.ts.map +1 -0
- package/dist/utils/npm-version-checker.js +125 -0
- package/dist/utils/npm-version-checker.js.map +1 -0
- package/package.json +1 -1
package/data/nodes.db
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers-n8n-manager.d.ts","sourceRoot":"","sources":["../../src/mcp/handlers-n8n-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAML,eAAe,EAGhB,MAAM,kBAAkB,CAAC;AAiB1B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAA2B,M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AC,CAkQxG"}
|
|
@@ -37,6 +37,7 @@ const handlers_workflow_diff_1 = require("./handlers-workflow-diff");
|
|
|
37
37
|
const telemetry_1 = require("../telemetry");
|
|
38
38
|
const cache_utils_1 = require("../utils/cache-utils");
|
|
39
39
|
const execution_processor_1 = require("../services/execution-processor");
|
|
40
|
+
const npm_version_checker_1 = require("../utils/npm-version-checker");
|
|
40
41
|
let defaultApiClient = null;
|
|
41
42
|
let lastDefaultConfigUrl = null;
|
|
42
43
|
const cacheMutex = new cache_utils_1.CacheMutex();
|
|
@@ -952,27 +953,66 @@ async function handleDeleteExecution(args, context) {
|
|
|
952
953
|
}
|
|
953
954
|
}
|
|
954
955
|
async function handleHealthCheck(context) {
|
|
956
|
+
const startTime = Date.now();
|
|
955
957
|
try {
|
|
956
958
|
const client = ensureApiConfigured(context);
|
|
957
959
|
const health = await client.healthCheck();
|
|
958
960
|
const packageJson = require('../../package.json');
|
|
959
961
|
const mcpVersion = packageJson.version;
|
|
960
962
|
const supportedN8nVersion = packageJson.dependencies?.n8n?.replace(/[^0-9.]/g, '');
|
|
963
|
+
const versionCheck = await (0, npm_version_checker_1.checkNpmVersion)();
|
|
964
|
+
const cacheMetricsData = getInstanceCacheMetrics();
|
|
965
|
+
const responseTime = Date.now() - startTime;
|
|
966
|
+
const responseData = {
|
|
967
|
+
status: health.status,
|
|
968
|
+
instanceId: health.instanceId,
|
|
969
|
+
n8nVersion: health.n8nVersion,
|
|
970
|
+
features: health.features,
|
|
971
|
+
apiUrl: (0, n8n_api_1.getN8nApiConfig)()?.baseUrl,
|
|
972
|
+
mcpVersion,
|
|
973
|
+
supportedN8nVersion,
|
|
974
|
+
versionCheck: {
|
|
975
|
+
current: versionCheck.currentVersion,
|
|
976
|
+
latest: versionCheck.latestVersion,
|
|
977
|
+
upToDate: !versionCheck.isOutdated,
|
|
978
|
+
message: (0, npm_version_checker_1.formatVersionMessage)(versionCheck),
|
|
979
|
+
...(versionCheck.updateCommand ? { updateCommand: versionCheck.updateCommand } : {})
|
|
980
|
+
},
|
|
981
|
+
performance: {
|
|
982
|
+
responseTimeMs: responseTime,
|
|
983
|
+
cacheHitRate: (cacheMetricsData.hits + cacheMetricsData.misses) > 0
|
|
984
|
+
? ((cacheMetricsData.hits / (cacheMetricsData.hits + cacheMetricsData.misses)) * 100).toFixed(2) + '%'
|
|
985
|
+
: 'N/A',
|
|
986
|
+
cachedInstances: cacheMetricsData.size
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
responseData.nextSteps = [
|
|
990
|
+
'• Create workflow: n8n_create_workflow',
|
|
991
|
+
'• List workflows: n8n_list_workflows',
|
|
992
|
+
'• Search nodes: search_nodes',
|
|
993
|
+
'• Browse templates: search_templates'
|
|
994
|
+
];
|
|
995
|
+
if (versionCheck.isOutdated && versionCheck.latestVersion) {
|
|
996
|
+
responseData.updateWarning = `⚠️ n8n-mcp v${versionCheck.latestVersion} is available (you have v${versionCheck.currentVersion}). Update recommended.`;
|
|
997
|
+
}
|
|
998
|
+
telemetry_1.telemetry.trackEvent('health_check_completed', {
|
|
999
|
+
success: true,
|
|
1000
|
+
responseTimeMs: responseTime,
|
|
1001
|
+
upToDate: !versionCheck.isOutdated,
|
|
1002
|
+
apiConnected: true
|
|
1003
|
+
});
|
|
961
1004
|
return {
|
|
962
1005
|
success: true,
|
|
963
|
-
data:
|
|
964
|
-
status: health.status,
|
|
965
|
-
instanceId: health.instanceId,
|
|
966
|
-
n8nVersion: health.n8nVersion,
|
|
967
|
-
features: health.features,
|
|
968
|
-
apiUrl: (0, n8n_api_1.getN8nApiConfig)()?.baseUrl,
|
|
969
|
-
mcpVersion,
|
|
970
|
-
supportedN8nVersion,
|
|
971
|
-
versionNote: 'AI Agent: Please inform the user to verify their n8n instance version matches or is compatible with the supported version listed above. The n8n API currently does not expose version information, so manual verification is required.'
|
|
972
|
-
}
|
|
1006
|
+
data: responseData
|
|
973
1007
|
};
|
|
974
1008
|
}
|
|
975
1009
|
catch (error) {
|
|
1010
|
+
const responseTime = Date.now() - startTime;
|
|
1011
|
+
telemetry_1.telemetry.trackEvent('health_check_failed', {
|
|
1012
|
+
success: false,
|
|
1013
|
+
responseTimeMs: responseTime,
|
|
1014
|
+
errorType: error instanceof n8n_errors_1.N8nApiError ? error.code : 'unknown'
|
|
1015
|
+
});
|
|
976
1016
|
if (error instanceof n8n_errors_1.N8nApiError) {
|
|
977
1017
|
return {
|
|
978
1018
|
success: false,
|
|
@@ -980,7 +1020,13 @@ async function handleHealthCheck(context) {
|
|
|
980
1020
|
code: error.code,
|
|
981
1021
|
details: {
|
|
982
1022
|
apiUrl: (0, n8n_api_1.getN8nApiConfig)()?.baseUrl,
|
|
983
|
-
hint: 'Check if n8n is running and API is enabled'
|
|
1023
|
+
hint: 'Check if n8n is running and API is enabled',
|
|
1024
|
+
troubleshooting: [
|
|
1025
|
+
'1. Verify n8n instance is running',
|
|
1026
|
+
'2. Check N8N_API_URL is correct',
|
|
1027
|
+
'3. Verify N8N_API_KEY has proper permissions',
|
|
1028
|
+
'4. Run n8n_diagnostic for detailed analysis'
|
|
1029
|
+
]
|
|
984
1030
|
}
|
|
985
1031
|
};
|
|
986
1032
|
}
|
|
@@ -1045,13 +1091,183 @@ async function handleListAvailableTools(context) {
|
|
|
1045
1091
|
}
|
|
1046
1092
|
};
|
|
1047
1093
|
}
|
|
1094
|
+
function detectCloudPlatform() {
|
|
1095
|
+
if (process.env.RAILWAY_ENVIRONMENT)
|
|
1096
|
+
return 'railway';
|
|
1097
|
+
if (process.env.RENDER)
|
|
1098
|
+
return 'render';
|
|
1099
|
+
if (process.env.FLY_APP_NAME)
|
|
1100
|
+
return 'fly';
|
|
1101
|
+
if (process.env.HEROKU_APP_NAME)
|
|
1102
|
+
return 'heroku';
|
|
1103
|
+
if (process.env.AWS_EXECUTION_ENV)
|
|
1104
|
+
return 'aws';
|
|
1105
|
+
if (process.env.KUBERNETES_SERVICE_HOST)
|
|
1106
|
+
return 'kubernetes';
|
|
1107
|
+
if (process.env.GOOGLE_CLOUD_PROJECT)
|
|
1108
|
+
return 'gcp';
|
|
1109
|
+
if (process.env.AZURE_FUNCTIONS_ENVIRONMENT)
|
|
1110
|
+
return 'azure';
|
|
1111
|
+
return null;
|
|
1112
|
+
}
|
|
1113
|
+
function getModeSpecificDebug(mcpMode) {
|
|
1114
|
+
if (mcpMode === 'http') {
|
|
1115
|
+
const port = process.env.MCP_PORT || process.env.PORT || 3000;
|
|
1116
|
+
return {
|
|
1117
|
+
mode: 'HTTP Server',
|
|
1118
|
+
port,
|
|
1119
|
+
authTokenConfigured: !!(process.env.MCP_AUTH_TOKEN || process.env.AUTH_TOKEN),
|
|
1120
|
+
corsEnabled: true,
|
|
1121
|
+
serverUrl: `http://localhost:${port}`,
|
|
1122
|
+
healthCheckUrl: `http://localhost:${port}/health`,
|
|
1123
|
+
troubleshooting: [
|
|
1124
|
+
`1. Test server health: curl http://localhost:${port}/health`,
|
|
1125
|
+
'2. Check browser console for CORS errors',
|
|
1126
|
+
'3. Verify MCP_AUTH_TOKEN or AUTH_TOKEN if authentication enabled',
|
|
1127
|
+
`4. Ensure port ${port} is not in use: lsof -i :${port} (macOS/Linux) or netstat -ano | findstr :${port} (Windows)`,
|
|
1128
|
+
'5. Check firewall settings for port access',
|
|
1129
|
+
'6. Review server logs for connection errors'
|
|
1130
|
+
],
|
|
1131
|
+
commonIssues: [
|
|
1132
|
+
'CORS policy blocking browser requests',
|
|
1133
|
+
'Port already in use by another application',
|
|
1134
|
+
'Authentication token mismatch',
|
|
1135
|
+
'Network firewall blocking connections'
|
|
1136
|
+
]
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
else {
|
|
1140
|
+
const configLocation = process.platform === 'darwin'
|
|
1141
|
+
? '~/Library/Application Support/Claude/claude_desktop_config.json'
|
|
1142
|
+
: process.platform === 'win32'
|
|
1143
|
+
? '%APPDATA%\\Claude\\claude_desktop_config.json'
|
|
1144
|
+
: '~/.config/Claude/claude_desktop_config.json';
|
|
1145
|
+
return {
|
|
1146
|
+
mode: 'Standard I/O (Claude Desktop)',
|
|
1147
|
+
configLocation,
|
|
1148
|
+
troubleshooting: [
|
|
1149
|
+
'1. Verify Claude Desktop config file exists and is valid JSON',
|
|
1150
|
+
'2. Check MCP server entry: {"mcpServers": {"n8n": {"command": "npx", "args": ["-y", "n8n-mcp"]}}}',
|
|
1151
|
+
'3. Restart Claude Desktop after config changes',
|
|
1152
|
+
'4. Check Claude Desktop logs for startup errors',
|
|
1153
|
+
'5. Test npx can run: npx -y n8n-mcp --version',
|
|
1154
|
+
'6. Verify executable permissions if using local installation'
|
|
1155
|
+
],
|
|
1156
|
+
commonIssues: [
|
|
1157
|
+
'Invalid JSON in claude_desktop_config.json',
|
|
1158
|
+
'Incorrect command or args in MCP server config',
|
|
1159
|
+
'Claude Desktop not restarted after config changes',
|
|
1160
|
+
'npx unable to download or run package',
|
|
1161
|
+
'Missing execute permissions on local binary'
|
|
1162
|
+
]
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function getDockerDebug(isDocker) {
|
|
1167
|
+
if (!isDocker)
|
|
1168
|
+
return null;
|
|
1169
|
+
return {
|
|
1170
|
+
containerDetected: true,
|
|
1171
|
+
troubleshooting: [
|
|
1172
|
+
'1. Verify volume mounts for data/nodes.db',
|
|
1173
|
+
'2. Check network connectivity to n8n instance',
|
|
1174
|
+
'3. Ensure ports are correctly mapped',
|
|
1175
|
+
'4. Review container logs: docker logs <container-name>',
|
|
1176
|
+
'5. Verify environment variables passed to container',
|
|
1177
|
+
'6. Check IS_DOCKER=true is set correctly'
|
|
1178
|
+
],
|
|
1179
|
+
commonIssues: [
|
|
1180
|
+
'Volume mount not persisting database',
|
|
1181
|
+
'Network isolation preventing n8n API access',
|
|
1182
|
+
'Port mapping conflicts',
|
|
1183
|
+
'Missing environment variables in container'
|
|
1184
|
+
]
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
function getCloudPlatformDebug(cloudPlatform) {
|
|
1188
|
+
if (!cloudPlatform)
|
|
1189
|
+
return null;
|
|
1190
|
+
const platformGuides = {
|
|
1191
|
+
railway: {
|
|
1192
|
+
name: 'Railway',
|
|
1193
|
+
troubleshooting: [
|
|
1194
|
+
'1. Check Railway environment variables are set',
|
|
1195
|
+
'2. Verify deployment logs in Railway dashboard',
|
|
1196
|
+
'3. Ensure PORT matches Railway assigned port (automatic)',
|
|
1197
|
+
'4. Check networking configuration for external access'
|
|
1198
|
+
]
|
|
1199
|
+
},
|
|
1200
|
+
render: {
|
|
1201
|
+
name: 'Render',
|
|
1202
|
+
troubleshooting: [
|
|
1203
|
+
'1. Verify Render environment variables',
|
|
1204
|
+
'2. Check Render logs for startup errors',
|
|
1205
|
+
'3. Ensure health check endpoint is responding',
|
|
1206
|
+
'4. Verify instance type has sufficient resources'
|
|
1207
|
+
]
|
|
1208
|
+
},
|
|
1209
|
+
fly: {
|
|
1210
|
+
name: 'Fly.io',
|
|
1211
|
+
troubleshooting: [
|
|
1212
|
+
'1. Check Fly.io logs: flyctl logs',
|
|
1213
|
+
'2. Verify fly.toml configuration',
|
|
1214
|
+
'3. Ensure volumes are properly mounted',
|
|
1215
|
+
'4. Check app status: flyctl status'
|
|
1216
|
+
]
|
|
1217
|
+
},
|
|
1218
|
+
heroku: {
|
|
1219
|
+
name: 'Heroku',
|
|
1220
|
+
troubleshooting: [
|
|
1221
|
+
'1. Check Heroku logs: heroku logs --tail',
|
|
1222
|
+
'2. Verify Procfile configuration',
|
|
1223
|
+
'3. Ensure dynos are running: heroku ps',
|
|
1224
|
+
'4. Check environment variables: heroku config'
|
|
1225
|
+
]
|
|
1226
|
+
},
|
|
1227
|
+
kubernetes: {
|
|
1228
|
+
name: 'Kubernetes',
|
|
1229
|
+
troubleshooting: [
|
|
1230
|
+
'1. Check pod logs: kubectl logs <pod-name>',
|
|
1231
|
+
'2. Verify service and ingress configuration',
|
|
1232
|
+
'3. Check persistent volume claims',
|
|
1233
|
+
'4. Verify resource limits and requests'
|
|
1234
|
+
]
|
|
1235
|
+
},
|
|
1236
|
+
aws: {
|
|
1237
|
+
name: 'AWS',
|
|
1238
|
+
troubleshooting: [
|
|
1239
|
+
'1. Check CloudWatch logs',
|
|
1240
|
+
'2. Verify IAM roles and permissions',
|
|
1241
|
+
'3. Check security groups and networking',
|
|
1242
|
+
'4. Verify environment variables in service config'
|
|
1243
|
+
]
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
return platformGuides[cloudPlatform] || {
|
|
1247
|
+
name: cloudPlatform.toUpperCase(),
|
|
1248
|
+
troubleshooting: [
|
|
1249
|
+
'1. Check cloud platform logs',
|
|
1250
|
+
'2. Verify environment variables are set',
|
|
1251
|
+
'3. Check networking and port configuration',
|
|
1252
|
+
'4. Review platform-specific documentation'
|
|
1253
|
+
]
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1048
1256
|
async function handleDiagnostic(request, context) {
|
|
1257
|
+
const startTime = Date.now();
|
|
1049
1258
|
const verbose = request.params?.arguments?.verbose || false;
|
|
1259
|
+
const mcpMode = process.env.MCP_MODE || 'stdio';
|
|
1260
|
+
const isDocker = process.env.IS_DOCKER === 'true';
|
|
1261
|
+
const cloudPlatform = detectCloudPlatform();
|
|
1050
1262
|
const envVars = {
|
|
1051
1263
|
N8N_API_URL: process.env.N8N_API_URL || null,
|
|
1052
1264
|
N8N_API_KEY: process.env.N8N_API_KEY ? '***configured***' : null,
|
|
1053
1265
|
NODE_ENV: process.env.NODE_ENV || 'production',
|
|
1054
|
-
MCP_MODE:
|
|
1266
|
+
MCP_MODE: mcpMode,
|
|
1267
|
+
isDocker,
|
|
1268
|
+
cloudPlatform,
|
|
1269
|
+
nodeVersion: process.version,
|
|
1270
|
+
platform: process.platform
|
|
1055
1271
|
};
|
|
1056
1272
|
const apiConfig = (0, n8n_api_1.getN8nApiConfig)();
|
|
1057
1273
|
const apiConfigured = apiConfig !== null;
|
|
@@ -1075,6 +1291,9 @@ async function handleDiagnostic(request, context) {
|
|
|
1075
1291
|
const documentationTools = 22;
|
|
1076
1292
|
const managementTools = apiConfigured ? 16 : 0;
|
|
1077
1293
|
const totalTools = documentationTools + managementTools;
|
|
1294
|
+
const versionCheck = await (0, npm_version_checker_1.checkNpmVersion)();
|
|
1295
|
+
const cacheMetricsData = getInstanceCacheMetrics();
|
|
1296
|
+
const responseTime = Date.now() - startTime;
|
|
1078
1297
|
const diagnostic = {
|
|
1079
1298
|
timestamp: new Date().toISOString(),
|
|
1080
1299
|
environment: envVars,
|
|
@@ -1087,6 +1306,13 @@ async function handleDiagnostic(request, context) {
|
|
|
1087
1306
|
maxRetries: apiConfig.maxRetries
|
|
1088
1307
|
} : null
|
|
1089
1308
|
},
|
|
1309
|
+
versionInfo: {
|
|
1310
|
+
current: versionCheck.currentVersion,
|
|
1311
|
+
latest: versionCheck.latestVersion,
|
|
1312
|
+
upToDate: !versionCheck.isOutdated,
|
|
1313
|
+
message: (0, npm_version_checker_1.formatVersionMessage)(versionCheck),
|
|
1314
|
+
...(versionCheck.updateCommand ? { updateCommand: versionCheck.updateCommand } : {})
|
|
1315
|
+
},
|
|
1090
1316
|
toolsAvailability: {
|
|
1091
1317
|
documentationTools: {
|
|
1092
1318
|
count: documentationTools,
|
|
@@ -1102,32 +1328,153 @@ async function handleDiagnostic(request, context) {
|
|
|
1102
1328
|
},
|
|
1103
1329
|
totalAvailable: totalTools
|
|
1104
1330
|
},
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
] : [
|
|
1114
|
-
'To enable management tools:',
|
|
1115
|
-
'1. Set N8N_API_URL environment variable (e.g., https://your-n8n-instance.com)',
|
|
1116
|
-
'2. Set N8N_API_KEY environment variable (get from n8n API settings)',
|
|
1117
|
-
'3. Restart the MCP server',
|
|
1118
|
-
'4. Management tools will automatically appear'
|
|
1119
|
-
],
|
|
1120
|
-
documentation: 'For detailed setup instructions, see: https://github.com/czlonkowski/n8n-mcp?tab=readme-ov-file#n8n-management-tools-optional---requires-api-configuration'
|
|
1121
|
-
}
|
|
1331
|
+
performance: {
|
|
1332
|
+
diagnosticResponseTimeMs: responseTime,
|
|
1333
|
+
cacheHitRate: (cacheMetricsData.hits + cacheMetricsData.misses) > 0
|
|
1334
|
+
? ((cacheMetricsData.hits / (cacheMetricsData.hits + cacheMetricsData.misses)) * 100).toFixed(2) + '%'
|
|
1335
|
+
: 'N/A',
|
|
1336
|
+
cachedInstances: cacheMetricsData.size
|
|
1337
|
+
},
|
|
1338
|
+
modeSpecificDebug: getModeSpecificDebug(mcpMode)
|
|
1122
1339
|
};
|
|
1340
|
+
if (apiConfigured && apiStatus.connected) {
|
|
1341
|
+
diagnostic.nextSteps = {
|
|
1342
|
+
message: '✓ API connected! Here\'s what you can do:',
|
|
1343
|
+
recommended: [
|
|
1344
|
+
{
|
|
1345
|
+
action: 'n8n_list_workflows',
|
|
1346
|
+
description: 'See your existing workflows',
|
|
1347
|
+
timing: 'Fast (6 seconds median)'
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
action: 'n8n_create_workflow',
|
|
1351
|
+
description: 'Create a new workflow',
|
|
1352
|
+
timing: 'Typically 6-14 minutes to build'
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
action: 'search_nodes',
|
|
1356
|
+
description: 'Discover available nodes',
|
|
1357
|
+
timing: 'Fast - explore 500+ nodes'
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
action: 'search_templates',
|
|
1361
|
+
description: 'Browse pre-built workflows',
|
|
1362
|
+
timing: 'Find examples quickly'
|
|
1363
|
+
}
|
|
1364
|
+
],
|
|
1365
|
+
tips: [
|
|
1366
|
+
'82% of users start creating workflows after diagnostics - you\'re ready to go!',
|
|
1367
|
+
'Most common first action: n8n_update_partial_workflow (managing existing workflows)',
|
|
1368
|
+
'Use n8n_validate_workflow before deploying to catch issues early'
|
|
1369
|
+
]
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
else if (apiConfigured && !apiStatus.connected) {
|
|
1373
|
+
diagnostic.troubleshooting = {
|
|
1374
|
+
issue: '⚠️ API configured but connection failed',
|
|
1375
|
+
error: apiStatus.error,
|
|
1376
|
+
steps: [
|
|
1377
|
+
'1. Verify n8n instance is running and accessible',
|
|
1378
|
+
'2. Check N8N_API_URL is correct (currently: ' + apiConfig?.baseUrl + ')',
|
|
1379
|
+
'3. Test URL in browser: ' + apiConfig?.baseUrl + '/healthz',
|
|
1380
|
+
'4. Verify N8N_API_KEY has proper permissions',
|
|
1381
|
+
'5. Check firewall/network settings if using remote n8n',
|
|
1382
|
+
'6. Try running n8n_health_check again after fixes'
|
|
1383
|
+
],
|
|
1384
|
+
commonIssues: [
|
|
1385
|
+
'Wrong port number in N8N_API_URL',
|
|
1386
|
+
'API key doesn\'t have sufficient permissions',
|
|
1387
|
+
'n8n instance not running or crashed',
|
|
1388
|
+
'Network firewall blocking connection'
|
|
1389
|
+
],
|
|
1390
|
+
documentation: 'https://github.com/czlonkowski/n8n-mcp?tab=readme-ov-file#n8n-management-tools-optional---requires-api-configuration'
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1394
|
+
diagnostic.setupGuide = {
|
|
1395
|
+
message: 'n8n API not configured. You can still use documentation tools!',
|
|
1396
|
+
whatYouCanDoNow: {
|
|
1397
|
+
documentation: [
|
|
1398
|
+
{
|
|
1399
|
+
tool: 'search_nodes',
|
|
1400
|
+
description: 'Search 500+ n8n nodes',
|
|
1401
|
+
example: 'search_nodes({query: "slack"})'
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
tool: 'get_node_essentials',
|
|
1405
|
+
description: 'Get node configuration details',
|
|
1406
|
+
example: 'get_node_essentials({nodeType: "nodes-base.httpRequest"})'
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
tool: 'search_templates',
|
|
1410
|
+
description: 'Browse workflow templates',
|
|
1411
|
+
example: 'search_templates({query: "chatbot"})'
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
tool: 'validate_workflow',
|
|
1415
|
+
description: 'Validate workflow JSON',
|
|
1416
|
+
example: 'validate_workflow({workflow: {...}})'
|
|
1417
|
+
}
|
|
1418
|
+
],
|
|
1419
|
+
note: '22 documentation tools available without API configuration'
|
|
1420
|
+
},
|
|
1421
|
+
whatYouCannotDo: [
|
|
1422
|
+
'✗ Create/update workflows in n8n instance',
|
|
1423
|
+
'✗ List your workflows',
|
|
1424
|
+
'✗ Execute workflows',
|
|
1425
|
+
'✗ View execution results'
|
|
1426
|
+
],
|
|
1427
|
+
howToEnable: {
|
|
1428
|
+
steps: [
|
|
1429
|
+
'1. Get your n8n API key: [Your n8n instance]/settings/api',
|
|
1430
|
+
'2. Set environment variables:',
|
|
1431
|
+
' N8N_API_URL=https://your-n8n-instance.com',
|
|
1432
|
+
' N8N_API_KEY=your_api_key_here',
|
|
1433
|
+
'3. Restart the MCP server',
|
|
1434
|
+
'4. Run n8n_diagnostic again to verify',
|
|
1435
|
+
'5. All 38 tools will be available!'
|
|
1436
|
+
],
|
|
1437
|
+
documentation: 'https://github.com/czlonkowski/n8n-mcp?tab=readme-ov-file#n8n-management-tools-optional---requires-api-configuration'
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
if (versionCheck.isOutdated && versionCheck.latestVersion) {
|
|
1442
|
+
diagnostic.updateWarning = {
|
|
1443
|
+
message: `⚠️ Update available: v${versionCheck.currentVersion} → v${versionCheck.latestVersion}`,
|
|
1444
|
+
command: versionCheck.updateCommand,
|
|
1445
|
+
benefits: [
|
|
1446
|
+
'Latest bug fixes and improvements',
|
|
1447
|
+
'New features and tools',
|
|
1448
|
+
'Better performance and reliability'
|
|
1449
|
+
]
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
const dockerDebug = getDockerDebug(isDocker);
|
|
1453
|
+
if (dockerDebug) {
|
|
1454
|
+
diagnostic.dockerDebug = dockerDebug;
|
|
1455
|
+
}
|
|
1456
|
+
const cloudDebug = getCloudPlatformDebug(cloudPlatform);
|
|
1457
|
+
if (cloudDebug) {
|
|
1458
|
+
diagnostic.cloudPlatformDebug = cloudDebug;
|
|
1459
|
+
}
|
|
1123
1460
|
if (verbose) {
|
|
1124
|
-
diagnostic
|
|
1461
|
+
diagnostic.debug = {
|
|
1125
1462
|
processEnv: Object.keys(process.env).filter(key => key.startsWith('N8N_') || key.startsWith('MCP_')),
|
|
1126
1463
|
nodeVersion: process.version,
|
|
1127
1464
|
platform: process.platform,
|
|
1128
|
-
workingDirectory: process.cwd()
|
|
1465
|
+
workingDirectory: process.cwd(),
|
|
1466
|
+
cacheMetrics: cacheMetricsData
|
|
1129
1467
|
};
|
|
1130
1468
|
}
|
|
1469
|
+
telemetry_1.telemetry.trackEvent('diagnostic_completed', {
|
|
1470
|
+
success: true,
|
|
1471
|
+
apiConfigured,
|
|
1472
|
+
apiConnected: apiStatus.connected,
|
|
1473
|
+
toolsAvailable: totalTools,
|
|
1474
|
+
responseTimeMs: responseTime,
|
|
1475
|
+
upToDate: !versionCheck.isOutdated,
|
|
1476
|
+
verbose
|
|
1477
|
+
});
|
|
1131
1478
|
return {
|
|
1132
1479
|
success: true,
|
|
1133
1480
|
data: diagnostic
|