Database MCP logo

Database MCP

Connects AI clients to PostgreSQL, MySQL, and SQLite with schema discovery, grouped connections, query history, and rollback.

Install Database MCP

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": {
    "database-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@cocaxcode/database-mcp@latest"
      ]
    }
  }
}

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

Automated check passed— started and listed 34 tools correctly (6d ago).

Overview

The database-mcp MCP server connects AI clients to PostgreSQL, MySQL, and SQLite through 33 database tools. It runs locally over stdio, stores named connections in groups, and exposes schema information through MCP Resources so agents can inspect tables, columns, keys, and indexes before querying. Use it when you need conversational database work across projects, including controlled writes, rollback, dumps, restores, and query history. Node.js 20 or newer is required, with database drivers installed separately for the engines you use.

Use cases

  • Inspect schemas before writing queries
  • Organize development and production connections by project
  • Query PostgreSQL, MySQL, and SQLite from one client
  • Rollback test data mutations
  • Dump and restore database structure and data

Key features

  • 33 tools across PostgreSQL, MySQL, and SQLite
  • Group-scoped named connections
  • MCP Resource schema discovery
  • Query history with execution timing
  • Mutation snapshots and rollback
  • Database dump and restore

Tools34

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

Verified live~5.0k 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 3d ago

Recent health check succeeded.

7/7 checks healthy over the last 40d

What it can do

From the 34 tools this server returned when we ran it.

Runs commands · 2Can delete or modify data · 5Handles credentials · 3Read-only tools · 28
Network at startup3 connections
Files written at startup1
Install scriptsprepare
npm provenanceNot published
Package age213 days
Maintainers1

Observed 2026-10-16 in an isolated sandbox. A description of reach, not a security audit.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 15d ago via OSV.dev · @cocaxcode/database-mcp@latest (npm)

Adoption & maintenance

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

GitHub stars2Stargazers on the source repository.
npm downloads426Package downloads in the last 30 days.
Last commit1mo agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed34Callable tools this server registers over MCP.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Database MCP works

What database-mcp does

The database-mcp MCP server gives an MCP-compatible client one interface for PostgreSQL, MySQL, and SQLite. It supports named connections organized into groups, allowing a project directory to determine which connections are visible. Groups can have a default connection that persists between sessions and an active connection used only for the current session.

Its database workflow covers more than sending SQL. The server can inspect schemas, execute reads and writes, record query history, capture snapshots before mutations, reverse changes for rollback, and create or restore database dumps. Destructive operations require confirmation, and read queries can receive automatic LIMIT handling. The repository describes 33 tools across the three supported database engines.

How it works

The database-mcp MCP server runs locally and communicates with the host client through stdio. Credentials and database access remain on the local machine. Connections are created and managed by name rather than re-entered for every session.

Schema information is available through MCP Resources. A general schema resource identifies tables, while a table-specific resource provides columns, foreign keys, and indexes. An agent can use that information to construct queries and joins before execution. Group scopes associate directories with their database connections, so entering a project can select its configured group and default connection.

The active connection can be changed for a session without changing the saved default. A separate default-setting operation is needed when the new choice should remain after restart. The first connection added to a group becomes its default automatically.

Setup and configuration

The package requires Node.js 20 or newer. Install it through npx or install the package globally. A stdio entry can be added to the configuration for Claude Desktop, Cursor, Windsurf, or VS Code. Claude Code, Codex CLI, and Gemini CLI each provide their own MCP registration commands or configuration files.

Install only the database drivers required by the deployment:

  • postgres for PostgreSQL
  • mysql2 for MySQL
  • sql.js for SQLite

With npx, these drivers must be installed globally. When the server itself is installed globally, drivers may be installed locally or globally. No environment variables are specified in the provided setup instructions.

Tools and capabilities

The database-mcp MCP server provides capabilities for:

  • Creating, listing, switching, and configuring named database connections
  • Creating groups, assigning directory scopes, and selecting group defaults
  • Connecting to PostgreSQL, MySQL, and SQLite
  • Listing tables and inspecting schemas at different levels of detail
  • Running queries with query history and execution timing
  • Applying automatic LIMIT handling to reads
  • Capturing pre-mutation snapshots and reversing supported changes
  • Confirming destructive operations before execution
  • Dumping database structure and data to SQL files
  • Restoring databases from dumps
  • Publishing schema details through MCP Resources

SQLite runs in-process through sql.js, avoiding native bindings according to the installation notes.

Limitations and notes

The available database engine depends on installing its corresponding driver. Connection switching is session-scoped unless a new default is explicitly saved.

Destructive requests require a second call with confirmation, and rollback behavior depends on the snapshots and reverse SQL generated for the mutation.

Reviews

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

Frequently Asked Questions about Database MCP

database-mcp is an MCP server that connects AI clients to PostgreSQL, MySQL, and SQLite. Its main tools manage named connections and groups, inspect schemas, run queries, track query history, protect writes with snapshots and confirmation, support rollback, and dump or restore database structure and data.

Install it with npx using `npx -y @cocaxcode/database-mcp@latest` and register that command as a stdio MCP server. Install the required database drivers separately; with npx, drivers must be installed globally. Node.js 20 or newer is required.

database-mcp supports PostgreSQL, MySQL, and SQLite. Install `postgres` for PostgreSQL, `mysql2` for MySQL, or `sql.js` for SQLite. SQLite runs in-process through sql.js and does not require native bindings.

Yes, database-mcp works with Cursor through a project-level `.cursor/mcp.json` stdio configuration. The configuration runs `npx -y @cocaxcode/database-mcp@latest`; the required database drivers must still be installed separately.

database-mcp captures a snapshot before a mutation and can use reverse SQL to restore affected rows. Destructive operations also require confirmation before proceeding. The available rollback result depends on the mutation and the snapshot generated for it.

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 PreviewDatabase MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/database-mcp?style=directory)](https://allmcps.com/mcp/database-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/database-mcp"><img src="https://allmcps.com/api/badge/database-mcp?style=directory" alt="Database MCP on AllMCPs" /></a>