# dbmcp [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/haymon-ai/dbmcp  
**GitHub Stars:** 33  
**npm Downloads (last month):** 1321  
**Views:** 6  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/dbmcp

## Description
Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite

## Tools
Capabilities this server exposes over MCP:

- **search** — optional case-insensitive substring filter: `users` matches `users`, `users_audit`, and `old_users`. The value is wrapped as `%users%` in a `LIKE`/`ILIKE` pattern, so `%` and `_` inside it still act as wildcards. Keep it identical across pages.

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

```json
"mcpServers": {
  "dbmcp": {
    "command": "npx",
    "args": ["-y","@haymon-ai/dbmcp"],
    "env": {
      "DBMCP_DB_BACKEND": "",
      "DBMCP_DB_HOST": "",
      "DBMCP_DB_PORT": "",
      "DBMCP_DB_USER": "",
      "DBMCP_DB_PASSWORD": "",
      "DBMCP_DB_NAME": "",
      "DBMCP_TRANSPORT": "",
      "DBMCP_HTTP_AUTH_TOKEN": ""
    }
  }
}
```

**Requires environment variables:** `DBMCP_DB_BACKEND`, `DBMCP_DB_HOST`, `DBMCP_DB_PORT`, `DBMCP_DB_USER`, `DBMCP_DB_PASSWORD`, `DBMCP_DB_NAME`, `DBMCP_TRANSPORT`, `DBMCP_HTTP_AUTH_TOKEN` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What dbmcp does

dbmcp exposes SQL database operations through the Model Context Protocol. One executable supports MySQL, MariaDB, PostgreSQL, and SQLite, allowing an MCP-compatible assistant to inspect database structure and work with SQL without requiring Python, Node.js, Docker, or a separate runtime.

Its database tools cover discovery and data operations. Clients can list databases, tables, views, triggers, functions, procedures, and materialized views. They can also read queries, write queries, create or drop databases, drop tables, and request query plans with `explainQuery`. Schema responses can include table kind, owner, comments, columns, constraints, indexes, and triggers. View, trigger, function, and procedure metadata includes backend-specific properties such as definitions, definers, security settings, volatility, determinism, SQL data access, and parallel-safety information.

Read-only mode is enabled by default and removes write-oriented tools from the available MCP surface. This makes dbmcp suitable for assistants that should inspect or query a database without modifying it.

## How it works

dbmcp supports two transports. With stdio, the MCP client starts and manages the `dbmcp` process. With HTTP, an operator starts the process and the client connects to its `/mcp` endpoint. HTTP can run on loopback without a token, while binding to a non-loopback address requires a bearer token.

Database settings can be supplied through `DBMCP_*` environment variables, an environment file, or a YAML configuration file. Configuration precedence is process environment, then environment files, then configuration files, then backend defaults. Multiple configuration or environment files can be layered, with later files taking precedence. YAML values support `${}` interpolation.

For MySQL, MariaDB, and PostgreSQL, an embedded SSH client can connect through a bastion host. It supports password or key authentication, known-host verification, and reconnect behavior. The database host and port are resolved from the bastion side of the tunnel.

## Setup and configuration

Installers are available for macOS, Linux, WSL, Windows PowerShell, and Windows CMD. Docker, Cargo, and other installation methods are also supported. After installation, configure an MCP client with the `dbmcp` command and the relevant environment variables.

A typical database setup selects a backend and provides the database name, user, host, port, and password as needed. SQLite uses a database path for `DBMCP_DB_NAME`. A YAML file can be passed with `--config-file`; an environment file can be passed with `--env-file`. When using HTTP, set `DBMCP_TRANSPORT=http`, then configure the client with an HTTP URL and the required `type: "http"` field.

Use `DBMCP_HTTP_AUTH_TOKEN` for authenticated HTTP access. Host and Origin allowlists protect against browser DNS rebinding but are not substitutes for authentication. Exposing HTTP on all interfaces without a bearer token is rejected.

## Tools and capabilities

- Discover databases, tables, views, triggers, functions, procedures, and materialized views.
- Paginate database and table listings with cursors.
- Search tables using case-insensitive `LIKE` or `ILIKE` patterns.
- Retrieve detailed table metadata, including columns, constraints, indexes, and triggers.
- Read and write SQL queries, subject to the configured read-only setting.
- Create databases, drop databases, and drop tables when write tools are enabled.
- Explain query execution plans.
- Connect through an SSH bastion for supported server databases.

SQLite does not provide the `listDatabases` operation, and SSH tunneling is limited to MySQL, MariaDB, and PostgreSQL.

## Limitations and notes

Backend capabilities vary, so not every discovery operation is available for every database. SQLite has no database parameter for table listing and does not support database enumeration. Read-only mode hides `writeQuery`, `createDatabase`, `dropDatabase`, and `dropTable` rather than merely blocking them after exposure.

HTTP access requires careful network configuration. The default Origin policy allows browser pages from any port on localhost addresses, so shared or development machines may need an explicit allowed-origin list or an authentication token. Relative configuration-file paths are resolved from the MCP process working directory controlled by the client.

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

