7.0 KiB
Troubleshooting Guide
This guide helps resolve common issues with n8n-MCP.
Table of Contents
- Docker Issues
- Installation Issues
- Runtime Errors
- Claude Desktop Issues
- Database Problems
- Network and Authentication
- Performance Issues
Docker Issues
Container Won't Start
Symptoms
docker compose upfails- Container exits immediately
- No logs available
Solutions
-
Check if port is in use:
lsof -i :3000 # or netstat -tulpn | grep 3000 -
View detailed logs:
docker compose logs -f --tail 100 -
Check Docker resources:
docker system df docker system prune -a # Clean up unused resources -
Verify image download:
docker compose pull
Database Initialization Fails in Docker
Symptoms
- Error:
ENOENT: no such file or directory, open '/app/src/database/schema.sql' - Database not found errors
Solutions
-
Rebuild the image with latest Dockerfile:
docker compose build --no-cache docker compose up -d -
Copy existing database:
# From host to container docker cp data/nodes.db n8n-mcp:/app/data/ # Restart container docker compose restart -
Initialize inside container:
docker compose exec n8n-mcp npm run rebuild
Permission Denied in Docker
Symptoms
- Cannot write to /app/data
- Permission denied errors in logs
Solutions
# Fix permissions
docker compose exec n8n-mcp chown -R nodejs:nodejs /app/data
# Or run as root temporarily
docker compose exec -u root n8n-mcp chown -R nodejs:nodejs /app
Docker Compose Variables Not Loading
Symptoms
- AUTH_TOKEN not recognized
- Environment variables missing
Solutions
-
Check .env file location:
ls -la .env cat .env -
Verify compose file:
docker compose config -
Set variables explicitly:
AUTH_TOKEN=mytoken docker compose up -d
Installation Issues
npm install Fails
Symptoms
- Dependency errors
- Node version mismatch
- Native module compilation fails
Solutions
-
Clear npm cache:
npm cache clean --force rm -rf node_modules package-lock.json npm install -
Check Node version:
node --version # Should be v16+ npm --version # Should be v7+ -
Use fallback for better-sqlite3: The project automatically falls back to sql.js if native modules fail.
Build Errors
Symptoms
- TypeScript compilation errors
- Missing type definitions
Solutions
# Clean build
rm -rf dist
npm run build
# Check TypeScript version
npx tsc --version
# Install missing types
npm install --save-dev @types/node
Runtime Errors
MCP Tools Not Available
Symptoms
- Tools don't appear in Claude Desktop
- "Unknown tool" errors
Solutions
-
Verify server is running:
# For Docker docker compose ps docker compose logs # For local ps aux | grep node -
Check database:
npm run validate npm run test-nodes -
Restart Claude Desktop after configuration changes
Stream Not Readable Error
Symptoms
- Error: "InternalServerError: stream is not readable"
- MCP endpoint returns errors
Solutions
-
Check database initialization:
ls -la data/nodes.db npm run validate -
Verify HTTP headers:
curl -H "Accept: application/json, text/event-stream" \ -H "Authorization: Bearer $AUTH_TOKEN" \ http://localhost:3000/mcp
Claude Desktop Issues
Server Not Appearing
Solutions
-
Verify config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
Check JSON syntax:
# Validate JSON cat ~/Library/Application\ Support/Claude/claude_desktop_config.json | jq . -
Use absolute paths:
{ "mcpServers": { "n8n-documentation": { "command": "node", "args": [ "/absolute/path/to/n8n-mcp/dist/mcp/index.js" ] } } }
Authentication Errors with Claude
Solutions
-
Match tokens exactly:
# In .env AUTH_TOKEN=your-token-here # In Claude config "MCP_AUTH_TOKEN": "your-token-here" -
Check for special characters:
- Avoid quotes in token values
- Use base64 encoding for safety
Database Problems
Database Corruption
Symptoms
- SQLite errors
- Unexpected results
- Missing nodes
Solutions
-
Rebuild database:
# Backup first cp data/nodes.db data/nodes.db.bak # Rebuild npm run rebuild -
Validate after rebuild:
npm run validate npm run test-nodes
Database Locked
Symptoms
- SQLITE_BUSY errors
- Cannot write to database
Solutions
# Find processes using the database
lsof data/nodes.db
# For Docker
docker compose restart
Network and Authentication
CORS Errors
Symptoms
- Browser console shows CORS errors
- Preflight requests fail
Solutions
-
Check server CORS settings:
- Verify MCP_MODE=http
- Check proxy configuration
-
Test with curl:
curl -X OPTIONS http://localhost:3000/mcp \ -H "Origin: http://localhost" \ -H "Access-Control-Request-Method: POST"
SSL/HTTPS Issues
Solutions
-
For development, use HTTP:
"connect", "http://localhost:3000/mcp" -
For production, use reverse proxy:
- See nginx/Caddy examples in HTTP_DEPLOYMENT.md
Performance Issues
Slow Response Times
Solutions
-
Check resource usage:
# Docker docker stats n8n-mcp # System top htop -
Increase memory limits:
# docker-compose.yml deploy: resources: limits: memory: 1G -
Enable query logging:
LOG_LEVEL=debug npm start
High Memory Usage
Solutions
-
Monitor with Docker:
docker compose exec n8n-mcp ps aux -
Restart periodically:
# Add to crontab 0 */6 * * * docker compose restart
Getting More Help
-
Enable debug logging:
LOG_LEVEL=debug docker compose up -
Collect diagnostic info:
# System info uname -a node --version docker --version # Project info git rev-parse HEAD npm list -
Report issues:
- GitHub: https://github.com/czlonkowski/n8n-mcp/issues
- Include logs, environment, and steps to reproduce