# Code Guardian

> Code Guardian is an open-source MCP server for security. Static-analysis MCP server that grades a repo A to F for safety, function and completeness. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted, Linux, macOS, Windows
- **Repository:** https://github.com/luminarisoftwares/code-guardian
- **MCP Registry name:** io.github.LuminariSoftwares/code-guardian
- **Categories:** [security](https://ai-powered.com/categories/security), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-23

## About

Before running a cloned repository or merging an assistant's rewrite, you get three scores out of 100: Safe, Works and Complete, combined into an Overall grade. Checks are deterministic with fixed weights, and nothing is executed, imported or installed. A scan makes no network calls. The README is clear that grade A means nothing the scanners recognise, not proven safe.

Python is analysed in full through its parse tree, JavaScript and TypeScript at token level, and other languages get only the secret scan and repo-hygiene checks. Every report prints a coverage line saying what was analysed and how. It also finds orphan code and offers a verify loop: run it before and after an AI-assisted change to see what the change fixed, what it broke and whether the scan can be trusted.

It ships as a CLI, GitHub Action, pre-commit hook and a hand-written stdio MCP server with no dependencies. An optional local model, set by environment variables, can write a plain-English explanation that never changes the score. Install the PyPI package code-guardian-mcp, not the unrelated code-guardian.

## Features

- **A-F repo grade:** Safe, Works and Complete scores combine into one grade.
- **Never executes code:** Parses source only; no imports, installs or network calls.
- **Fix planning:** The plan command lists the fixes worth the most Overall points.
- **Verify loop:** Compare scans before and after an AI-assisted change.
- **Orphan code detection:** Finds code unreachable from the project's entry points.
- **Optional local explanation:** A local model can explain findings without rescoring them.

## Good for

- Vet a cloned repository before running it
- Check whether an assistant's rewrite broke something
- Add a repo-grade gate to pre-commit or CI
- Find dead code in a Python project

## Install

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

```sh
claude mcp add code-guardian -- uvx code-guardian-mcp
```

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": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "code-guardian": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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 code-guardian -- uvx code-guardian-mcp
```

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

```toml
[mcp_servers.code-guardian]
command = "uvx"
args = ["code-guardian-mcp"]
```

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

```json
{
  "mcpServers": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user code-guardian uvx -- code-guardian-mcp

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

```json
{
  "mcpServers": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

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": {
    "code-guardian": {
      "command": "uvx",
      "args": [
        "code-guardian-mcp"
      ]
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, all 1 tool only read data. From the server's own tool labels and tool names; not verified by us.

- `explain` (name suggests: reads): Optionally explain findings in plain English using a local model.

## FAQ

### Does Code Guardian run the code it scans?

No. It parses source and never executes, imports or installs it.

### Does a grade A mean the code is safe?

No. The README says it means nothing the scanners recognise, not proven safe.

### Which languages are covered?

Python fully, JavaScript and TypeScript at token level, other languages secret scan and hygiene checks only.

### What do I install?

pip install code-guardian-mcp; a different project called code-guardian exists on PyPI.

### Is Code Guardian free?

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

### How do I add Code Guardian to Claude Code?

Run this command in your terminal: claude mcp add code-guardian -- uvx code-guardian-mcp

### What are the best alternatives to Code Guardian?

The closest alternatives to Code Guardian are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

## 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.
- [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.
- [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): 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.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/code-guardian
