npm package: @klogins313/n8n-mcp-server
Description: Model Context Protocol (MCP) server for n8n workflow automation - connect AI assistants to your n8n instance
Author: klogins313
Latest version: 1.0.0

# n8n MCP Server

A Model Context Protocol (MCP) server that connects AI assistants (Claude, Windsurf, Cursor, etc.) to your n8n workflow automation instance.

[![npm version](https://badge.fury.io/js/%40klogins313%2Fn8n-mcp-server.svg)](https://www.npmjs.com/package/@klogins313/n8n-mcp-server)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## What is this?

This MCP server allows AI assistants to interact with your n8n instance using natural language. You can:
- List, create, update, and manage workflows
- Execute workflows and view results
- Monitor workflow executions
- Configure n8n settings

All through conversational AI!

## Features

### 🔧 Workflow Management
- **list_workflows** - List all workflows with filtering
- **get_workflow** - Get detailed workflow information
- **create_workflow** - Create new workflows
- **update_workflow** - Update existing workflows
- **delete_workflow** - Delete workflows
- **activate_workflow** - Activate a workflow
- **deactivate_workflow** - Deactivate a workflow

### ⚡ Execution Management
- **execute_workflow** - Manually trigger workflow execution
- **list_executions** - List recent workflow executions
- **get_execution** - Get detailed execution information

## Prerequisites

- Node.js 18 or higher
- An n8n instance (self-hosted or cloud)
- n8n API key ([How to get one](https://docs.n8n.io/api/authentication/))

## Installation

### Quick Install (Recommended)

Install globally via npm:

```bash
npm install -g @klogins313/n8n-mcp-server
```

Or use with npx (no installation needed):

```bash
npx @klogins313/n8n-mcp-server
```

## Configuration

### With Claude Desktop

Add to your Claude Desktop configuration:

**MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`  
**Windows**: `%APPDATA%/Claude/claude_desktop_config.json`

```json
{
  "mcpServers": {
    "n8n": {
      "command": "npx",
      "args": ["-y", "@your-username/n8n-mcp-server"],
      "env": {
        "N8N_BASE_URL": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your_api_key_here"
      }
    }
  }
}
```

### With Windsurf

Add to `.windsurf/mcp.json`:

```json
{
  "mcpServers": {
    "n8n": {
      "command": "npx",
      "args": ["-y", "@your-username/n8n-mcp-server"],
      "env": {
        "N8N_BASE_URL": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your_api_key_here"
      }
    }
  }
}
```

### With Cursor

Add to `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "n8n": {
      "command": "npx",
      "args": ["-y", "@your-username/n8n-mcp-server"],
      "env": {
        "N8N_BASE_URL": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your_api_key_here"
      }
    }
  }
}
```

### With VS Code (Cline/Roo-Cline)

Add to `.vscode/mcp.json`:

```json
{
  "servers": {
    "n8n": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@your-username/n8n-mcp-server"],
      "env": {
        "N8N_BASE_URL": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your_api_key_here"
      }
    }
  }
}
```

## Getting Your n8n API Key

1. Log into your n8n instance
2. Go to **Settings** → **API**
3. Click **Create API Key**
4. Copy the key and use it in your configuration

## Example Usage

Once configured, you can use natural language with your AI assistant:

```
"List all my n8n workflows"
"Show me the details of the 'Daily Report' workflow"
"Activate the workflow with ID abc123"
"Execute my 'Send Email' workflow"
"Show me recent workflow executions"
"Create a new workflow that sends a Slack message"
```

## Development

### Clone and Build

```bash
git clone https://github.com/klogins313/n8n-mcp-server.git
cd n8n-mcp-server
npm install
npm run build
```

### Watch Mode

```bash
npm run watch
```

### Local Testing

```bash
N8N_BASE_URL=https://your-instance.com N8N_API_KEY=your_key node build/index.js
```

## Troubleshooting

### "N8N_API_KEY environment variable is required"
Make sure you've set the `N8N_API_KEY` in your MCP configuration's `env` section.

### "Connection refused"
Verify your `N8N_BASE_URL` is correct and your n8n instance is accessible.

### "Unauthorized"
Check that your API key is valid and hasn't expired.

## Contributing

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

## API Reference

This server uses the [n8n REST API](https://docs.n8n.io/api/). All operations are performed through the official n8n API endpoints.

## Security

- API keys are stored locally in your MCP configuration
- All communication uses HTTPS
- No data is sent to third parties
- The server runs locally on your machine

## License

MIT - See [LICENSE](LICENSE) file for details

## Links

- [n8n Documentation](https://docs.n8n.io/)
- [Model Context Protocol](https://modelcontextprotocol.io/)
- [Report Issues](https://github.com/klogins313/n8n-mcp-server/issues)