-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
Bug Description
All MCP tool calls (list_workflows, list_executions, get_workflow, etc.) return the n8n frontend HTML page instead of JSON API responses.
Root Cause
The axios base URL is set directly to N8N_HOST without the /api/v1/ path prefix:
const n8nApi = axios.create({
baseURL: N8N_HOST, // e.g. "https://my-n8n.example.com"
...
});
// This results in:
await n8nApi.get('/workflows');
// → GET https://my-n8n.example.com/workflows ← WRONG (hits SPA catch-all → HTML)
// Should be:
// → GET https://my-n8n.example.com/api/v1/workflows ← CORRECT (public API)n8n has two API schemes:
/rest/...— internal endpoints requiring cookie/session auth (used by the n8n Editor UI)/api/v1/...— public API endpoints accepting API key auth viaX-N8N-API-KEYheader
The package sends the X-N8N-API-KEY header (correct for the public API), but hits paths without /api/v1/ prefix. Since n8n's Vue.js SPA has a catch-all route, any unrecognized URL returns index.html.
Expected Fix
const n8nApi = axios.create({
baseURL: `${N8N_HOST}/api/v1`,
headers: {
'X-N8N-API-KEY': N8N_API_KEY,
'Content-Type': 'application/json'
}
});Environment
- n8n version: 2.3.5 (self-hosted, HTTPS reverse proxy)
- Package version: latest via
npx -y @makafeli/n8n-workflow-builder - Used as MCP server in Claude Desktop
Steps to Reproduce
- Configure
N8N_HOST=https://your-n8n-instance.comand a validN8N_API_KEY - Call any tool (e.g.
list_workflows) - Response is the n8n frontend HTML (
<!DOCTYPE html>...) instead of JSON
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels