n8n-admin-mcp
# n8n Admin MCP Server
An MCP server that exposes n8n workflow administration: backup and rollback, replaying sample payloads, deriving tool schemas, patching node parameters, and workflow duplication/CRUD.
## Write-Safety
Every mutation requires a pre-duplication baseline. In a production environment, mutations also require `confirm=true`.
## Requirements
- Node.js 20+
- A running n8n instance with API access
## Install
```bash
git clone https://github.com/mattmaas/n8n-admin-mcp.git
cd n8n-admin-mcp
npm install
npm start # node n8n-admin-mcp.mjs
```
## Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| `N8N_API_BASE_URL` | yes | Base URL of your n8n instance |
| `N8N_API_KEY` | yes | n8n API key |
Use `N8N_ADMIN_CONFIG_FILE` to load settings from a local JSON file instead.
## MCP Client Configuration
Add this server to your MCP client's config:
```json
{
"mcpServers": {
"n8n-admin": {
"command": "node",
"args": ["<path>/n8n-admin-mcp/n8n-admin-mcp.mjs"],
"env": {
"N8N_API_BASE_URL": "http://localhost:5678",
"N8N_API_KEY": "your-api-key"
}
}
}
}
```
## Tools
| Tool | Description |
|------|-------------|
| `get_policy` | Read the active write-safety policy |
| `list_workflows` | List workflows from the n8n API |
| `get_workflow` | Get a workflow by ID |
| `get_workflow_by_name` | Find a workflow by exact name |
| `export_workflow_json` | Export workflow JSON to a local backup |
| `get_active_state` | Whether a workflow is active |
| `derive_tool_schema` | Derive candidate IO schema from node parameters |
| `inspect_node_output_shape` | Inspect a node's output type shape |
| `validate_tool_io` | Validate tool output against an expected type |
| `replay_sample_payload` | Parse and normalize a sample payload |
| `create_workflow` | Create a new inactive workflow |
| `duplicate_workflow` | Duplicate a workflow as an immutable baseline |
| `update_workflow_json` | Update a workflow (merge or replace) |
| `patch_node_params` | Patch parameters on a named node |
| `set_workflow_active` | Set workflow active state |
| `rollback_workflow` | Roll back to a baseline snapshot |
| `list_backups` | List backup records made by this tool |
## Usage
Ask your agent, for example:
- "Show me all my n8n workflows" → `list_workflows`
- "Back up the 'order-processing' workflow before I edit it" → `duplicate_workflow` then `export_workflow_json`
- "Change the webhook URL on node 'HTTP Request'" → `patch_node_params(workflow_id=..., node_name="HTTP Request", params={...})`
## License
MIT
TDQS
Scored across 17 tools
Most tools have clearly distinct purposes (get_workflow by ID vs get_workflow_by_name, patch_node_params vs update_workflow_json). Minor overlap between get_active_state and get_workflow (which likely returns active state anyway), and the four IO/schema tools form a related cluster, but descriptions keep them distinguishable.
Consistent verb_noun snake_case throughout (get_policy, list_workflows, create_workflow, update_workflow_json, patch_node_params, rollback_workflow). Minor word-order variance in set_workflow_active does not break the predictable pattern.
17 tools is reasonable for an admin server covering workflow CRUD, state management, backups, and IO schema analysis, though it sits near the upper end of comfortably scannable.
Strong lifecycle coverage: create, get, update, patch, activate, duplicate, rollback, export, and backup listing. No delete_workflow and no execution/run tooling, which are minor gaps for a full n8n admin surface.