# Universal DB (read-only)

> Universal DB (read-only) is an open-source MCP server for databases. Read-only guarded SQL access to eight database engines for AI agents. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted
- **Website:** https://alghanim.github.io/universal-db-mcp/
- **Repository:** https://github.com/alghanim/universal-db-mcp
- **MCP Registry name:** io.github.alghanim/universal-db-mcp
- **Categories:** databases, security
- **Listing updated:** 2026-11-15

## About

A write is refused rather than discouraged. Each statement is parsed into a syntax tree and walked before it runs: one statement per call, no DML, DDL, SELECT INTO or locking hints even inside a CTE, only allowlisted functions, and schema-qualified tables inside your allowlist. If it cannot be parsed, it is refused.

Sessions are pinned read-only on PostgreSQL, MySQL, MariaDB, ClickHouse and SQLite, Db2 runs at UR and SQL Server at READ UNCOMMITTED, and the connection fails closed if the server refuses. Results are capped by rows, bytes and cells, sensitive-looking columns are masked, and every call is audited.

Beyond querying, 29 tools cover catalog browsing, profiling, value search across connections, schema review, a Markdown data dictionary and federated reads or joins across connections. It is Apache-2.0, ships as an OCI image over stdio, and never calls an LLM.

## Features

- **Parsed SQL guard:** Walks a full syntax tree and refuses anything that is not a single read.
- **Read-only sessions:** Pins sessions to read-only or non-locking isolation and fails closed otherwise.
- **Masked, bounded output:** Caps rows, bytes and cells and masks passwords, tokens and card-like values.
- **Audit trail:** Logs every call with a SQL fingerprint.
- **Schema discovery tools:** Lists tables, columns, indexes and relationships, and profiles tables on a sample.
- **Federated queries:** Runs one question across several connections or joins results from two.
- **Generated documentation:** Produces a Markdown data dictionary from catalog metadata without row values.

## Good for

- Let a coding agent inspect a production schema safely
- Find which tables across databases hold a given value
- Generate a data dictionary for an undocumented database
- Review a schema for optimization findings
- Reconcile results from two different database engines

## Install

### Claude Code (Terminal)

```sh
claude mcp add universal-db-mcp -- docker run -i --rm ghcr.io/alghanim/universal-db-mcp:0.2.0
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "universal-db-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/alghanim/universal-db-mcp:0.2.0"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "universal-db-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/alghanim/universal-db-mcp:0.2.0"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "universal-db-mcp": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/alghanim/universal-db-mcp:0.2.0"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "universal-db-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/alghanim/universal-db-mcp:0.2.0"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "universal-db-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/alghanim/universal-db-mcp:0.2.0"
      ]
    }
  }
}
```

## Tools

- `db_query`: Runs a validated, bounded read-only query.
- `db_validate_query`: Checks a statement against the guard without running it.
- `db_list_tables`: Lists tables in a schema.
- `db_get_table`: Returns details of one table.
- `db_explain`: Shows query plans without executing them.
- `db_profile_table`: Profiles a table on a bounded sample.
- `db_search_values`: Finds a value across tables and connections without writing SQL.
- `db_review_schema`: Returns prioritized optimization findings.
- `db_document_schema`: Produces a Markdown data dictionary.
- `db_federated_query`: Runs one statement, or one per connection, and merges results.
- `db_federated_join`: Runs a bounded hash join across two connections.

## FAQ

### Which databases are supported?

PostgreSQL, MySQL, MariaDB, ClickHouse, Oracle, SQL Server, Db2 and SQLite.

### Can it write data?

No. There is no write mode, and configuration that enables writes is rejected when it loads.

### Does it call an LLM or send telemetry?

The README says it never calls an LLM, sends no telemetry and installs nothing at runtime.

### Is the guard the only protection?

No. The README names the database login as the primary control, so give each connection a SELECT-only login limited to listed schemas.

### What licence is it under?

Apache-2.0.

### Is Universal DB (read-only) free?

Yes. Universal DB (read-only) is open source, so you can use and self-host it for free.

### How do I add Universal DB (read-only) to Claude Code?

Run this command in your terminal: claude mcp add universal-db-mcp -- docker run -i --rm ghcr.io/alghanim/universal-db-mcp:0.2.0

### What are the best alternatives to Universal DB (read-only)?

The closest alternatives to Universal DB (read-only) are REA, Agent Roast, Midplane, Leash and Tinplate Edge AI Safety, Security & EU Compliance.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Agent Roast](https://ai-powered.com/mcp/agent-roast): Agent Roast is an open-source MCP server for developer tools.
- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [Leash](https://ai-powered.com/mcp/leash): Leash is a free MCP server for security.
- [Tinplate Edge AI Safety, Security & EU Compliance](https://ai-powered.com/mcp/tinplate-edge-ai-safety-security-and-eu-compliance): Tinplate Edge AI Safety, Security & EU Compliance is a freemium MCP server for security.
- [SecureCloud](https://ai-powered.com/mcp/securecloud): SecureCloud is a free MCP server for security.
- [Eikino](https://ai-powered.com/mcp/eikino): Eikino is a freemium MCP server for security.
- [SynomosAI Governance MCP](https://ai-powered.com/mcp/synomosai-governance-mcp-2): SynomosAI Governance MCP is an open-source MCP server for security.

---
Source: https://ai-powered.com/mcp/universal-db-read-only
