dbmole
MCP server by ed-smartass Community
Lets AI assistants add, edit and remove named PostgreSQL and MySQL connections at runtime, including SSH tunnels and readonly access. Connections are stored in per-project or global files that are re-read on each tool call.
Install dbmole
Built from the published package, never by AI.
claude mcp add dbmole -- npx -y dbmole-mcpRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"dbmole": {
"args": [
"-y",
"dbmole-mcp"
],
"command": "npx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"dbmole": {
"args": [
"-y",
"dbmole-mcp"
],
"command": "npx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"dbmole": {
"args": [
"-y",
"dbmole-mcp"
],
"command": "npx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add dbmole -- npx -y dbmole-mcp{
"mcpServers": {
"dbmole": {
"args": [
"-y",
"dbmole-mcp"
],
"command": "npx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add dbmole npx -y dbmole-mcpGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
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 dbmole block.
About
dbmole-mcp is a stdio MCP server for PostgreSQL and MySQL. An agent can add, edit and remove named database connections through MCP tools, and the entries are stored in a per-project .dbmole.json file or a global store. Both files are re-read on every tool call, so changes apply on the next call without restarting the server.
Connections can go through SSH tunnels with password, key or agent authentication, and host keys are verified. TLS checks the certificate and hostname, including through a tunnel. Readonly connections are enforced by the database session, and per-call timeouts and a 40 KB result cap limit output. It suits developers who want an assistant to query databases such as staging replicas.
Written from the project's README and checked against it.
Tools it gives your assistant
add_connectionAdds a named PostgreSQL or MySQL connection to the project or global store.update_connectionPatches an existing connection where it is stored, merging SSH settings field by field.remove_connectionDeletes a connection from the layer it is stored in.list_connectionsLists connections with host, port, database, readonly flag, source and SSH use, without credentials.test_connectionChecks that a named connection can be reached.list_databasesLists the databases available on a connection.list_tablesLists the tables in a connection's database.execute_sqlRuns SQL against a connection, with a per-call timeout and capped results.
What you need
- Node.js 22 or newer
- A PostgreSQL or MySQL database the server can reach
- SSH access to a bastion host, if tunnels are used
- Docker, only if you run the container image
Try asking
- Add a readonly postgres connection called shop to this project, through my SSH agent.
- Show the five largest tables in the shop connection.
- List all connections and tell me which ones use SSH.
Good to know
- Readonly mode is enforced by the database session, not by a SQL parser.
- Results are capped at 40 KB per call.
- ProxyJump, ~/.ssh/config and SSH certificates are not supported.
- MySQL connections to an IP address with verified TLS are rejected; use a hostname instead.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: README.md, package.json. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to dbmole
All alternatives →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.
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.
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.
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.
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.
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.
Compare with Supabase, ArcadeDB MCP Server or DBHub
dbmole: common questions
Does dbmole-mcp need a restart when connections change?
No. The project and global connection files are re-read on every tool call, so changes apply on the next call.
How are SSH host keys checked?
Keys are checked against an entry in known_hosts or a pinned ssh.hostKey fingerprint. Unknown keys fail the connection; there is no trust-on-first-use.
Can dbmole-mcp be used for Elasticsearch?
The source points to a separate project, esmole-mcp, that follows the same design for Elasticsearch 7.x and 8.x.
How do I install dbmole?
In Claude Code run claude mcp add dbmole -- npx -y dbmole-mcp. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is dbmole the official server?
dbmole is a community project by ed-smartass, not verified by a company domain.
Is dbmole free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is dbmole safe to use?
It scores 70 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 dbmole?
Similar MCP servers: Supabase, ArcadeDB MCP Server, DBHub, MCP Toolbox for Databases.
Does dbmole 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.
