Local MCP server that lets an assistant manage PostgreSQL and MySQL connections and run SQL against them, with optional SSH tunnels and a readonly flag.
What you can do
List, add, update, remove and test PostgreSQL/MySQL connections, stored globally or in a project .dbmole.json file
Run a single SQL statement per call, with positional parameters, returning rows for SELECT and row counts for DML
List databases with sizes, and list tables and views with approximate row counts
Describe a table or view: columns, primary key, indexes and foreign keys
When to use it
Useful when an assistant needs to inspect or query PostgreSQL or MySQL databases during development, keep per-project connection definitions, or reach databases through an SSH tunnel without a separate client.
Requirements
Runs as a local stdio process, installed from the npm package dbmole-mcp, so Node.js is needed. Database credentials are supplied through the connection tools rather than environment variables; SSH tunnel details and optional SSL settings (including a CA) can be configured per connection.
Before you install
The assistant can create, modify and delete stored connection definitions, including credentials, in the user store or a project file. execute_sql can run any single statement, so writes and deletes are possible unless the readonly flag is set on the connection. Connections may pass through an SSH tunnel and use SSL; review stored secrets and project files before sharing them.
List database connections with the layer each comes from: project (.dbmole.json, found by walking up from the project dir) or global (user store). Also shows invalid entries and broken files. Secrets are omitted.
Takes no parameters.
add_connection
Add a named postgres/mysql connection. scope "global" (default) saves it to the user store; "project" saves it to .dbmole.json in the project root. Supports an optional ssh tunnel and a readonly flag. Optional ssl: true or { rejectUnauthorized, ca } (ca = PEM or file path).
Patch a connection by name in the layer it lives in (project or global). Set a field to null to remove it (e.g. "ssh": null); an ssh object is merged field by field, e.g. { "ssh": { "hostKey": "SHA256:..." } }. queryTimeoutMs sets the per-statement timeout (null restores the 60 s default). ssl is replaced as a whole, not merged like ssh.
Parametersnamerequiredpatchrequired
remove_connection
Remove a connection by name from the layer it lives in (invalid entries too) and drop its cached pools/tunnel.
Parametersnamerequired
test_connection
Verify a connection works end to end (including ssh tunnel if configured). Reports server version and connect+query latency.
Parametersnamerequired
execute_sql
Execute a single SQL statement on a named connection. SELECT returns columns/rows; DML returns rowCount (and lastInsertId for mysql). Use positional params: $1.. for postgres, ? for mysql.
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
Reached in the last 30 days25 pts
Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
Tools listedRequired15 pts
DescriptionRequired15 pts
Logo10 pts
Documentation15 pts
Declare a GitHub repository with a README, or serve resource_documentation in the OAuth protected-resource metadata.
License10 pts
Declare a license in the repository or the registry entry.