fix: resolve Claude Desktop stdio communication issues and update documentation

- Fixed console output interference with stdio JSON-RPC protocol:
  - Modified logger to suppress ALL output in stdio mode
  - Added DISABLE_CONSOLE_OUTPUT environment variable support
  - Updated error handlers to respect stdio mode

- Updated Claude Desktop configuration documentation:
  - Added required environment variables for clean stdio communication
  - Promoted local installation as recommended method
  - Fixed remote connection instructions (removed broken mcp-remote)
  - Added troubleshooting section for common issues
  - Updated both README.md and docs/README_CLAUDE_SETUP.md

- Environment variables now required for stdio mode:
  - MCP_MODE=stdio
  - LOG_LEVEL=error
  - DISABLE_CONSOLE_OUTPUT=true
  - NODE_ENV=production

This ensures clean JSON-RPC communication without console output corruption.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-06-16 00:50:06 +02:00
parent 7d6691cd42
commit 4d955a5b4b
4 changed files with 116 additions and 72 deletions

View File

@@ -75,23 +75,27 @@ npm run start:http # HTTP mode for remote access
## 🔧 Claude Desktop Configuration
### For Local Installation (stdio mode)
### For Local Installation (stdio mode) - Recommended
**macOS/Linux:**
```json
{
"mcpServers": {
"n8n-documentation": {
"n8n-mcp": {
"command": "node",
"args": ["/path/to/n8n-mcp/dist/mcp/index.js"],
"env": {
"NODE_ENV": "production"
"NODE_ENV": "production",
"LOG_LEVEL": "error",
"MCP_MODE": "stdio",
"DISABLE_CONSOLE_OUTPUT": "true"
}
}
}
}
```
⚠️ **Important**: The environment variables above are required for proper stdio communication.
### For Docker (stdio mode)
```json
@@ -102,6 +106,8 @@ npm run start:http # HTTP mode for remote access
"args": [
"run", "--rm", "-i",
"-e", "MCP_MODE=stdio",
"-e", "LOG_LEVEL=error",
"-e", "DISABLE_CONSOLE_OUTPUT=true",
"-v", "n8n-mcp-data:/app/data",
"ghcr.io/czlonkowski/n8n-mcp:latest"
]
@@ -112,22 +118,19 @@ npm run start:http # HTTP mode for remote access
### For Remote Server (HTTP mode)
**Important**: Requires Node.js 18+ on your local machine.
For production deployments with HTTP mode, use the custom HTTP client:
```json
{
"mcpServers": {
"n8n-remote": {
"command": "npx",
"command": "node",
"args": [
"-y",
"mcp-remote",
"https://your-server.com/mcp",
"--header",
"Authorization: Bearer ${AUTH_TOKEN}"
"/path/to/n8n-mcp/scripts/mcp-http-client.js",
"http://your-server.com:3000/mcp"
],
"env": {
"AUTH_TOKEN": "your-auth-token"
"MCP_AUTH_TOKEN": "your-auth-token"
}
}
}