Skip to main content
MCP server CX Codex

database-mcp — Claude Code MCP server: what it does, how to install

database-mcp is a Claude Code MCP server that connects PostgreSQL, MySQL, and SQLite databases. It handles folder-scoped connection groups, pre-mutation snapshots, rollbacks, and query history.

MIT ★ 5 updated 2026-08-26

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add database-mcp -- npx -y @cocaxcode/database-mcp
Open on GitHub

What database-mcp does

The server links database engines directly to the coding assistant without external cloud platforms. Credentials stay on the local machine. The assistant inspects schema structures through db://schema resources, identifies foreign keys, and generates SQL queries with proper table joins.

Every write operation creates a snapshot for rollback via reverse SQL. Destructive operations like bulk deletes require explicit confirmation before execution. The toolset also covers full database dumps, schema inspection, and execution history with timestamps.

Connections stay organized in groups tied to project directories, requiring Node.js 20 or higher to run via npx. The first connection in a group acts as the default, resetting active switches back after a session restart.

What it helps with

  • inspect schemas and run SQL on PostgreSQL, MySQL, or SQLite
  • generate queries with joins based on foreign keys
  • roll back unintended row changes using reverse SQL
  • isolate database connections per project directory
  • dump database structure and data directly from chat

Example prompts for the agent

  • Add a PostgreSQL connection for myapp on port 5432 with user admin in the backend group
  • Fetch the latest 10 orders including the customer name
  • Remove inactive users from the accounts table

How to install database-mcp

Platform CLI

claude mcp add database-mcp -- npx -y @cocaxcode/database-mcp

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 database-mcp

How to install database-mcp in Claude Code?

Run claude mcp add database-mcp -- npx -y @cocaxcode/database-mcp in your terminal.

What does database-mcp do?

It provides tools for running SQL queries, reading table schemas, generating database dumps, and rolling back mutations.

What is required to run database-mcp?

The server requires Node.js 20 or newer alongside an accessible PostgreSQL, MySQL, or SQLite instance.

Similar MCP servers

All MCP servers for Data and databases →
sql-database-assistant Alireza Rezvani sql-database-assistant is a Claude Code skill that writes SQL, inspects schemas, reviews query performance, and prepares migrations for database and ORM work. CX Codex +1 727installs database-optimizer https://github.com/Jeffallan database-optimizer investigates slow PostgreSQL and MySQL queries, breaks down execution plans with EXPLAIN ANALYZE, and drafts indexes without table locks. CX Codex +1 6,500installs relational-database-mcp-cloudbase TencentCloudBase relational-database-mcp-cloudbase operates existing CloudBase MySQL through MCP tools: queries, schema changes, permissions, destruction. New projects should use PostgreSQL instead. CX Codex +1 962installs database-schema-designer borghei database-schema-designer — a Claude Code skill that turns product requirements into a normalized relational schema with tables, ORM models, RLS, indexes and migrations. Works across six platforms, including Codex, Cursor and Gemini CLI. CX Codex +1 183installs database-schema-design aj-geddes database-schema-design designs relational database schemas with normalization, constraints, and table relationships. Built for modeling data in PostgreSQL and MySQL. CX Codex +1 599installs database-migration-management aj-geddes database-migration-management is a Claude Code skill for planning schema migrations, rollbacks, and data transformations in PostgreSQL and MySQL. It supports table versioning and non-blocking index creation. CX Codex +1 505installs

Project sponsors

Companies that keep this analytics open