Initial commit: n8n MCP server for VS Code integration

- Implemented MCP server with 8 n8n tools
- Added n8n API client for workflow operations
- Configured VS Code settings with API authentication
- Added comprehensive documentation and setup guides
- Tested and verified connection to n8n instance
This commit is contained in:
mindesbunister
2025-10-07 11:43:20 +02:00
commit 65d65a5204
12 changed files with 2171 additions and 0 deletions

114
SETUP.md Normal file
View File

@@ -0,0 +1,114 @@
# Quick Setup Guide
## Step 1: Get Your n8n API Key
1. Open your n8n instance at `http://srvdocker02:8098`
2. Go to **Settings****API**
3. Click **Create API Key**
4. Copy the generated API key
## Step 2: Configure the API Key
### Option A: Create .env file (Recommended for local testing)
Create a `.env` file in this directory:
```bash
N8N_BASE_URL=http://srvdocker02:8098
N8N_API_KEY=your-api-key-here
```
### Option B: Update VS Code Settings
Edit `.vscode/settings.json` and add your API key:
```json
{
"mcpServers": {
"n8n": {
"command": "node",
"args": [
"/home/rwiegand/Nextcloud/entwicklung/Werkzeuge/n8n_vscode_integration/dist/index.js"
],
"env": {
"N8N_BASE_URL": "http://srvdocker02:8098",
"N8N_API_KEY": "your-api-key-here"
}
}
}
}
```
### Option C: Global VS Code Settings
For use across all workspaces, add to your User Settings JSON:
1. Press `Cmd/Ctrl + Shift + P`
2. Type "Preferences: Open User Settings (JSON)"
3. Add:
```json
{
"github.copilot.chat.mcp.servers": {
"n8n": {
"command": "node",
"args": [
"/home/rwiegand/Nextcloud/entwicklung/Werkzeuge/n8n_vscode_integration/dist/index.js"
],
"env": {
"N8N_BASE_URL": "http://srvdocker02:8098",
"N8N_API_KEY": "your-api-key-here"
}
}
}
}
```
## Step 3: Test the Connection
Run the test script:
```bash
N8N_API_KEY=your-api-key-here node test-connection.js
```
You should see:
```
✓ Successfully connected to n8n!
✓ Found X workflow(s)
```
## Step 4: Restart VS Code
After updating the configuration, restart VS Code to load the MCP server.
## Step 5: Use in Copilot Chat
Open Copilot Chat and try:
```
@workspace List all my n8n workflows
```
## Troubleshooting
### "401 Unauthorized" Error
- Your API key is missing or incorrect
- Make sure you've added `N8N_API_KEY` to the environment variables
- Generate a new API key in n8n if needed
### "Connection Refused" Error
- Verify n8n is running: `curl http://srvdocker02:8098/healthz`
- Check if the URL is correct
- Verify network connectivity to the server
### MCP Server Not Found in Copilot
- Make sure you've run `npm run build`
- Verify the path in settings.json is correct
- Restart VS Code
- Check VS Code Output panel for errors (View → Output → GitHub Copilot Chat)
### Changes Not Taking Effect
- Run `npm run build` after code changes
- Restart VS Code to reload the MCP server
- Check that your settings.json is valid JSON