
dbmole
PostgreSQL and MySQL for agents that add their own connections at runtime, via SSH
- Pricing
- Open source
- Platforms
- CLI, self-hosted
- Runs
- Locally
- Version
- 0.2.0
- Listing updated
- 1 day ago
About dbmole
dbmole is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.
dbmole lets an agent manage database connections itself. Tell it to connect to a staging replica through a bastion host in readonly mode and it calls add_connection; the entry is saved to a per-project .dbmole.json or a global store. Both are re-read on every tool call, so a change made by the agent, by you in an editor or by another session applies immediately with no client config edits or restarts.
One server covers PostgreSQL and MySQL with any number of named connections. SSH tunnels support password, key or agent auth with host keys checked against known_hosts or a pinned fingerprint, and TLS verifies certificate and hostname, including through the tunnel. Readonly is enforced by the database session itself, calls have timeouts, and results are capped at 40 KB so a wide SELECT cannot flood the context.
It needs Node.js 22 or newer and runs over stdio via npx, a Claude Desktop .mcpb bundle or Docker. A sister project covers Elasticsearch.
Install
Run in a terminal
claude mcp add dbmole-mcp -- npx -y dbmole-mcpAdd to claude_desktop_config.json
{
"mcpServers": {
"dbmole-mcp": {
"command": "npx",
"args": [
"-y",
"dbmole-mcp"
]
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"dbmole-mcp": {
"command": "npx",
"args": [
"-y",
"dbmole-mcp"
]
}
}
}Add to .vscode/mcp.json
{
"servers": {
"dbmole-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"dbmole-mcp"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"dbmole-mcp": {
"command": "npx",
"args": [
"-y",
"dbmole-mcp"
]
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"dbmole-mcp": {
"command": "npx",
"args": [
"-y",
"dbmole-mcp"
]
}
}
}Tools this server provides (1)
Taken from the project documentation; the running server may differ.
- add_connection
- Adds a named database connection at runtime
What it does
- Runtime connections
- Agents add, edit and remove connections via tools.
- Hot reload
- Config files are re-read on every call.
- SSH tunnels
- Password, key or agent auth with host key checks.
- Verified TLS
- Full certificate and hostname verification.
- Enforced readonly
- Readonly applies at the database session.
- Result cap
- Results are capped at 40 KB.
Good for
- Query a staging replica through a bastion
- Inspect schemas across several databases
- Keep readonly access for safe exploration
- Share project-scoped connections
Pricing
Open source
Free and open source
dbmole FAQ
Which databases are supported?
PostgreSQL and MySQL.
Where are connections stored?
In a per-project .dbmole.json or a global store.
How is readonly enforced?
By the database session.
What Node.js version is needed?
22 or newer.
Is dbmole free?
Yes. dbmole is open source, so you can use and self-host it for free.
How do I add dbmole to Claude Code?
Run this command in your terminal: claude mcp add dbmole-mcp -- npx -y dbmole-mcp
What are the best alternatives to dbmole?
The closest alternatives to dbmole are Midplane, PlatypusDB, Lorebase, Sovaria and model2data studio.
Alternatives to dbmole

Midplane
MCP serverPostgres gateway for AI agents with table grants, column masking and approval for writes
Runs locally- Open source
- 5 GitHub stars
- Databases

PlatypusDB
MCP serverGives MCP clients access to your PlatypusDB database connections, scoped per agent
Runs locally- Open source
- Databases

Lorebase
MCP serverLets agents read and change a governed, versioned Postgres knowledge graph
Runs locally- Open source
- Knowledge and memory
Sovaria
MCP serverManage a Sovaria backend (Postgres, auth, storage, functions) from an AI assistant
Not checked yet- 4 tools
- Remote
- Freemium
- Databases

model2data studio
MCP serverGenerate realistic connected test data, dbt projects and dashboards from a schema
- Remote
- Freemium
- Databases

semlayer
MCP serverInfers a semantic layer from your data warehouse and serves it to agents
Runs locally- Free
- Databases