# Berth

**Category:** 🗄️ Databases  
**Repository:** https://github.com/seayniclabs/berth  
**GitHub Stars:** 0  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/berth

## Description
Database management — query, schema inspection, migrations for PostgreSQL, MySQL, SQLite.

## Tools
Capabilities this server exposes over MCP:

- **health** — Server health check
- **db_connect** — Connect to a database
- **db_query** — Execute a SELECT query (auto-adds LIMIT 1000)
- **db_execute** — Execute INSERT/UPDATE/DELETE (respects safety mode)
- **db_schema** — List tables, views, and indexes
- **db_describe** — Column details for a table
- **db_relationships** — Foreign key relationships
- **db_size** — Database and table sizes
- **db_active_queries** — Currently running queries (PostgreSQL only)
- **db_explain** — Run EXPLAIN ANALYZE on a query
- **generate_migration** — Generate migration SQL by comparing schemas
- **db_backup** — Create a database backup
- **db_restore** — Restore from backup (admin mode + confirmation token)

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "berth": {
    "command": "uvx",
    "args": ["berth-mcp"],
    "env": {
      "BERTH_BACKUP_DIR": ""
    }
  }
}
```

**Requires environment variables:** `BERTH_BACKUP_DIR` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Berth MCP server does

Berth MCP server connects MCP-compatible AI clients to PostgreSQL, MySQL, and SQLite databases. It provides tools for opening database connections, running read and write SQL, inspecting schema metadata, reviewing relationships and storage use, analyzing queries, generating migration SQL, and handling database backups and restores.

The server is intended for database work performed through an AI assistant rather than for direct interactive use. It communicates over stdio and is launched by an MCP client. PostgreSQL includes activity inspection and native backup and restore support; SQLite and MySQL use their respective database inspection and command-line backup mechanisms.

## How it works

A client first calls `db_connect` with a database connection string and receives a connection identifier for later operations. `db_query` runs SELECT statements and automatically adds a limit of 1,000 rows. `db_execute` handles INSERT, UPDATE, and DELETE statements subject to the active safety mode.

The default mode is read-only. Write mode must be explicitly enabled and permits selected data changes and CREATE operations while blocking destructive patterns such as DROP, TRUNCATE, ALTER DROP, and deletes without a WHERE clause. Admin mode permits broader operations, but destructive actions require a one-time confirmation token that expires after 60 seconds.

## Setup and configuration

Install the package from PyPI with `pip install berth-mcp`, or use `pipx install berth-mcp` for an isolated installation. PostgreSQL and SQLite drivers are included. MySQL support requires the optional extra:

```bash
pip install berth-mcp[mysql]
```

Start the process with `berth`. Claude Code can register it with `claude mcp add berth -- berth`. Claude Desktop requires an MCP server entry whose command is `berth`; installations inside a virtual environment can specify the executable's full path.

`BERTH_BACKUP_DIR` sets the directory allowed for backup and restore files. If it is not set, the current working directory is used. Backup and restore paths are checked to remain inside this directory.

## Tools and capabilities

The Berth MCP server exposes tools for:

- Checking service health and creating database connections.
- Running bounded SELECT queries and safety-checked data modification statements.
- Listing tables, views, indexes, columns, and foreign-key relationships.
- Reporting database and table sizes.
- Viewing active queries on PostgreSQL databases.
- Running `EXPLAIN ANALYZE` for query investigation.
- Comparing a live schema with target DDL or comparing two live databases to produce dialect-aware migration SQL.
- Creating backups and restoring them with admin mode and confirmation.

Migration output can add tables, columns, indexes, and constraints. Changes that would drop tables or columns are emitted as commented warnings rather than executable destructive statements. SQLite-specific limitations and table-rebuild guidance are included when its DDL support does not cover an operation directly.

## Limitations and notes

Write and admin access are opt-in; normal startup does not permit writes. Restore operations and destructive SQL need the appropriate mode and confirmation token. Active-query inspection is available only for PostgreSQL.

The server validates table names used for SQLite introspection, uses parameterized queries, masks passwords in connection-related output, and rejects backup paths outside the configured directory. It is not documented as a standalone database shell: an MCP client is expected to start and communicate with the process.

_Full upstream README: https://allmcps.com/mcp/berth/readme_

