Skip to content

MCP server

Last updated

View as Markdown

DBGorilla runs a remote MCP server. MCP, the Model Context Protocol, lets an AI client such as Claude Code, Cursor or Codex call tools on an outside service. An assistant can use it to read your database’s topology, metrics, queries and recommendations, explain a query, and test a change on a clone.

URLhttps://app.dbgorilla.com/mcp/
TransportStreamable HTTP. There is nothing to install or run locally.
Sign-inOAuth in a browser, or an MCP key sent as a header

A request without credentials gets 401 Unauthorized and this header. An OAuth client uses it to find where to sign in:

WWW-Authenticate: Bearer resource_metadata="https://app.dbgorilla.com/.well-known/oauth-protected-resource/mcp"

A client that supports MCP’s OAuth sign-in needs only the URL. It registers itself, opens a DBGorilla sign-in page in your browser, and stores the token it receives.

Authorization server metadatahttps://app.dbgorilla.com/.well-known/oauth-authorization-server/mcp
Client registrationDynamic, at https://app.dbgorilla.com/mcp/register. No client id is required in advance.
PKCERequired, S256 only
ScopesNone. A token can call every tool the server lists.
Access token lifetime8 hours, renewed with a refresh token
Revocationhttps://app.dbgorilla.com/mcp/revoke

The sign-in page names the client and the address it will send you back to, for example “Codex is requesting access to DBGorilla on your behalf.” Continue only if you started the sign-in.

In Codex:

Terminal window
codex mcp add dbgorilla --url https://app.dbgorilla.com/mcp/
codex mcp login dbgorilla

For Claude Desktop, see Claude Desktop.

Any client that can send a header can use a key instead. Send it with every request in this header:

Authorization: Bearer <your MCP key>

Each user has one MCP key at a time. dbgorilla setup-ide --print-key prints yours. dbgorilla logout revokes it, as does dbgorilla setup-ide --rotate-key, which also issues a new one. Getting your MCP key covers the other ways to find it.

The CLI writes the entry, including your key, for five clients:

ClientCommandWhat you see
Claude Codedbgorilla setup-ide --client claude-codeclaude mcp list shows dbgorilla as Connected
Cursordbgorilla setup-ide --client cursorWrites ~/.cursor/mcp.json
VS Codedbgorilla setup-ide --client vscodeWrites .vscode/mcp.json in the current folder
Gemini CLIdbgorilla setup-ide --client geminigemini mcp list shows dbgorilla as Connected
opencodedbgorilla setup-ide --client opencodeopencode mcp list shows dbgorilla as connected

Gemini CLI turns MCP servers off in a folder you have not trusted, and gemini mcp list shows dbgorilla as Disabled there. Trust the folder and it connects.

For details of each entry, or to write one by hand, see Connect your editor and Connect an MCP client by hand.

The server lists up to 51 tools. Where hosted databases are not offered, the eight hosted database and monitoring tools may be missing from the list or may answer “not available”. The tools are grouped here by what they change. The descriptions are the ones the server sends to your client, shortened to what the tool does.

These read what DBGorilla has already collected and change nothing.

Start with get_topology_overview, which returns the component’s identity, its members, its databases, the class taxonomy, and the recent snapshots. Four tools require a member id from it: run_explain, get_correlated_metrics, get_session_timeline and run_experiment.

ToolWhat it does
discover_componentsdiscover database components that are managed by dbgorilla. Provides the required component_id to call other tools.
get_topology_overviewGet an overview of the connected component: identity and status, its members (servers) with their member_id, its scopes (databases), the class taxonomy, and recent snapshots.
list_topology_snapshotsList historical topology snapshots.
compare_topology_snapshotsList topology objects added, modified, or removed between two snapshots.
inspect_topology_objectInspect a topology object at a given path. Use include to request specific sections (payload, children, history).
get_topology_object_historyReturn the change history for a topology object.
search_topology_objectsSearch topology objects.
discover_metricsList the raw metrics metadata available for the component or one member, grouped by kind, each with its unit and group_by keys.
get_metric_timeseriesFetch one metric’s time series.
get_metric_ratio_timeseriesFetch numerator / sum(denominator) per bucket as a raw fraction (x100 for a percent).
get_correlated_metricsFind metrics that co-moved with an anchor metric over a time range.
list_dashboardsList metadata for saved user-defined dashboards.
view_dashboardView one user-defined dashboard as JSON describing the graphs it contains.
discover_workloadsList the workload ranking dimensions available.
get_top_workloadReturn the top-N workload items (queries) ranked by a dimension.
search_workloadsSearch workload descriptions (e.g. query text) by substring. Returns counts plus the top-N matches ranked by a dimension.
investigate_workloadDrill into a single workload fingerprint: full stats, the query text, and a time-bucketed trend.
compare_workloadCompare workload stats between two time periods and return the biggest movers.
get_workload_overviewTime-bucketed workload aggregates summed across all fingerprints. Use for instance- or database-wide trends.
discover_activityList the available group_by dimensions, filters, and connection-count dimensions for the activity tools.
get_activity_breakdownActive Session History (ASH) load breakdown. Returns the top-N groups by average active sessions (AAS) over a window, optionally bucketed into a time series.
get_activity_connectionsProvides detailed connection count data.
get_activity_samplesActive Session History (ASH) samples: a connection summary (total / active / idle / idle-in-transaction) plus the active, blocked, and idle-in-transaction sessions per snapshot, each with its session_id and query fingerprint.
get_blocking_sessionsActive Session History (ASH) blocking episodes, collapsed across snapshots.
get_session_timelineActive Session History (ASH) per-session drill-down: the ordered snapshot list for a session plus summary stats.
list_recommendationsList database recommendations generated by DBGorilla. Pass a query to search them by topic.
view_recommendationView one database recommendation’s full report including actions to take, and other analysis.
list_investigationsList historical investigations that have been run.
get_investigation_reportGet the full text of one investigation’s final report.
search_investigationsFull-text search across historical investigation title + report content.
search_customer_documentsSearches documents an admin uploaded about this customer’s own database: runbooks, schema notes, whatever they keep internally.
search_best_practicesSemantic search over best practices for this database.
list_dbgorilla_product_documentationLists every page of DBGorilla’s product documentation, with a title, path and summary for each.
read_dbgorilla_product_documentationReturns one page of DBGorilla’s product documentation as Markdown.
list_databasesList the PostgreSQL databases DBGorilla hosts for this workspace, with their status, size, monitoring state and component_id.
get_databaseShow one hosted database: status (provisioning, ready, suspended or deleting), instances ready, size, and monitoring state (pending, connected, error, not monitored, or paused while suspended).
list_postgres_connectionsList the customer’s own PostgreSQL servers that DBGorilla monitors from a connection string, with host, status and component_id.

