# MySQL Audit

> MySQL Audit is an MCP server for databases. Deterministic MySQL migration and query safety review for coding agents. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Platforms:** CLI, self-hosted
- **Repository:** https://github.com/jimmyjan0824/mysql_audit_ai_agent
- **MCP Registry name:** io.github.jimmyjan0824/mysql-audit
- **Categories:** [databases](https://ai-powered.com/categories/databases), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-18

## About

The review is rule-based rather than another model's opinion. The README says the checks come from DBA experience and that each rule depending on server behaviour is tested against real MySQL 5.7, 8.0 and 8.4 in CI. The same SQL always gets the same verdict: safe, review or block.

Findings point to the line, explain what will happen in production and suggest a safer form, such as ALGORITHM=INSTANT, gh-ost, batching by primary key or expand and contract. Typical catches include silent table copies that block writes, DROP COLUMN on a column the previous release still reads, UPDATE or DELETE without WHERE, unbatched backfills, missing indexes, auto-increment overflow and SQL injection in application code in Python, JS/TS, PHP, Go and Java.

It never connects to your database and runs entirely on your machine over stdio, started with uvx. The same engine is available as a mysql-audit command-line tool with exit codes and as a GitHub Action that annotates pull requests. The status is beta.

## Features

- **Migration verdicts:** Returns safe, review or block with a line-level reason for each risk.
- **Safer rewrites:** Each finding includes a concrete fix such as batching or expand and contract.
- **Query and code review:** Flags unindexed WHERE and JOIN columns and SQL injection in application code.
- **Local and private:** Never connects to a database; SQL stays on your machine.
- **CLI and CI:** A mysql-audit command with exit codes 0, 1 and 2 works in any pipeline.
- **GitHub Action:** Reviews migrations in each pull request, annotates lines and can require DBA approval.

## Good for

- Check an ALTER TABLE before an agent runs it on production
- Stop an UPDATE or DELETE without WHERE
- Review a large backfill for replication lag
- Catch SQL injection in code an agent just wrote
- Gate pull request migrations in CI

## Install

### Claude Code (Terminal)

```sh
claude mcp add mysql-audit -- uvx mysql-audit-ai-agent
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mysql-audit": {
      "command": "uvx",
      "args": [
        "mysql-audit-ai-agent"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "mysql-audit": {
      "command": "uvx",
      "args": [
        "mysql-audit-ai-agent"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "mysql-audit": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mysql-audit-ai-agent"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "mysql-audit": {
      "command": "uvx",
      "args": [
        "mysql-audit-ai-agent"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "mysql-audit": {
      "command": "uvx",
      "args": [
        "mysql-audit-ai-agent"
      ]
    }
  }
}
```

## Tools

- `review_migration`: Reviews migration SQL and returns a verdict with findings
- `review_query`: Reviews a query
- `review_code`: Reviews application code for SQL issues
- `preflight_checks`: Runs pre-deploy checks

## FAQ

### Does it connect to my database?

No. It runs locally and never connects to your database, so SQL and data stay on your machine.

### Which MySQL versions are covered?

Server-behaviour rules are tested against MySQL 5.7, 8.0 and 8.4 in CI.

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

Run claude mcp add mysql-audit --scope user -- uvx mysql-audit-ai-agent@latest.

### Is it production ready?

The README marks it as beta and invites DBAs to report wrong results.

### Why does running it in a terminal seem to hang?

It is an MCP server waiting on stdin for a client; use the mysql-audit command to review files by hand.

### How do I add MySQL Audit to Claude Code?

Run this command in your terminal: claude mcp add mysql-audit -- uvx mysql-audit-ai-agent

### What are the best alternatives to MySQL Audit?

The closest alternatives to MySQL Audit 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-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.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers 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.

---
Source: https://ai-powered.com/mcp/mysql-audit
