Preface¶
When developing with DSH, letting the model query the database directly is a common requirement. There are two common approaches: pasting the DSN into the conversation for the model to connect itself, causing the password to enter the model’s context; or maintaining a persistent database MCP service yourself, handling ports and process lifecycles. dsh-dbhub-live takes a different path: passwords remain on the host side, and the model only gets a source handle; a one-time process is spawned for each query, which is recycled after execution. Below is an introduction to its design, installation, and usage.
What is this¶
dsh-dbhub-live is a DSH plugin maintained by mr-mihu, version 4.0.0, under the MIT license. It acts as a bridge based on DBHub (a database MCP server): the model only says “which workspace, which environment to query,” and the plugin parses the real connection and executes it on the host side—the password and full connection string will not appear where the model can see them.
Supported data sources: MySQL, PostgreSQL, MariaDB, SQLite, SQL Server.
Core Design: Zero-Knowledge Credentials¶
- Passwords, usernames, and full DSNs exist only on the host side; what the model can see is only the
sourcehandle and metadata (type / host / port / db name). - When configuring or changing passwords, input is done in the interface, not passed through the model.
- Error text from dbhub is cleaned before returning; query results and connection lists are annotated with metadata like
mysql://host:3306/dbthat does not contain account credentials.
This design dictates many subsequent behaviors: when authentication fails, the plugin provides clear guidance, asking the model to guide you to update the password in the interface, rather than asking the model for the password.
One-time Process Execution¶
The plugin does not have a persistent dbhub service. Every tool call spawns an independent dbhub process, which is recycled after execution. The effect is:
- A single query failure only affects itself;
- Multi-task parallelism, multiple DSH instances running simultaneously do not interfere with each other—no shared ports, and no mutual killing.
Constant 4 Tools¶
Regardless of how many environments are configured, the tools declared to the model are constantly four:
dbhub_configure(workspace?, env?, type?, host?, port?, database?, user?)
dbhub_list_sources()
dbhub_execute_sql(source, sql)
dbhub_search_objects(source, object_type, ...)
dbhub_configure: Configures and persists connections for a workspace. It does not accept adsnparameter—passwords and connection strings are entered in the interface;type/host/port/database/usercan be used as non-sensitive pre-fills.dbhub_list_sources: Lists all connection sources (workspace × environment), containing only metadata and correspondingsourcevalues.dbhub_execute_sql: Executes SQL on a specified data source; multiple statements are separated by;.dbhub_search_objects: Searches for database objects (tables/views/columns/indexes, etc.), currently open only to SQLite; for MySQL, PostgreSQL, etc., please usedbhub_execute_sqlto query directly (e.g.,SHOW TABLES).
The number of tools does not grow with the number of environments, preventing context inflation.
Managing Connections by Workspace × Environment¶
A workspace can be configured with multiple environments (default / prod / dev / test…), distinguished by source value: the default environment has no suffix, and named environments look like <workspace>_<environment>.
There are three ways to configure, all completed in the interface:
- Input the full DSN, e.g.,
mysql://user:pass@host:3306/db; - Fill in details by type / host / port / account / password / db name;
- After authorization, scan project configuration files (
.env,application*.yml,docker-compose,jdbc.properties, etc.), list candidate connections for confirmation—only host / port / db are shown, passwords are not displayed, and the plugin reads them directly.
Additionally, if the workspace already has mise env or .env (DSN / DB_*), the plugin will automatically discover connections without manual configuration. Scanning skips directories like node_modules / .git / target / dist.
Status Card and Control¶
After installation and restart, go to Settings → Plugins → dsh-dbhub-live to see the status card (visible only in the dsh web interface), containing: status badge, working mode, number of registered tools, number of environments, recent errors, enable/disable switch, and CRUD operations and connection testing for the connections. Card text follows the dsh interface language (Chinese / English) switching.
Two details worth knowing:
- After turning off the switch, all dbhub tools immediately return a friendly “Plugin Disabled” prompt, without needing a restart;
- Connection testing is one-time feedback, automatically disappearing after about 10 seconds; failures do not mark or restrict this connection, and slow databases wait for up to 30 seconds.
Installation and Uninstallation¶
First confirm environment requirements: need DeepSeek Harness dsh CLI (dsh web is responsible for GUI execution), recommend having Node.js ≥ 18 (including npm) locally—dbhub will be automatically installed on first execution.
Install command:
# Use locally installed dsh
dsh plugin --profile web add dsh-dbhub-live
# Or call via npx, no need for global dsh installation
npx @deepseek-ai/dsh plugin --profile web add dsh-dbhub-live
Restart dsh web after installation to take effect. For fixed version updates:
dsh plugin --profile web update dsh-dbhub-live@4.0.0
The dbhub auto-install package name defaults to @bytebase/dbhub, automatically updating at intervals: default 7 days, set to 0 to disable. You can modify “Auto-update interval (days)” in the status card, priority is User Settings > Process Environment Variables (default seed) > Built-in Default; corresponding environment variables are DSH_DBHUB_UPDATE_DAYS and DSH_DBHUB_PACKAGE.
All configurations and credentials are stored in:
~/.dsh/storages/dsh-dbhub-live/
Isolated by DSH_HOME instance; deleting this directory completely clears it. Uninstall with:
dsh plugin --profile web remove dsh-dbhub-live
Typical Usage¶
After the above installation steps and restart, tools are automatically called by DSH’s AI; you just need to make requests in natural language, e.g., “Check the users table”. The flow at the tool level is as follows:
# 1) When the current workspace has no connection yet, the AI first guides configuration (password is entered in the interface, AI cannot see it)
dbhub_configure
# 2) Execute a query on a configured connection (source seen in dbhub_list_sources)
dbhub_execute_sql source=myapp sql="SELECT * FROM users LIMIT 10;"
# 3) View registered connections and source values
dbhub_list_sources
If the model asks for a password during the conversation, this is by design—let the AI call dbhub_configure and fill in the password in the popup input box in the interface; or go to Settings → Plugins → Workspace Connections to modify it yourself.
Use Cases and Precautions¶
Suitable scenarios:
- Local development or debugging, letting AI directly execute queries, view tables and data;
- Users who do not want database passwords to appear in the conversation context;
- Situations where a workspace needs to distinguish between multiple environment connections like dev/prod/test.
Precautions:
- The plugin runs with the current dsh process permissions: it reads your authorized configuration files and initiates database connections on the host side. It is recommended to check the source code (see GitHub link below) and license (MIT) before installation.
- The status card is only visible in the Web settings panel of
dsh web; terminal environments without a settings panel do not affect tool usage. dbhub_search_objectsis only open to SQLite.
Summary¶
dsh-dbhub-live solves the core problem of “letting the model use the database, but not letting it touch the password”: zero-knowledge credentials plus one-time process execution keep the security surface and concurrency issues on the host side, while connections are managed by workspace × environment. If you are using DSH and often let AI query databases, you can install and try it following the steps above.
- GitHub: https://github.com/mr-mihu/dsh-dbhub-live
- Community Directory: https://www.skillhub.cn/plugins/mr-mihu/dsh-dbhub-live