Skip to main content
MCP server CX Codex

dbmcp — database MCP server for Claude Code

Connect an AI agent to MySQL, MariaDB, PostgreSQL, or SQLite to inspect database structure and run queries from your development setup.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env HTTP_HOST=<HTTP_HOST> --env HTTP_PORT=<HTTP_PORT> --env HTTP_ALLOWED_ORIGINS=<HTTP_ALLOWED_ORIGINS> --env HTTP_ALLOWED_HOSTS=<HTTP_ALLOWED_HOSTS> --env HTTP_AUTH_TOKEN=<HTTP_AUTH_TOKEN> --transport stdio dbmcp -- docker run -i --rm -e HTTP_HOST -e HTTP_PORT -e HTTP_ALLOWED_ORIGINS -e HTTP_ALLOWED_HOSTS -e HTTP_AUTH_TOKEN ghcr.io/haymon-ai/dbmcp:0.15.1
Open on GitHub

What dbmcp does

dbmcp exposes tools for browsing databases, tables, views, and other schema objects, along with tools for reading queries. It supports MySQL, MariaDB, PostgreSQL, and SQLite, and includes explainQuery for examining query plans. Read-only mode hides tools that write or delete data.

Run the server over stdio or HTTP. An SSH tunnel can connect to MySQL, MariaDB, or PostgreSQL through a bastion host. The Claude Code install command below starts a Docker image, so Docker is required for that setup. When HTTP listens on an external interface, set HTTP_AUTH_TOKEN.

What it helps with

  • inspect tables and other database objects
  • read results from a SQL query
  • examine a query execution plan
  • restrict an agent from using write tools

Example prompts for the agent

  • List the tables and views in the connected database.
  • Run a read query to show the latest records.
  • Use explainQuery to inspect this query plan.

How to install dbmcp

Platform CLI

claude mcp add --env HTTP_HOST=<HTTP_HOST> --env HTTP_PORT=<HTTP_PORT> --env HTTP_ALLOWED_ORIGINS=<HTTP_ALLOWED_ORIGINS> --env HTTP_ALLOWED_HOSTS=<HTTP_ALLOWED_HOSTS> --env HTTP_AUTH_TOKEN=<HTTP_AUTH_TOKEN> --transport stdio dbmcp -- docker run -i --rm -e HTTP_HOST -e HTTP_PORT -e HTTP_ALLOWED_ORIGINS -e HTTP_ALLOWED_HOSTS -e HTTP_AUTH_TOKEN ghcr.io/haymon-ai/dbmcp:0.15.1

Replace <…> with your own values

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about dbmcp

How do I install dbmcp in Claude Code?

Run `claude mcp add --env HTTP_HOST=<HTTP_HOST> --env HTTP_PORT=<HTTP_PORT> --env HTTP_ALLOWED_ORIGINS=<HTTP_ALLOWED_ORIGINS> --env HTTP_ALLOWED_HOSTS=<HTTP_ALLOWED_HOSTS> --env HTTP_AUTH_TOKEN=<HTTP_AUTH_TOKEN> --transport stdio dbmcp -- docker run -i --rm -e HTTP_HOST -e HTTP_PORT -e HTTP_ALLOWED_ORIGINS -e HTTP_ALLOWED_HOSTS -e HTTP_AUTH_TOKEN ghcr.io/haymon-ai/dbmcp:0.15.1`. This setup uses Docker.

What does dbmcp do?

It connects an AI agent to MySQL, MariaDB, PostgreSQL, or SQLite through MCP. The agent can inspect database structure and run queries.

Can dbmcp prevent database writes?

Yes. In read-only mode, the server hides tools for writing, creating databases, and dropping databases or tables.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor