# n8n-guard

> n8n-guard is an open-source MCP server for developer tools. Read-only health checks for self-hosted n8n: datastore size, stuck runs and git drift. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted
- **Repository:** https://github.com/flow-84/n8n-guard
- **MCP Registry name:** io.github.flow-84/n8n-guard
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools), [cloud and infrastructure](https://ai-powered.com/categories/cloud-and-infrastructure)
- **Listing updated:** 2026-11-23

## About

n8n-guard covers what the n8n Public API cannot report. For datastore size it reads the SQLite file or queries Postgres directly, splits size by table, estimates growth and projects how many days remain before a critical threshold (warning at 1 GB and critical at 4 GB by default). For stuck runs it builds a median duration per workflow from finished executions and flags runs that stay in running far beyond it, with a default 15-minute absolute threshold.

It also estimates what a retention window would free and compares the live instance against exported workflow JSON in a git checkout, listing workflows that are live but never exported, exported but deleted, or quietly changed. It is strictly read-only: it never deletes executions or edits workflows, and suggests settings such as EXECUTIONS_DATA_PRUNE for you to apply.

Configuration is by environment variable, and partial setups work. The scheduled sweep tool, guard_run, retries failing steps with backoff and reports gaps instead of aborting. Node.js 22 or newer is required, and the repository also describes running the sweep as a Render Workflow.

## Features

- **Datastore growth:** Per-table size, growth rate and days of headroom.
- **Stuck run detection:** Compares runs against each workflow's own median.
- **Retention report:** Shows record count, age span and what pruning would free.
- **Git drift check:** Diffs live workflows against exported JSON.
- **Resilient sweep:** guard_run isolates failing steps and keeps going.
- **Strictly read-only:** Never changes the instance.

## Good for

- Warn before an n8n database fills the disk
- Find workflows hung in running state
- Decide how short to set execution retention
- Detect workflows changed without being exported to git

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add n8n-guard --env N8N_API_KEY='<N8N_API_KEY>' --env N8N_POSTGRES_URL='<N8N_POSTGRES_URL>' -- npx -y n8n-guard
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add n8n-guard --env N8N_API_KEY='<N8N_API_KEY>' --env N8N_POSTGRES_URL='<N8N_POSTGRES_URL>' -- npx -y n8n-guard
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.n8n-guard]
command = "npx"
args = ["-y", "n8n-guard"]
env = { N8N_API_KEY = "<N8N_API_KEY>", N8N_POSTGRES_URL = "<N8N_POSTGRES_URL>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Or run: gemini mcp add -s user -e N8N_API_KEY='<N8N_API_KEY>' -e N8N_POSTGRES_URL='<N8N_POSTGRES_URL>' n8n-guard npx -- -y n8n-guard

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "n8n-guard": {
      "command": "npx",
      "args": [
        "-y",
        "n8n-guard"
      ],
      "env": {
        "N8N_API_KEY": "<N8N_API_KEY>",
        "N8N_POSTGRES_URL": "<N8N_POSTGRES_URL>"
      }
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 1 of 6 tools changes data; 5 names don't say. From the server's own tool labels and tool names; not verified by us.

- `instance_info`: Shows reachability, datastore and which checks are usable.
- `db_health`: Datastore size, per-table breakdown and growth projection.
- `stuck_executions`: Finds runs stuck in running.
- `retention_report`: Execution count, age span and pruning impact.
- `git_drift`: Compares live workflows with git exports.
- `guard_run` (name suggests: changes): Runs all checks in one resilient sweep.

## FAQ

### Does n8n-guard modify my n8n instance?

No. The README says it never writes, deletes executions or activates or edits workflows.

### What does n8n-guard need?

Node.js 22 or newer, plus environment variables such as N8N_URL, N8N_API_KEY and a SQLite path or Postgres URL depending on the checks you want.

### What if only some settings are configured?

Partial configuration is supported; unconfigured checks report that and the rest continue.

### Which tool should I schedule?

guard_run, which runs all checks in one sweep.

### Is n8n-guard free?

Yes. n8n-guard is open source, so you can use and self-host it for free.

### How do I add n8n-guard to Claude Code?

Run this command in your terminal: claude mcp add n8n-guard --env N8N_API_KEY='<N8N_API_KEY>' --env N8N_POSTGRES_URL='<N8N_POSTGRES_URL>' -- npx -y n8n-guard

### What are the best alternatives to n8n-guard?

The closest alternatives to n8n-guard are REA, Codebase Memory, Serena MCP: the IDE for your agent, XERJ and Context7.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [GitHub](https://ai-powered.com/mcp/github): GitHub is an open-source MCP server for developer tools.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/n8n-guard
