Installation
Install and run n8n MCP Bridge locally
Installation
Set up n8n MCP Bridge on your local machine using Docker Compose.
Prerequisites
Ensure you have the following installed:
- Docker Desktop or Docker Engine (v24.0+)
- Docker Compose (v2.0+)
- Git (for cloning the repository)
- Node.js 20+ (optional, for local development)
Quick Start
1. Clone the Repository
git clone https://github.com/tomasgrasl/n8n-mcp-bridge
cd n8n-mcp-bridge
2. Set Up Environment Variables
Copy the example environment file:
cp .env.example .env
Edit the .env file with your configuration:
# Database
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/n8nmcp"
# Next.js
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-here" # Generate: openssl rand -base64 32
# Encryption
ENCRYPTION_KEY="your-encryption-key" # Generate: openssl rand -hex 32
# Google OAuth (optional)
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
# GitHub OAuth (optional)
GITHUB_CLIENT_ID="your-github-client-id"
GITHUB_CLIENT_SECRET="your-github-client-secret"
# Internal API Security
MCP_INTERNAL_SECRET="your-internal-secret" # Generate: openssl rand -hex 32
3. Generate Secrets
Use OpenSSL to generate secure secrets:
# Generate NEXTAUTH_SECRET
openssl rand -base64 32
# Generate ENCRYPTION_KEY and MCP_INTERNAL_SECRET
openssl rand -hex 32
4. Start the Services
Using Taskfile (recommended):
task dev
Or using Docker Compose directly:
docker compose up
The services will start on:
- Web UI: http://localhost:3000
- MCP Server: http://localhost:3001
- PostgreSQL: localhost:5432
OAuth Configuration
To enable Google and GitHub authentication, you need to create OAuth applications:
Google OAuth Setup
- Go to Google Cloud Console
- Create a new project or select existing
- Navigate to APIs & Services → Credentials
- Click Create Credentials → OAuth 2.0 Client ID
- Configure:
- Application type: Web application
- Authorized redirect URIs:
http://localhost:3000/api/auth/callback/google
- Copy the Client ID and Client Secret to your
.envfile
GitHub OAuth Setup
- Go to GitHub Developer Settings
- Click New OAuth App
- Configure:
- Application name:
n8n MCP Bridge (Local) - Homepage URL:
http://localhost:3000 - Authorization callback URL:
http://localhost:3000/api/auth/callback/github
- Application name:
- Click Register application
- Copy the Client ID and generate a Client Secret
- Add both to your
.envfile
Verify Installation
Check Service Health
-
Web Application: Open http://localhost:3000
- You should see the homepage
-
MCP Server: Check http://localhost:3001/health
- Should return:
{"status":"ok"}
- Should return:
-
Database: Connect using any PostgreSQL client
- Host:
localhost - Port:
5432 - Database:
n8nmcp - User:
postgres - Password:
postgres
- Host:
View Logs
# View all service logs
task dev:logs
# Or with Docker Compose
docker compose logs -f
Common Issues
Port Already in Use
If ports 3000, 3001, or 5432 are already in use:
- Stop the conflicting service
- Or modify the ports in
docker-compose.yml
Database Connection Failed
If you see database connection errors:
- Ensure PostgreSQL container is running:
docker ps - Check database logs:
docker compose logs n8n-mcp-db - Verify
DATABASE_URLin.envmatches your configuration
OAuth Not Working
If OAuth authentication fails:
- Verify OAuth credentials in
.env - Check redirect URIs match exactly
- Ensure
NEXTAUTH_URLis set correctly
Development Tools
Database Management
Access Drizzle Studio to view and manage database tables:
task db:studio
Opens at: http://localhost:5555
MCP Inspector
Test your MCP server with the MCP Inspector:
task inspector
Next Steps
Now that you have n8n MCP Bridge running locally, continue to: