Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

database-mcp

MCP server by cocaxcode Community

Lets AI assistants query and change PostgreSQL, MySQL and SQLite databases through natural language. Aimed at developers who want to manage database connections and roll back changes from their chat client.

  • Score 78
  • 5 stars
  • 399 a week
  • MIT
  • Updated

Install database-mcp

Built from the published package, never by AI.

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

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install database-mcp in Claude Code

MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the database-mcp block.

About

database-mcp is an MCP server that lets an AI assistant work with PostgreSQL, MySQL and SQLite databases. Connections are stored in groups that can be scoped to project directories, and each group has a default connection and an active connection. The assistant reads the schema through MCP Resources, writes SQL and runs it against the selected database.

Safety features include automatic LIMIT on read queries, a read-only connection mode, explicit confirmation before destructive operations, and pre-mutation snapshots that allow rollback through reverse SQL. Credentials are stored as JSON files on the local machine and are not sent to the cloud. The server suits developers who want a local database workbench inside their AI client.

Written from the project's README and checked against it.

Tools it gives your assistant

  • execute_queryRuns read queries and returns results, with options to limit output size.
  • execute_mutationRuns INSERT, UPDATE and DELETE statements and captures row state for rollback.
  • explain_queryReturns the execution plan for a query using dialect-specific EXPLAIN syntax.
  • inspect_last_queryRetrieves the full result of a compressed response without re-running the SQL.
  • conn_getShows connection details, with passwords masked as ***.

What you need

  • Node.js with npx
  • npm to install database drivers globally
  • A PostgreSQL, MySQL or SQLite database to connect to

Try asking

  • Show me all tables
  • Show me the last 10 orders with the customer name
  • Create a group called backend and add this directory

Good to know

  • When using npx, database drivers must be installed globally.
  • Read-only mode is enforced at the connection level.
  • DDL statements such as CREATE, ALTER and DROP are logged but cannot be rolled back.
  • Rollback snapshots are captured for INSERT, UPDATE and DELETE only.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: package.json. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to database-mcp

All alternatives →
Supabase supabase
97

Connects Supabase projects to AI assistants such as Cursor, Claude and Windsurf over the Model Context Protocol. It lets assistants manage tables, fetch config and query data in a Supabase project.

AAA Local and remote 172k/wk
ArcadeDB MCP Server ArcadeData
94

ArcadeDB MCP Server is the built-in Model Context Protocol server of the ArcadeDB multi-model database. It lets AI assistants and LLMs work with ArcadeDB's graph, document, time-series, vector and other data models. It suits people who already run ArcadeDB and want assistant access to it.

AAA Local 1.3k
DBHubbytebase
94

Connects MCP clients such as Claude Desktop, Cursor and VS Code to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse and SQLite. It exposes two tools by default, with read-only mode and query timeouts available as guardrails.

AAA Local 343k/wk
MCP Toolbox for Databasesgoogleapis
94

MCP Toolbox for Databases is an open source MCP server that connects AI agents, IDEs and applications to enterprise databases. It provides prebuilt tools for exploring schemas and running queries, plus a framework for custom tools. It is aimed at developers building agents that need database access.

AAA Local 17k
MCP Toolbox for Databasesgoogleapis
94

Connects AI agents, IDEs and applications to enterprise databases through the Model Context Protocol. Offers prebuilt database tools for MCP clients and a framework for building custom tools for production agents.

AAA Local 17k
mongodb-mcp-servermongodb-js
94

MongoDB MCP Server lets AI assistants interact with MongoDB databases and MongoDB Atlas. It is an official server from mongodb-js, run locally with npx or Docker. It works with self-managed deployments and Atlas clusters.

AAA Local 203k/wk

Compare with Supabase, ArcadeDB MCP Server or DBHub

database-mcp: common questions

Where are database credentials stored?

Each connection is stored as a JSON file in ~/.database-mcp/connections/ on the local machine. The source states that passwords never leave the machine.

Can the assistant undo a bad change?

Yes. Every INSERT, UPDATE or DELETE captures a pre-state snapshot, and rollback generates reverse SQL to restore the rows after confirmation.

How does it keep different projects separate?

Connections belong to groups, and groups can be scoped to directories. Working inside a scoped directory shows only that group's connections and its default.

How do I install database-mcp?

In Claude Code run claude mcp add database-mcp -- npx -y @cocaxcode/database-mcp. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.

Is database-mcp the official server?

database-mcp is a community project by cocaxcode, not verified by a company domain.

Is database-mcp free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is database-mcp safe to use?

It scores 78 of 100. Grades: maintenance A, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to database-mcp?

Similar MCP servers: Supabase, ArcadeDB MCP Server, DBHub, MCP Toolbox for Databases.

Does database-mcp work with ChatGPT?

Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.

database-mcp Install

Add to stack

Loading.