Dbmcp logo

Dbmcp

Connect AI assistants to MySQL, MariaDB, PostgreSQL, or SQLite for schema discovery, SQL access, DDL, and query explanations.

Install Dbmcp

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "dbmcp": {
      "command": "npx",
      "args": [
        "-y",
        "@haymon-ai/dbmcp"
      ],
      "env": {
        "DBMCP_DB_BACKEND": "YOUR_VALUE_HERE",
        "DBMCP_DB_HOST": "YOUR_VALUE_HERE",
        "DBMCP_DB_PORT": "YOUR_VALUE_HERE",
        "DBMCP_DB_USER": "YOUR_VALUE_HERE",
        "DBMCP_DB_PASSWORD": "YOUR_VALUE_HERE",
        "DBMCP_DB_NAME": "YOUR_VALUE_HERE",
        "DBMCP_TRANSPORT": "YOUR_VALUE_HERE",
        "DBMCP_HTTP_AUTH_TOKEN": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y @haymon-ai/dbmcp

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

dbmcp connects MCP-compatible AI assistants to MySQL, MariaDB, PostgreSQL, and SQLite through a single binary with no runtime dependencies. It provides schema discovery, query execution, database and table DDL, and query explanation tools, with read-only mode enabled by default. Use stdio when an MCP client manages the process, or HTTP when serving remote or multiple clients. SSH tunneling is available for MySQL, MariaDB, and PostgreSQL connections through a bastion host.

Use cases

  • Inspect database schemas from an AI assistant
  • Run read-only SQL queries against production data
  • Explore tables, views, triggers, and routines
  • Explain SQL query execution plans
  • Connect to a private database through an SSH bastion

Key features

  • Supports MySQL, MariaDB, PostgreSQL, and SQLite
  • Provides schema discovery and metadata tools
  • Offers read and write SQL query operations
  • Includes database and table DDL tools
  • Supports stdio and HTTP transports
  • Includes embedded SSH tunneling for server databases

Tools1

What Dbmcp lets your agent do. Expand a tool for its parameters.

Self-reported~63 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

26/26 checks healthy over the last 111d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 3d ago via OSV.dev · @haymon-ai/dbmcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars33Stargazers on the source repository.
npm downloads1.3kPackage downloads in the last 30 days.
Last commit4d agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed1Callable tools this server registers over MCP.
Directory activity6 viewsConfig copies, upvotes, and views on AllMCPs.

How Dbmcp works

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.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Dbmcp

dbmcp is an MCP server that connects AI assistants to MySQL, MariaDB, PostgreSQL, and SQLite databases. Its main tools cover schema discovery, reading and writing SQL queries, database and table DDL, and query explanation, with read-only mode available to hide write operations.

Install dbmcp with the macOS, Linux, WSL, Windows PowerShell, or Windows CMD installer. Docker, Cargo, and other methods are also available. After installation, configure an MCP client to run the `dbmcp` command with the database environment variables or a YAML configuration file.

Yes, dbmcp supports Cursor through its stdio transport. Add a `dbmcp` entry to the client’s `.mcp.json` configuration, set the database environment variables, and let Cursor start the executable.

Set `DBMCP_DB_BACKEND=postgres` and provide the PostgreSQL host, user, database name, and any required port or password settings. For a private PostgreSQL instance, configure the SSH bastion variables so dbmcp reaches the database through the tunnel.

Read-only mode is enabled by default through `DBMCP_DB_READ_ONLY=true`. In that mode, dbmcp hides `writeQuery`, `createDatabase`, `dropDatabase`, and `dropTable` from the MCP tool set.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewDbmcp AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/dbmcp?style=directory)](https://allmcps.com/mcp/dbmcp)
HTML Embed
<a href="https://allmcps.com/mcp/dbmcp"><img src="https://allmcps.com/api/badge/dbmcp?style=directory" alt="Dbmcp on AllMCPs" /></a>