Skip to content
Back to search

dbgate-dashboard-mcp

MCP server for querying databases (SQL, MongoDB, Redis) through a running DbGate dashboard — works even when the databases themselves aren't reachable directly.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/danilin-em--dbgate-dashboard-mcp/badge.svg)](/listings/danilin-em--dbgate-dashboard-mcp)

HTML

<a href="/listings/danilin-em--dbgate-dashboard-mcp"><img src="/api/listings/danilin-em--dbgate-dashboard-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

// .mcp.json
{
  "mcpServers": {
    "dbgate-dashboard": {
      "command": "uvx",
      "args": ["dbgate-dashboard-mcp@latest"],
      "env": {
        "DBGATE_URL": "http://localhost:3000"
      }
    }
  }
}

A remote dashboard through an SSH tunnel — `DBGATE_URL` then means the address **on the remote side**:

"env": {
  "DBGATE_URL": "http://localhost:3000",
  "SSH_PROXY_TO": "user@remote-host"
}

An HTTPS dashboard behind a reverse proxy works the same way — the port comes from the scheme (443), while `Host` and SNI stay canonical, so certificate verification is not disabled:

"env": {
  "DBGATE_URL": "https://dbgate.example.com",
  "SSH_PROXY_TO": "user@remote-host"
}

The tunnel only changes the connect address: `DBGATE_URL` is not rewritten, otherwise the proxy would receive `Host: 127.0.0.1:<port>` and answer with a redirect, and TLS would not match the certificate.

Tunnel loss

If ssh dies mid-session, the next call does not fail: the tunnel is reopened and the request is retried **once**. A second drop in a row is returned as an error, so an unreachable remote host does not send every tool into endless retries.

A reconnect is invisible by itself — a retried call looks like an ordinary one — so the tool result gets a `notices` field:

{
  "connections": [ /* ... */ ],
  "notices": [
    "ssh tunnel dropped (ConnectError) and was reopened on 127.0.0.1:49173; the call was retried and this result is from the new connection"
  ]
}

