# AI Guard

> AI Guard is an open-source MCP server for developer tools. Checks JS/TS written by AI for risky patterns, fake npm packages and weakened tests. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, vscode, self-hosted
- **Website:** https://getaiguard.dev
- **Repository:** https://github.com/ai-guard-dev/eslint-plugin-ai-guard
- **MCP Registry name:** io.github.ai-guard-dev/ai-guard
- **Categories:** developer tools, security
- **Listing updated:** 2026-11-16

## About

AI Guard is a deterministic ESLint plugin, CLI and set of agent hooks for JavaScript and TypeScript. Its 27 rules target patterns coding assistants often leave behind: swallowed errors, floating promises, leaked secrets, invented imports and placeholder code. Nothing in the loop is a model, so identical code gives identical results, and it does not try to guess whether a person or an AI wrote it.

Beyond linting, it compares a change against its base to spot skipped or removed tests, new eslint-disable comments, lowered config and hidden text in agent config files. A package check looks names up on the public npm registry and blocks ones that do not exist, were replaced by npm with a security placeholder or look like known typosquats. The site reports that 34 of 36 names from the 2017 crossenv campaign were blocked and none of 1,361 real dependencies were.

Hooks for Claude Code, Codex and Cursor feed findings back after each edit and check once before the agent finishes. It also runs as a pre-commit gate, a GitHub Action with SARIF output, and a local STDIO MCP server with nine tools. It needs Node 20 or later and ESLint 8 or later, under an MIT licence.

## Features

- **27 lint rules:** Rules cover secrets, swallowed errors, floating promises, invented imports and placeholder code.
- **Weakened-check detection:** Flags skipped tests, new suppressions and lowered config in a change.
- **Pre-install package checks:** Blocks npm names that do not exist, removed malware and look-alikes.
- **Agent hooks:** Claude Code, Codex and Cursor get feedback after edits and a check before finishing.
- **CI and code scanning:** A GitHub Action writes annotations and SARIF for Code Scanning.
- **Oxlint parity:** All 27 rules give the same results in ESLint and Oxlint.

## Good for

- Stop an AI agent from installing a package that does not exist
- Block commits that quietly skip or delete tests
- Annotate pull requests with AI-typical risks
- Scan CLAUDE.md, skills and MCP config for hidden text
- Add guardrails to a Cursor or Codex workflow

## Install

### Claude Code (Terminal)

```sh
claude mcp add ai-guard -- npx -y eslint-plugin-ai-guard
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "ai-guard": {
      "command": "npx",
      "args": [
        "-y",
        "eslint-plugin-ai-guard"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "ai-guard": {
      "command": "npx",
      "args": [
        "-y",
        "eslint-plugin-ai-guard"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "ai-guard": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "eslint-plugin-ai-guard"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "ai-guard": {
      "command": "npx",
      "args": [
        "-y",
        "eslint-plugin-ai-guard"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "ai-guard": {
      "command": "npx",
      "args": [
        "-y",
        "eslint-plugin-ai-guard"
      ]
    }
  }
}
```

## Tools

- `ai_guard_check_package`: Checks whether an npm package name is safe to install.

## FAQ

### Does it detect AI-written code?

No. It reports risky patterns wherever they came from.

### Does it send data anywhere?

Package checks are opt-in and only query the public npm registry; private-registry packages are skipped.

### What does it need?

Node.js 20 or later and ESLint 8 or later.

### Which licence?

MIT.

### Is AI Guard free?

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

### How do I add AI Guard to Claude Code?

Run this command in your terminal: claude mcp add ai-guard -- npx -y eslint-plugin-ai-guard

### What are the best alternatives to AI Guard?

The closest alternatives to AI Guard are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## 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.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [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.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

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