dbmole

v0.2.0
io.github.ed-smartass/dbmole-mcp Checked 7 hours ago Published 1 month ago

PostgreSQL and MySQL with connections managed at runtime by the agent, SSH tunnels, readonly.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_connections

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.

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).

ParameterTypeDescription
host *string
name *string
type *string
user *string
databasestring
passwordstring
portinteger
queryTimeoutMsinteger
readonlyboolean
scopestring
sshobject
ssl

update_connection

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.

ParameterTypeDescription
name *string
patch *object

remove_connection

Remove a connection by name from the layer it lives in (invalid entries too) and drop its cached pools/tunnel.

ParameterTypeDescription
name *string

test_connection

Verify a connection works end to end (including ssh tunnel if configured). Reports server version and connect+query latency.

ParameterTypeDescription
name *string

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.

ParameterTypeDescription
connection *stringconnection name, see list_connections
sql *string
databasestringdatabase to run against; defaults to the connection default
paramsarraypositional query parameters
rowLimitinteger

list_databases

List databases on a connection with size in bytes. Hides postgres template databases and mysql system schemas.

ParameterTypeDescription
connection *stringconnection name, see list_connections

list_tables

List tables and views (type: table | view) with approximate row counts. For postgres, optionally filter by schema; for mysql, schema is the database.

ParameterTypeDescription
connection *stringconnection name, see list_connections
databasestring
schemastring

describe_table

Describe a table or view: columns (type, nullable, default), primary key, indexes and foreign keys.

ParameterTypeDescription
connection *stringconnection name, see list_connections
table *stringtable name; may be qualified: schema.table (postgres), db.table (mysql)
databasestring
schemastringpostgres schema, defaults to public