list_recommendations filters on the same four fields as the table, one value per field, and sorts on one field at a time. view_recommendation returns one full report. investigate_workload is a workload tool rather than an investigations one, despite the name. It returns statistics and a trend for a single query fingerprint.

ToolWhat it does
run_explainRun EXPLAIN on the LIVE database and return the query plan. This hits the real production member directly (no sandbox clone), so it is the cheap way to read a query’s current plan and costs. It is plan-only and never executes the statement.

run_explain returns a plan.

ToolWhat it does
run_experimentRun an experiment against a version-matched, ephemeral clone of a database based on a topology snapshot with production statistics, synthetic data, or both injected. We run the provided python code in an isolated sandbox and return whatever it prints.

These change records kept in DBGorilla. None of them touches your database. Every change except creating one takes the recommendation’s current version, and a change sent with an older version is refused.

ToolWhat it does
create_recommendationCreate a database recommendation for the component.
update_recommendationRevise an open database recommendation in place: its title, description, risk, or category.
update_recommendation_priorityManage a database recommendation’s priority.
mark_recommendation_completeMark a database recommendation as completed based on an observed change that matches the recommendation’s suggested actions.
ignore_recommendationMark a database recommendation as ignored.
reopen_recommendationReopen a database recommendation, returning it to open.
close_recommendationClose a database recommendation that is no longer valid or relevant, has been superseded by a newer finding, made moot by a changed workload, or otherwise no longer worth the team’s attention.
ToolWhat it does
connect_postgresStart monitoring the user’s own PostgreSQL server from a connection string. DBGorilla first tests the connection: TLS, login, the pg_monitor role, and pg_stat_statements in the named database. If a check fails, nothing is created and the error names the check and how to fix it.
disconnect_postgresStop monitoring one of the user’s own PostgreSQL servers and remove its component. The server itself is not touched.

Create or delete databases, or issue a login

Section titled “Create or delete databases, or issue a login”
ToolWhat it does
create_databaseCreate a long-lived PostgreSQL database that DBGorilla hosts and monitors. There are no backups, so do not use it for data that cannot be recreated.
get_database_credentialsIssue a short-lived login to a ready hosted database through DBGorilla’s access proxy. The login owns the database. The password is shown once and is not stored, so give it only to the user who asked for it.
delete_databasePermanently delete a hosted database, its storage and its monitoring. There are no backups. Only call it when the user has asked to delete this database, and pass its exact name as confirm_name.

Where hosted databases are not available, the hosted database tools return “Hosted databases are not available in this environment.” and the two monitoring tools return “Monitoring Postgres from a connection string is not available in this environment.”

Read tools return what DBGorilla already holds about your database: schema and topology, metrics, query text and statistics, session activity, recommendations and investigation reports.

run_explain reads a plan from the live database and never runs the statement. A SELECT pg_sleep(10) returns its plan in under a second.

run_experiment runs your client’s Python code as the postgres superuser on a clone. The clone has your schema and no rows. When the experiment loads your production statistics, the code can read pg_stats, and the most common values for each column come back in its output. In a test, the output contained real email addresses from a column in a table that had no rows in the clone. Treat experiment output as containing values from your data.

For details about what the model layer sees and how to turn off the commands run by the collector, see How DBGorilla handles your data.

The server does not yet have a read-only mode. OAuth offers no scopes, and an MCP key or OAuth token reaches every tool the server lists. The tools also have no read-only or destructive annotations, so a client cannot distinguish reads from writes on its own.

Until then, set permissions by group in the client:

GroupAllow it for
Read DBGorilla’s dataEveryone. These change nothing.
Query your live database, plan onlyEveryone, if you let the collector run EXPLAIN
Run code on a clonePeople who may see values from your data
Change DBGorilla’s recommendationsPeople who manage the recommendations list
Change what DBGorilla monitorsOnly the people who manage monitoring. Block it for everyone else.
Create or delete databases, or issue a loginOnly the people who manage hosted databases. Block it for everyone else.

In Claude Code, a deny rule in your settings removes a tool from what the model can see:

{
"permissions": {
"deny": [
"mcp__dbgorilla__delete_database",
"mcp__dbgorilla__get_database_credentials",
"mcp__dbgorilla__create_database",
"mcp__dbgorilla__connect_postgres",
"mcp__dbgorilla__disconnect_postgres"
]
}
}

If your organization gates MCP servers on Claude Team or Enterprise, see If your organization gates MCP servers.