# 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