mindesbunister 65d65a5204 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
2025-10-07 11:43:20 +02:00

n8n MCP Server for VS Code

A Model Context Protocol (MCP) server that integrates n8n workflow automation directly into VS Code through GitHub Copilot Chat.

Features

  • List Workflows: Browse all workflows in your n8n instance
  • Get Workflow Details: View complete workflow configuration, nodes, and connections
  • Update Workflows: Modify workflow settings, nodes, and connections
  • Activate/Deactivate: Control workflow activation state
  • Execute Workflows: Manually trigger workflow execution
  • View Executions: Check execution history and results

Prerequisites

  • Node.js (v18 or higher)
  • VS Code with GitHub Copilot Chat extension
  • Access to an n8n instance (running at http://srvdocker02:8098 by default)

Installation

  1. Clone or navigate to this repository:
cd /home/rwiegand/Nextcloud/entwicklung/Werkzeuge/n8n_vscode_integration
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. Configure your n8n instance URL (if different from default):
    • Copy .env.example to .env
    • Update N8N_BASE_URL with your n8n instance URL
    • If your n8n instance requires authentication, add your API key:
      N8N_API_KEY=your-api-key-here
      

Configuration

For VS Code

The .vscode/settings.json file is already configured to use this MCP server. The configuration looks like:

{
  "mcpServers": {
    "n8n": {
      "command": "node",
      "args": [
        "/home/rwiegand/Nextcloud/entwicklung/Werkzeuge/n8n_vscode_integration/dist/index.js"
      ],
      "env": {
        "N8N_BASE_URL": "http://srvdocker02:8098"
      }
    }
  }
}

For GitHub Copilot Chat (Global Configuration)

To use this MCP server across all VS Code workspaces, add it to your global VS Code settings:

  1. Open VS Code Settings (JSON) with Cmd/Ctrl + Shift + P → "Preferences: Open User Settings (JSON)"
  2. Add the MCP server configuration:
{
  "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"
      }
    }
  }
}

If your n8n instance requires an API key, add it to the env section:

"env": {
  "N8N_BASE_URL": "http://srvdocker02:8098",
  "N8N_API_KEY": "your-api-key-here"
}

Usage

After installation and configuration, you can interact with your n8n instance through GitHub Copilot Chat in VS Code using natural language:

Example Commands

List all workflows:

@workspace List all my n8n workflows

Get workflow details:

@workspace Show me the details of workflow ID 123

Update a workflow:

@workspace Update workflow 123 to change its name to "New Name"

Activate/Deactivate workflows:

@workspace Activate workflow 123
@workspace Deactivate workflow 456

Execute a workflow:

@workspace Execute workflow 123

View execution history:

@workspace Show me the recent executions for workflow 123
@workspace Show me the last 10 executions

Get execution details:

@workspace Show me details of execution abc-123

Available MCP Tools

The server exposes the following tools:

  1. list_workflows - List all workflows
  2. get_workflow - Get detailed workflow information
  3. update_workflow - Update workflow configuration
  4. activate_workflow - Activate a workflow
  5. deactivate_workflow - Deactivate a workflow
  6. execute_workflow - Execute a workflow manually
  7. get_execution - Get execution details
  8. list_executions - List workflow executions

Development

Watch Mode

npm run watch

Build

npm run build

Run Directly

npm run dev

Troubleshooting

Server Not Connecting

  1. Verify the build is up to date: npm run build
  2. Check that the path in settings.json is correct
  3. Restart VS Code after making configuration changes
  4. Check the Output panel in VS Code for error messages

Authentication Issues

If your n8n instance requires authentication:

  1. Generate an API key in your n8n instance (Settings → API)
  2. Add the N8N_API_KEY environment variable to your configuration

Network Issues

If you can't connect to your n8n instance:

  1. Verify the n8n instance is running: curl http://srvdocker02:8098/healthz
  2. Check firewall settings
  3. Verify the URL in your configuration is correct

API Reference

n8n API Endpoints Used

  • GET /api/v1/workflows - List workflows
  • GET /api/v1/workflows/:id - Get workflow
  • PATCH /api/v1/workflows/:id - Update workflow
  • POST /api/v1/workflows/:id/execute - Execute workflow
  • GET /api/v1/executions - List executions
  • GET /api/v1/executions/:id - Get execution

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Description
No description provided
Readme 46 KiB
Languages
JavaScript 69.6%
TypeScript 30.4%