The field appears only when there is something to report, and exactly once: the queue is drained when delivered.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 134 lines
  1. # dbgate-dashboard-mcp
  2. An MCP server that gives an agent access to databases **through a running [DbGate](https://dbgate.org/) dashboard**. No database drivers are needed: DbGate itself holds the connections, engine plugins and pool, and the server talks to it over HTTP.
  3. Engines: MySQL, PostgreSQL, SQLite (SQL tools), MongoDB and Redis (dedicated tools below).
  4. ## Installation
  5. ```jsonc
  6. // .mcp.json
  7. {
  8. "mcpServers": {
  9. "dbgate-dashboard": {
  10. "command": "uvx",
  11. "args": ["dbgate-dashboard-mcp@latest"],
  12. "env": {
  13. "DBGATE_URL": "http://localhost:3000"
  14. }
  15. }
  16. }
  17. }
  18. ```
  19. A remote dashboard through an SSH tunnel — `DBGATE_URL` then means the address **on the remote side**:
  20. ```jsonc
  21. "env": {
  22. "DBGATE_URL": "http://localhost:3000",
  23. "SSH_PROXY_TO": "user@remote-host"
  24. }
  25. ```
  26. An HTTPS dashboard behind a reverse proxy works the same way — the port comes from the scheme (443), while `Host` and SNI stay canonical, so certificate verification is not disabled:
  27. ```jsonc
  28. "env": {
  29. "DBGATE_URL": "https://dbgate.example.com",
  30. "SSH_PROXY_TO": "user@remote-host"
  31. }
  32. ```
  33. The tunnel only changes the connect address: `DBGATE_URL` is not rewritten, otherwise the proxy would receive `Host: 127.0.0.1:<port>` and answer with a redirect, and TLS would not match the certificate.
  34. ### Tunnel loss
  35. If ssh dies mid-session, the next call does not fail: the tunnel is reopened and the request is retried **once**. A second drop in a row is returned as an error, so an unreachable remote host does not send every tool into endless retries.
  36. A reconnect is invisible by itself — a retried call looks like an ordinary one — so the tool result gets a `notices` field:
  37. ```jsonc
  38. {
  39. "connections": [ /* ... */ ],
  40. "notices": [
  41. "ssh tunnel dropped (ConnectError) and was reopened on 127.0.0.1:49173; the call was retried and this result is from the new connection"
  42. ]
  43. }
  44. ```
  45. The field appears only when there is something to report, and exactly once: the queue is drained when delivered.
  46. ## Environment variables
  47. | Variable | Default | Purpose |
  48. |---|---|---|
  49. | `DBGATE_URL` | `http://localhost:3000` | dashboard address (with a tunnel — the remote side) |
  50. | `DBGATE_LOGIN` | — | login, if authentication is enabled in DbGate |
  51. | `DBGATE_PASSWORD` | — | its password |
  52. | `SSH_PROXY_TO` | — | `user@host` for the SSH tunnel (`ssh -N -L`) |
  53. | `SSH_PROXY_PORT` | auto | fixed local port for the tunnel |
  54. ## Tools
  55. | Tool | What it does |
  56. |---|---|
  57. | `list_connections` | dashboard connections: `conid`, engine, default database |
  58. | `list_databases` | databases on a connection |
  59. | `list_tables` | tables, views and matviews (no columns) |
  60. | `describe_table` | columns, PK, FKs and indexes of one object |
  61. | `query` | a read query; appends `LIMIT` and truncates the result |
  62. | `execute` | any SQL, including writes and DDL, unmodified |
  63. | `find_documents` | documents of a Mongo collection with filter and sort |
  64. | `redis_keys` | browse the Redis keyspace level by level |
  65. | `redis_get` | type, TTL and value of one key |
  66. | `redis_command` | any Redis command, including writes |
  67. `conid` is required by every tool — take it from `list_connections`. `database` can be omitted: the connection's default database is used.
  68. `query` limits the output twice: it appends `LIMIT n` if the SQL has no limit of its own, and in any case cuts the response to `n` rows (`truncated: true` when cut). The DbGate API has no limit parameter, so the bound has to be held on both sides.
  69. `LIMIT` is appended only to statements that accept it (`SELECT`, `WITH`, `VALUES`, `TABLE`). `SHOW`, `PRAGMA`, `DESCRIBE`, `EXPLAIN` go to the engine as is — with a `LIMIT` glued on they would be a syntax error; cutting to `n` rows still applies to them.
  70. `execute` passes SQL through unchanged and without a safety net — including `INSERT`/`UPDATE`/`DELETE` and DDL. Restrict permissions on the connection itself in DbGate.
  71. ## MongoDB and Redis
  72. `find_documents` takes a regular Mongo filter — `{"artistId": {"$gt": 5}}`, `{"title": {"$regex": "Rock"}}`, `$in`, `$and`/`$or`. It is translated into a DbGate condition, because the dashboard API does not accept a raw Mongo filter. An unsupported operator (`$exists`, `$elemMatch`) returns an explicit error. `$regex` becomes a LIKE wrapped in `%…%`, so `%` and `_` inside the pattern act as wildcards.
  73. Collections show up in the common `list_tables` with `type: "collection"`; `describe_table` for a collection returns the document count and the unique key — DbGate's Mongo structure has no columns.
  74. Redis navigation has two levels: `redis_keys` without `root` shows prefixes (`album`, `track`, …), with `root` — the keys under it. `redis_get` reads a value as one page no longer than `limit` (`truncated: true` if the value continues); for the full data of a large key use `redis_command`, which runs an arbitrary command. For a missing key `redis_get` returns the error `key '…' not found`.
  75. The command name in `redis_command` is case-insensitive — it is lowercased, because DbGate calls the method of the same name on its Redis client, and all those methods are lowercase.
  76. A Redis connection has no default database, so `database` can be omitted: the server takes the first one in the list (`db0`). A freshly opened DbGate connection returns an empty database list while it starts up, so an empty answer is asked again — without that, database resolution sometimes failed with `has no default database`.
  77. ## Development
  78. ```bash
  79. uv sync # venv + runtime + dev group
  80. uv run pytest # full suite; addopts enforces --cov-fail-under=100
  81. uv run pytest tests/test_server.py --no-cov # partial run — only with --no-cov
  82. python -m dbgate_dashboard_mcp # run over stdio
  83. ```
  84. Tests need neither network nor a running DbGate: `httpx` and `subprocess` are faked.
  85. ## Manual check on the test stand
  86. The repository ships a `docker-compose.yml` with DbGate and five databases (Chinook in MySQL, PostgreSQL, SQLite, MongoDB, Redis). Seeds live in `init/`: [Chinook](https://github.com/lerocha/chinook-database) (MIT, © Luis Rocha), adapted for each engine.
  87. ```bash
  88. docker compose up -d
  89. TOKEN=$(curl -s -X POST http://localhost:3000/auth/login \
  90. -H 'Content-Type: application/json' -d '{"amoid":"none"}' \
  91. | python3 -c 'import sys,json;print(json.load(sys.stdin)["accessToken"])')
  92. curl -s -X POST http://localhost:3000/connections/list \
  93. -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{}'
  94. ```
  95. Then connect the server in an MCP client with `DBGATE_URL=http://localhost:3000` and call `list_connections`.
  96. ## How the DbGate API works
  97. Useful when extending the server: DbGate is RPC over HTTP, not REST. Controller methods are mounted as kebab-case paths (`queryData` → `/database-connections/query-data`), almost all of them `POST` with a single JSON object of arguments. `POST /auth/login {"amoid":"none"}` issues a token that lives 24 h. SQL errors arrive with **HTTP 200** and an `errorMessage` field, so success is decided by the response body, not the status code.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.