# codeDB Lens

> codeDB Lens is a free MCP server for databases. Read-only health checks and data questions for SQL Server and PostgreSQL. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** Windows, Linux, CLI
- **Website:** https://lens.codedb.com.br/mcp/
- **Repository:** https://github.com/codedb-io/codedb-lens
- **MCP Registry name:** io.github.codedb-io/codedb-lens
- **Categories:** databases, developer tools
- **Listing updated:** 2026-11-14

## About

Database diagnosis usually means running a pile of scripts by hand. codeDB Lens does it with a read-only login and a catalog of evidence-based rules, then produces an A to F grade with a coverage seal showing how many rules could actually run. The README lists 26 rules plus 8 for recordings, covering things like missing backups, failing SQL Agent jobs, blocked sessions, unused indexes, replication lag and transaction ID wraparound risk.

The MCP server is started by your AI client on your own computer, opens no port and installs nothing on the database server. The login you give decides its use. A minimal login lets the assistant run the health check, read recordings and explain what to fix without reading business data. A login that can read chosen tables lets it list tables, describe them and run SELECT queries to answer questions or compare periods.

Saved connection profiles keep passwords out of the AI's view, and a redact flag masks host, database and object names. The Lens itself makes no network call, though your AI client sends results to its model provider. The installer commands target Claude Desktop, VS Code, Cursor and Claude Code, and three prompts are provided: diagnose, incident and explore_data.

## Features

- **Graded health check:** Runs rules and returns an A to F grade with a coverage seal.
- **Evidence for findings:** Each finding shows collected values, the query behind it and when it ran.
- **Run comparison:** Compares saved runs for new, resolved and persisting findings.
- **Recordings:** Reports on a period recorded from an instance, such as an earlier slowdown.
- **Two login modes:** A minimal login for diagnosis, or a table-reading login for data questions.
- **Redaction:** A flag masks host, database, object, login and file names in results.
- **Client installer:** Adds itself to Claude Desktop, VS Code, Cursor or prints the Claude Code command.

## Good for

- Ask what to fix first on a production SQL Server
- Find out what caused yesterday's slowdown
- Answer sales questions from a PostgreSQL table with a read-only login
- Compare this month's orders with last year's

## Install

### Claude Code (Terminal)

```sh
claude mcp add codedb-lens --env CODEDB_LENS_PASSWORD='<CODEDB_LENS_PASSWORD>' -- docker run -i --rm -e CODEDB_LENS_PASSWORD ghcr.io/codedb-io/codedb-lens:0.9.1
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "codedb-lens": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CODEDB_LENS_PASSWORD",
        "ghcr.io/codedb-io/codedb-lens:0.9.1"
      ],
      "env": {
        "CODEDB_LENS_PASSWORD": "<CODEDB_LENS_PASSWORD>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "codedb-lens": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CODEDB_LENS_PASSWORD",
        "ghcr.io/codedb-io/codedb-lens:0.9.1"
      ],
      "env": {
        "CODEDB_LENS_PASSWORD": "<CODEDB_LENS_PASSWORD>"
      }
    }
  }
}
```

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

```json
{
  "servers": {
    "codedb-lens": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CODEDB_LENS_PASSWORD",
        "ghcr.io/codedb-io/codedb-lens:0.9.1"
      ],
      "env": {
        "CODEDB_LENS_PASSWORD": "<CODEDB_LENS_PASSWORD>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "codedb-lens": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CODEDB_LENS_PASSWORD",
        "ghcr.io/codedb-io/codedb-lens:0.9.1"
      ],
      "env": {
        "CODEDB_LENS_PASSWORD": "<CODEDB_LENS_PASSWORD>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "codedb-lens": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CODEDB_LENS_PASSWORD",
        "ghcr.io/codedb-io/codedb-lens:0.9.1"
      ],
      "env": {
        "CODEDB_LENS_PASSWORD": "<CODEDB_LENS_PASSWORD>"
      }
    }
  }
}
```

## Tools

- `list_profiles`: Profiles the AI may use, never passwords
- `check`: Run the health check and save the report
- `get_finding`: One rule of a saved run with its evidence rows
- `history`: List saved runs
- `compare`: New, resolved and persisting findings between two runs
- `list_rules`: The rule catalog
- `explain_rule`: What a rule measures, its SQL and documentation
- `list_recordings`: List recordings
- `recording_report`: Report of a recorded period
- `record_command`: The record command to run in a terminal
- `list_databases`: List databases
- `list_tables`: List tables
- `describe`: Describe a table

## FAQ

### Can it change my database?

The README says it is read-only: no DDL, no DML and no agent on the server.

### Does the AI see my passwords?

No. Saved profiles hold passwords, and the AI never sees them.

### Which databases are supported?

SQL Server and PostgreSQL.

### Is data sent anywhere?

The Lens makes no network call, but your AI client sends what it returns to the model provider.

### Is codeDB Lens free?

Yes. codeDB Lens is free to use.

### How do I add codeDB Lens to Claude Code?

Run this command in your terminal: claude mcp add codedb-lens --env CODEDB_LENS_PASSWORD='<CODEDB_LENS_PASSWORD>' -- docker run -i --rm -e CODEDB_LENS_PASSWORD ghcr.io/codedb-io/codedb-lens:0.9.1

### What are the best alternatives to codeDB Lens?

The closest alternatives to codeDB Lens 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/codedb-lens
