Skip to main content
H

dsh-db-mcp

halcyon6669/dsh-db-mcp

Database workbench inside DSH: import the connections DBeaver already stores (data-sources.json, decrypting saved passwords locally) or register SQLite, PostgreSQL, MySQL and Oracle sources by hand, then hand them to the agent through eight mcp__db__ tools — list_datasources, list_tables, describe_table, sample_rows, execute_sql, explain_query, get_ddl and test_connection. Sources start read-only; one global switch enables INSERT/UPDATE/DDL, every call is row-capped and appended to a JSONL audit log. Also covers groups, bulk actions, a read-only schema browser and a bundled Python MCP server whose dependencies install from the panel. No DSH files to edit.

Install

dsh plugin --profile web add github:halcyon6669/dsh-db-mcp

README

dsh-db-mcp

License: Apache-2.0 npm

English | 中文

A DSH plugin that hands your databases to the agent. It adds a Database panel to the sidebar and publishes every registered source as mcp__db__* tools.

Zero configuration. There is nothing to edit in DSH and no connection to type twice: import the connections DBeaver already knows, then just ask.

Zero configuration, in three senses

  • No DSH files. The bundle patch inserts one Loader row. The plugin starts its own Python MCP server over stdio and registers the tools on the host tools service — no dsh-mcp-client row, no JSON to hand-edit, no env var to export.
  • No data source to fill in. The importer reads data-sources.json from the DBeaver workspace and decrypts credentials-config.json with DBeaver's own key, so host, port, database, user and saved password arrive together. Ticking a box is the whole setup step.
  • No Python to prepare. The panel finds an interpreter, creates the venv and installs the four driver packages from Runtime → Install / repair dependencies.

Run

dsh plugin --profile desktop add dsh-db-mcp   # desktop app
dsh plugin --profile web add dsh-db-mcp       # web UI

--profile picks the profile to install into (desktop and web ship with DSH; any other name is created on first use). Remove with dsh plugin --profile desktop remove dsh-db-mcp.

Then:

  1. Sidebar → Database.
  2. Import from DBeaver → tick the connections → Import selected.
  3. Ask the agent something like "which tables does my Chinook database have?"

A connection whose password was never saved shows no password; open the source once and type it — it goes to secrets.json and never comes back to the page.

Prefer to start from scratch? New data source takes one connection string (postgresql://user:pw@host:5432/db, a JDBC URL, an Oracle TNS descriptor or a .db path) and fills the form from it.

What the agent gets

ToolPurpose
mcp__db__list_datasourcesregistered sources: id, kind, target, read-only
mcp__db__list_tablestables and views of a source
mcp__db__describe_tablecolumns, types, nullability, primary key
mcp__db__sample_rowsa few rows of a table
mcp__db__execute_sqlexecute one statement — a query, or a write when that is allowed
mcp__db__explain_queryquery plan
mcp__db__get_ddlCREATE TABLE statement
mcp__db__test_connectionreal login, select 1, server/user/schema

datasource is optional on all of them: omitted, the default source is used. Queries run in the conversation; the panel is for managing connections, not a SQL console.

Safety

  • Read-only by default, with two independent gates: a global write switch and a per-source flag. Both must be open before a statement may write.
  • Passwords stay local. They live in secrets.json (mode 0600); no HTTP route ever returns one, and the Python child receives a short environment allowlist rather than the whole DSH environment.
  • Every tool call is audited to logs/audit.jsonl — tool, source, duration, row count, SQL. Result rows are never logged.
  • Nothing runs from the panel except catalog reads. The structure browser only forwards list_tables and describe_table.

Documentation

DocumentContents
docs/guide.mdPanel walkthrough, connection strings, groups, Docker test databases, troubleshooting
docs/reference.mdHTTP routes, tool contracts, registry and settings files, plugin config
docs/development.mdRepository layout, hot reload, test suites, release flow
docs/design-notes.mdHistorical design log (P1 → P7) and the decisions behind them

License

Apache License 2.0 — see LICENSE.

Related plugins