Skip to content
MCP server

n8n-guard

Read-only health checks for self-hosted n8n: datastore size, stuck runs and git drift

Runs locally

n8n-guard is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.

Pricing
Open source
Platforms
CLI, Self-hosted
Runs
Locally
What it can do
Can change data (1 tool)
Version
0.1.0
Listing updated

Similar MCP servers

Install

You install MCP servers on a computer. Send yourself the link.

Add with the CLI

Run in a terminal

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.

Or share it with your project

Add to .mcp.json

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

Claude Code setup guide

Add to claude_desktop_config.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.

Claude Desktop setup guide

Add to ~/.cursor/mcp.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.

Cursor setup guide

Add to ~/.copilot/mcp-config.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.

VS Code setup guide

Add with the CLI

Run in a terminal

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

Or add to config.toml

Add to ~/.codex/config.toml

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

Codex setup guide

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "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

    Add to ~/.gemini/settings.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

    Antigravity

    Add to ~/.gemini/config/mcp_config.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.

    Gemini CLI and Antigravity setup guide

  • Devin Desktop (formerly Windsurf)

    Add to ~/.config/devin/mcp_config.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.

    Devin Desktop setup guide

  • Cline

    Add to cline_mcp_settings.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.

    Cline setup guide

  • Zed

    Add to Zed settings.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.

    Zed setup guide

  • JetBrains AI Assistant and Junie

    AI Assistant

    Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add

    {
      "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.

    Junie

    Add to ~/.junie/mcp/mcp.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.

    JetBrains AI Assistant and Junie setup guide

  • Kiro

    Add to ~/.kiro/settings/mcp.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.

    Kiro setup guide

Using several servers? Build one config file with the MCP config generator.

Configuration

  • N8N_URLBase URL of the n8n instance. Defaults to http://localhost:5678.
  • N8N_API_KEYn8n Public API key. Required for the execution and workflow checks.
  • N8N_SQLITE_PATHPath to the n8n database.sqlite file. Required for datastore checks on SQLite.
  • N8N_POSTGRES_URLPostgres connection string. Takes precedence over N8N_SQLITE_PATH.
  • N8N_GIT_REPO_PATHCheckout holding exported workflow JSON. Required for the git drift check.
  • N8N_GUARD_STUCK_MINUTESMinutes a run may stay in `running` before it counts as stuck. Defaults to 15.
  • N8N_GUARD_DB_WARN_BYTESDatastore warning threshold in bytes. Defaults to 1073741824 (1 GB).
  • N8N_GUARD_DB_CRITICAL_BYTESDatastore critical threshold in bytes. Defaults to 4294967296 (4 GB).
  • N8N_GUARD_TIMEOUT_MSPer-request API timeout in milliseconds. Defaults to 15000.

About n8n-guard

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.

Tools this server provides (6)

Taken from the project documentation; the running server may differ.

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_runName suggests: changes
Runs all checks in one resilient sweep.

What it does

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

Pricing

Open source

More servers for the same service

n8n-guard 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.

How AIPoweredBot checks servers