# Code Guard MCP server

> Scans AI-generated code snippets or diffs for security vulnerabilities like injection, hardcoded secrets, and unsafe deserialization.

- Repository: https://github.com/mlawsonking/MCP
- Page: https://hostedmcp.org/servers/mlawsonking/code-guard-mcp
- Transport: stdio
- Stars: 1
- License: MIT
- Latest version: 1.3.0

## Install

### Claude Code

```sh
claude mcp add code-guard-mcp -- npx -y @mlawsonking/code-guard-mcp
```

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

```json
{
  "mcpServers": {
    "code-guard-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@mlawsonking/code-guard-mcp"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "code-guard-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@mlawsonking/code-guard-mcp"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"code-guard-mcp","type":"stdio","command":"npx","args":["-y","@mlawsonking/code-guard-mcp"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "code-guard-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@mlawsonking/code-guard-mcp"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add code-guard-mcp -- npx -y @mlawsonking/code-guard-mcp
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.code-guard-mcp]
command = "npx"
args = ["-y", "@mlawsonking/code-guard-mcp"]
```

### Gemini CLI

```sh
gemini mcp add -s user code-guard-mcp npx -- -y @mlawsonking/code-guard-mcp
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "code-guard-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@mlawsonking/code-guard-mcp"
      ]
    }
  }
}
```

## Tools (3)

- `scan_code`: Scan a code snippet for the vulnerability classes that show up most in generated code: injection, SSRF, hardcoded secrets, weak crypto, unsafe deserialization, disabled TLS, XSS. Regex rules matched line by line — no parser, no data flow, no taint tracking. JS/TS and Python only. Fully local. Runs fully locally: the input never leaves this machine.
- `scan_diff`: Scan only the added lines of a unified diff, reporting findings against the new file line numbers. Use this on a patch before committing so untouched code does not drown the result. Fully local. Runs fully locally: the input never leaves this machine.
- `list_rules`: List the rule catalog so you can see the coverage and the gaps: rule id, category, severity, language. The grouped hardcoded-* entry stands in for the secret and PII ruleset. Fully local. Runs fully locally: the input never leaves this machine.

## FAQ

### What security vulnerabilities does it detect?

It identifies command, code, and SQL injection, SSRF, hardcoded secrets, weak crypto, unsafe deserialization, disabled TLS verification, XSS, and personal data.

### Which programming languages are supported?

The server supports JS/TS and Python, with specific rulesets for each and a language-agnostic set.

### Is this a full SAST tool?

No, it is a rule-based text scanner using regex rather than a full parser or data flow analysis.

### How are rule updates handled?

The server checks for a newer ruleset approximately once a day and applies signed updates automatically.
