# Db Conn MCP

> Db Conn MCP is an MCP server for databases. Self-hosted server for letting AI agents explore and query PostgreSQL safely. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Platforms:** CLI, self-hosted, macOS, Linux, Windows
- **Repository:** https://github.com/idle-sync/db-conn-mcp
- **MCP Registry name:** io.github.Idle-Sync/db-conn-mcp
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-11-18

## About

db-conn-mcp keeps database access simple: a static `connections.json` file and the database's own read-only transactions, instead of custom auth servers or SQL parsing. Version 1 supports PostgreSQL only, with database-specific code behind a `Dialect` seam so MySQL or SQLite could be added later.

For connections in `read` mode every query runs in a native read-only transaction, and the read tool accepts only a single read-only statement. For a hard guarantee the README suggests pointing the DSN at a read-only role. Connection strings and passwords are never logged or returned, and failures come back as sanitized diagnostics. Writes are tiered: the connection mode, then a dry-run preview that must precede a commit, then optional per-database `yolo` trust, then explicit consent.

An interactive `db-conn-mcp setup` wizard registers a database and writes the server into nine popular AI clients' config formats, and `db-conn-mcp gui` opens a local dashboard that also checks clients can launch it. It needs Python 3.12 or newer and installs with pipx or pip. Optional fallback ports help with SSH tunnels that change port.

## Features

- **Native read-only mode:** Read connections run in read-only transactions and accept one read statement.
- **Secret hygiene:** DSNs and passwords are never logged or returned.
- **Tiered write safety:** Mode, dry-run preview, yolo trust and consent gate writes.
- **Setup wizard:** Registers a database and configures nine AI clients.
- **Local dashboard:** `db-conn-mcp gui` manages connections and tests client launch.
- **Fallback ports:** Probes listed ports when the primary refuses, for tunnels.

## Good for

- Let an agent explore a production schema read-only
- Run exploratory queries against a staging database
- Preview a write before committing it
- Wire one database into several AI clients at once

## Install

### Claude Code (Terminal)

```sh
claude mcp add db-conn-mcp -- uvx db-conn-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "db-conn-mcp": {
      "command": "uvx",
      "args": [
        "db-conn-mcp"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "db-conn-mcp": {
      "command": "uvx",
      "args": [
        "db-conn-mcp"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "db-conn-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "db-conn-mcp"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "db-conn-mcp": {
      "command": "uvx",
      "args": [
        "db-conn-mcp"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "db-conn-mcp": {
      "command": "uvx",
      "args": [
        "db-conn-mcp"
      ]
    }
  }
}
```

## Tools

- `list_databases`: Lists configured databases and their active port.
- `check_database`: Checks a configured database connection.

## FAQ

### Which databases are supported?

PostgreSQL in v1.

### Can an agent write to my database?

Only on connections in `write` mode, after a dry-run preview and consent unless `yolo` is set.

### Are my credentials exposed?

No. DSNs are never shown by any tool, and errors are sanitized.

### What Python version is needed?

Python 3.12 or newer.

### How do I add Db Conn MCP to Claude Code?

Run this command in your terminal: claude mcp add db-conn-mcp -- uvx db-conn-mcp

### What are the best alternatives to Db Conn MCP?

The closest alternatives to Db Conn MCP are Midplane, Postgres Secured (Aegis Zero-Trust), ArcadeDB, Seqora and Snowflake timestamp bits, id discarded.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [Postgres Secured (Aegis Zero-Trust)](https://ai-powered.com/mcp/postgres-secured-aegis-zero-trust): Postgres Secured (Aegis Zero-Trust) is an open-source MCP server for databases.
- [ArcadeDB](https://ai-powered.com/mcp/arcadedb): ArcadeDB is an open-source MCP server for databases.
- [Seqora](https://ai-powered.com/mcp/seqora): Seqora is a freemium MCP server for databases.
- [Snowflake timestamp bits, id discarded](https://ai-powered.com/mcp/snowflake-timestamp-bits-id-discarded): Snowflake timestamp bits, id discarded is an MCP server for databases.
- [Snowflake id shape](https://ai-powered.com/mcp/snowflake-id-shape): Snowflake id shape is an MCP server for databases.
- [Snowflake worker-id bits, id discarded](https://ai-powered.com/mcp/snowflake-worker-id-bits-id-discarded): Snowflake worker-id bits, id discarded is an MCP server for databases.
- [Snowflake sequence bits, id discarded](https://ai-powered.com/mcp/snowflake-sequence-bits-id-discarded): Snowflake sequence bits, id discarded is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/db-conn-mcp
