Dbhawk

com.datasparc由 datasparc.com 發布v0.4.2更新於 Nov 7, 2026

Secure access to DBHawk datasources: browse schemas, run governed queries, DBHawk AI text-to-SQL.

概覽

AI 產生的概覽

把 AI 助理連接到 DBHawk 執行個體,可瀏覽資料來源、結構描述與資料表,執行受管控的查詢,並使用 DBHawk AI 文字轉 SQL。

可以做什麼
  • 列出已指派的資料來源、目錄、結構描述、物件與欄位
  • 執行唯讀查詢並檢視執行計畫;列出並終止資料庫工作階段
  • 透過獨立的語句工具執行資料或結構變更,受使用者的 MCP 層級限制
  • 由自然語言產生 SQL,並最佳化、格式化 SQL
  • 列出、檢視、建立、更新、暫停、繼續、執行與刪除排程匯出工作,並解釋 cron 運算式
  • 查看使用者的 MCP 層級、允許的操作與資料列上限
適用情境
適合讓助理針對 DBHawk 管理的資料庫回答問題、草擬與檢查 SQL,同時由 DBHawk 繼續套用使用者的存取控制、欄位遮罩與層級限制。也適用於管理 DBHawk 的排程匯出工作。
執行需求
以本機 Node.js 程序執行(Node 18 以上),來自 npm 套件或打包外掛。需要 DBHAWK_BASE_URL、具備 MCP 連接器的 DBHawk 伺服器(7.0.1 以上),以及 DBHAWK_TOKEN 中的個人權杖或首次使用時在瀏覽器互動登入。DBHAWK_DEFAULT_DATASOURCE 為選填。工作工具需要 MCP 工作排程器與 Job Scheduler 授權。
安裝前請注意
DBHAWK_TOKEN 是會換取短期 JWT 的個人權杖;未填時伺服器會開啟瀏覽器登入,並在使用者設定目錄保存更新權杖。execute_statement 可能變更資料或結構,kill_session 以及工作的建立、更新、刪除與執行都屬破壞性操作,應保留用戶端確認,不要一律允許。工作可透過電子郵件寄送結果,查詢與結構描述資訊會傳送到 DBHawk 伺服器。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Dbhawk,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

DBHawk MCP — Claude Code plugin + demo connector

Gives an AI assistant access to DBHawk: list the datasources a user is assigned, browse schema/tables/columns, run queries (with the user's access control and column masking applied), and use DBHawk AI text-to-SQL / optimize / format. Data or schema changes are possible only when the user's MCP tier allows them — the default tier is read-only (see Reads, writes and MCP tiers).

It's a thin bridge over the existing DBHawk REST surface at /api/v2/mcp/**. DBHawk decides what runs: every statement is classified and checked against the tier of the user's groups, whatever role the token owner has.

Sign in, or a personal token. Leave DBHAWK_TOKEN empty and the server signs in to DBHawk through the browser on the first tool call: the DBHawk login page opens (password, LDAP, 2FA or SSO - whatever your DBHawk offers), you approve the access once, and the server keeps a refresh token in your user profile for the next start (%APPDATA%\dbhawk-mcp on Windows, ~/Library/Application Support/dbhawk-mcp on macOS, ~/.config/dbhawk-mcp on Linux). This needs DBHawk 7.0.1 with the MCP connector; what you may do is decided by your MCP tier, exactly as with a token. See UPGRADE-7.1.0.md.

With a personal token, auth is two steps. DBHAWK_TOKEN is a personal token (dbh_<id>.<secret>), not a JWT — the MCP endpoints won't accept it directly. On its first call the server exchanges it for a short-lived JWT at POST /api/v2/auth/token/exchange (sending the personal token in the X-API-Token header), caches that JWT, and sends it as the Bearer for every /api/v2/mcp/** call. Shortly before the JWT's exp the server exchanges a fresh one up front; if a call still gets a 401 it re-exchanges and retries once — transparent to you.

dbhawk-mcp-plugin/                 <- this folder = a Claude Code "marketplace" (push it to git)├── .claude-plugin/marketplace.json└── dbhawk/                        <- the actual plugin (installed by users)    ├── .claude-plugin/plugin.json    ├── .mcp.json                  <- declares the "dbhawk" stdio MCP server    └── mcp-server/        ├── index.js               <- source        ├── package.json           <- build tooling (maintainers only)        └── dist/dbhawk-mcp.mjs    <- COMMITTED self-contained bundle (what users run; no npm install)

The bundle in dist/ inlines every dependency, so a bare git clone runs with zero install — that's what makes /plugin install work.


For users — install

Claude Code (from the marketplace)

Once this repo is on GitHub (see Publish below), point Claude Code at it and install:

bash
/plugin marketplace add datasparc/dbhawk-mcp-plugin/plugin install dbhawk@dbhawk-marketplace

dbhawk is the plugin name, dbhawk-marketplace is the marketplace name (from marketplace.json). Then set the connection (see Configure) and check the tools are live with /mcp.

Prefer to try it without a git host? Load the local folder for one session:

bash
claude --plugin-dir ./dbhawk-mcp-plugin/dbhawk

Claude Desktop (extension, .mcpb) — recommended

Claude Desktop installs this as a Desktop Extension with a proper GUI settings form (no JSON editing). It's the same MCP server, packaged as an .mcpb bundle.

  1. Download dbhawk-<version>.mcpb from the Releases page.
  2. In Claude Desktop: Settings → Extensions → Advanced settings → Install and pick the file (or just drag the .mcpb onto the Extensions window).
  3. Fill in the form — DBHawk Base URL, API Token (optional; masked, stored in your OS keychain - leave it empty to sign in through the browser instead), Default Datasource (optional) — and save.
  4. With no token, the first DBHawk tool call opens the DBHawk sign-in in your browser: sign in, click Allow, and repeat the request if Claude reported that it was waiting for the sign-in.

Claude Desktop does not auto-update file-installed extensions: to upgrade, download the newer .mcpb and install it again. This is independent of the Claude Code plugin — you don't need the marketplace plugin installed.

Claude Desktop (manual config, advanced)

Prefer to wire it by hand instead of the .mcpb? Point Desktop at the bundle with an absolute path. Edit claude_desktop_config.json (Windows: %APPDATA%\Claude\claude_desktop_config.json, macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):

json
{  "mcpServers": {    "dbhawk": {      "command": "C:\\Program Files\\nodejs\\node.exe",      "args": ["C:\\...\\dbhawk-mcp-plugin\\dbhawk\\mcp-server\\dist\\dbhawk-mcp.mjs"],      "env": {        "DBHAWK_BASE_URL": "https://demo.dbhawk.example.com",        "DBHAWK_TOKEN": "PASTE_MCP_TOKEN_HERE",        "DBHAWK_DEFAULT_DATASOURCE": ""      }    }  }}

Restart Claude Desktop fully (including the tray icon).


Configure

The server needs three values (the token owner needs ACCESS_TO_DATA):

SettingRequiredMeaning
Base URL (DBHAWK_BASE_URL)yesBase URL of DBHawk, e.g. https://demo.dbhawk.example.com (no trailing /api)
API Token (DBHAWK_TOKEN)noEmpty: sign in through the browser on first use (DBHawk 7.0.1+). Otherwise an MCP-scoped personal token (dbh_…): DBHawk → User Profile → API Token. Exchanged for a JWT at runtime — paste the personal token as-is, not a JWT
Default Datasource (DBHAWK_DEFAULT_DATASOURCE)noDatasource used when a tool call omits datasource

Claude Code — guided setup dialog (recommended)

The plugin declares these as userConfig fields in dbhawk/.claude-plugin/plugin.json, so Claude Code prompts for them when you enable the plugin — the token field is sensitive, so it's masked on entry and stored in secure storage (OS keychain / ~/.claude/.credentials.json), never in settings.json or git. dbhawk/.mcp.json wires them in via ${user_config.dbhawk_token} etc.

To re-enter or change them later, re-enable the plugin, or set them non-interactively:

bash
claude plugin install dbhawk@dbhawk-marketplace \  --config dbhawk_base_url=https://demo.dbhawk.example.com \  --config dbhawk_token=dbh_... \  --config dbhawk_default_datasource=

Claude Desktop — environment variables

Desktop doesn't understand plugins or userConfig — pass the three values as env in the claude_desktop_config.json block shown above.


Tools

ToolDBHawk endpoint
list_datasourcesGET /datasources
get_datasourceGET /datasources/{ds}
list_catalogsGET /datasources/{ds}/catalogs (MSSQL / Snowflake; empty for DBs with no catalog level)
list_schemasGET /datasources/{ds}/schemas
list_objectsGET /datasources/{ds}/schemas/{schema}/objects
list_columnsGET /datasources/{ds}/schemas/{schema}/objects/{object}/columns
get_permissionsGET /permissions (the user's MCP tier(s), allowed operations, row cap, confirmations)
run_queryPOST /datasources/{ds}/query with readOnly: true (reads only, even if the tier allows writes; row-capped 200/5000)
explain_planPOST /datasources/{ds}/explain (execution plan built and read on one connection; the statement is never executed; needs explain_plan in the tier)
list_sessionsGET /datasources/{ds}/sessions (active database sessions; needs active_sessions)
kill_sessionPOST /datasources/{ds}/sessions/{id}/kill (ends one listed session; destructive, confirm flow; needs kill_session)
execute_statementPOST /datasources/{ds}/query (data / schema change, only if the MCP tier allows it; confirm flow)
text_to_sqlPOST /datasources/{ds}/ai/ask
optimize_sqlPOST /datasources/{ds}/ai/optimize
format_sqlPOST /format-query
list_jobsGET /jobs (your own scheduled jobs; needs view_jobs)
get_jobGET /jobs/{id} (SQL, schedule, output, delivery; needs view_jobs)
list_job_executionsGET /jobs/{id}/executions (latest runs with the end of their logs; needs view_jobs)
explain_cronPOST /jobs/cron/explain (validates and describes a Quartz cron expression)
create_jobPOST /jobs (export job of ONE statement, results to your File Manager or by e-mail - delivery, emailTo, recipients in DBHawk's Allowed Domains; needs manage_jobs + the statement's operations; confirm flow, always when it e-mails anyone but you)
update_jobPUT /jobs/{id} (fields left out keep their value; delivery switches between File Manager and e-mail; confirm flow)
delete_jobPOST /jobs/{id}/delete (confirm flow; needs manage_jobs)
pause_job / resume_jobPOST /jobs/{id}/pause · /resume (resume re-checks the job's SQL against the tier; confirm flow)
run_job / interrupt_jobPOST /jobs/{id}/run · /interrupt (needs run_jobs; run re-checks the job's SQL; confirm flow)

The job tools need a DBHawk server with the MCP job scheduler (migration 87 adds view_jobs, manage_jobs and run_jobs, granted to the Destructive / admin tier only) and the Job Scheduler license.

The job tools are interactive where the client allows it, but always in plain text:

  • Job screen (MCP Apps): off. The HTML screen is commented out - no ui://dbhawk/jobs resource, and no tool carries _meta.ui.resourceUri. A client that shows MCP Apps is asked in a form like any other. To bring it back, uncomment the marked blocks in mcp-server/index.js.
  • Forms (clients that support MCP elicitation): create_job asks you for whatever the model left out (datasource, name, SQL, schedule, format, delivery). The schedule and the output are never taken from the model unseen: when it brings a valid cron, a format and a delivery, you get one question instead ("Schedule ... Result ... Delivery ... Is that right?"), and clearing the box opens the whole form on what it proposed. update_job with only a job id opens the job in a form, and a call your MCP tier wants confirmed asks you in a form. Declining changes nothing.
  • Chat dialog (every other client): create_job is filled in with you in the chat, one question at a time - DBHawk answers with the next question (datasource, name, SQL, schedule, format, delivery) instead of an error, and the assistant puts it to you and calls the tool again with your answer. Each is asked only where the model has not been told it; the schedule, the format and the delivery are never taken from it unseen - where it has all three, they go to you as one question ("Is that right?"), and if you want one of them changed the assistant calls again without it and DBHawk asks you for it. A cron DBHawk cannot read is asked again with the reason, and the confirmation your tier wants is still asked before anything is created.

mcp-server/ui/jobs.html stays in the repository (a copy of DBHawk's own src/main/resources/mcp/ui/jobs.html) but is no longer bundled or served.

Reads, writes and MCP tiers

What a user may do is set in DBHawk, per user group, by its MCP tier (Admin → MCP Management → MCP Tiers). The default tier is read-only; higher tiers add EXPLAIN, DML (INSERT / UPDATE / DELETE / MERGE), DDL and admin operations. get_permissions tells the model what its tier allows.

Reads and writes are separate tools on purpose. run_query is annotated read-only (readOnlyHint), and DBHawk refuses a write sent through it even when the tier allows one. execute_statement is annotated destructive (destructiveHint), so MCP clients such as Claude ask the user before each call - keep it that way, do not "always allow" it. When the tier also asks for confirmation, DBHawk answers the first call with { confirmationRequired: true, executed: false } and runs the statement only when it is repeated with confirm: true. A read-only datasource refuses writes whatever the tier says.

Demo prompts: "Which datasources do I have?" → "Show tables in schema public of Postgres-Demo" → "What columns does customers have?" → "How many orders last month by status?" (text-to-SQL → run).


For maintainers — publish & rebuild

Publish the marketplace

bash
cd dbhawk-mcp-plugingit init && git add . && git commit -m "DBHawk MCP plugin"git remote add origin [email protected]:datasparc/dbhawk-mcp-plugin.gitgit push -u origin main

Users then run the two /plugin commands above. To list it in Anthropic's curated claude-plugins-official directory, submit it via the plugin directory submission form (separate review); your own marketplace works immediately without that.

Rebuild the bundle (after editing index.js)

bash
cd dbhawk/mcp-servernpm install        # once, pulls the SDK + esbuild (build-time only)npm run build      # regenerates dist/dbhawk-mcp.mjsgit add dist/dbhawk-mcp.mjs && git commit -m "rebuild bundle"

dist/dbhawk-mcp.mjs is committed on purpose — it is the artifact users run. node_modules/ is not.

Tests

bash
cd dbhawk/mcp-servernpm test           # builds the bundle, then runs test/*.test.jsnpm run test:only  # runs the tests against the current bundle, without rebuilding

The tests start the real bundle over stdio, drive it with the official MCP client and point it at a fake DBHawk HTTP server that records every request (test/helpers.js), so no DBHawk instance is needed. They cover the tool catalogue and annotations, the read/write contract (run_query always sends readOnly: true, execute_statement sends confirm only when asked), the tool → endpoint mapping, the token exchange (header, JWT caching, one re-exchange on 401) and error reporting. CI (.github/workflows/mcp-server.yml) runs them on Node 18/20/22 and also fails when the committed dist/ bundle is stale, when the mcpb/server copy differs from it, or when the versions in the manifests, server.json and index.js disagree.

Build & release the desktop extension (.mcpb)

The mcpb/ folder is the extension source: mcpb/manifest.json (declares the user_config fields shown in Desktop's settings form) plus mcpb/server/dbhawk-mcp.mjs (a copy of the same dist/ bundle). After rebuilding the bundle, refresh the copy, then pack and release:

bash
cp dbhawk/mcp-server/dist/dbhawk-mcp.mjs mcpb/server/dbhawk-mcp.mjs   # keep the copy in syncnpx @anthropic-ai/mcpb validate mcpb/manifest.json                   # optional sanity checknpx @anthropic-ai/mcpb pack mcpb dbhawk-<version>.mcpb                # produces the .mcpb
# SBOM of everything inlined into the bundle (all deps are devDependencies, so don't --omit dev)(cd dbhawk/mcp-server && npm sbom --sbom-format cyclonedx) > dbhawk-mcp-<version>.cdx.json
gh release create v<version> dbhawk-<version>.mcpb dbhawk-mcp-<version>.cdx.json \  --title "DBHawk <version>" --notes "DBHawk MCP desktop extension"

The .cdx.json is a CycloneDX SBOM listing the exact package versions esbuild inlined into dist/dbhawk-mcp.mjs, so the bundle can be audited without unpacking it. Like the .mcpb, it is git-ignored and ships only as a Release asset.

Bump version in mcpb/manifest.json for every release (Desktop keys upgrades off it). The .mcpb is git-ignored — it ships as a Release asset, not in the tree. Keep mcpb/manifest.json's version in step with dbhawk/.claude-plugin/plugin.json so the plugin and the extension stay aligned.


Troubleshooting

  • token exchange failed: 401/403 — the personal DBHAWK_TOKEN is wrong, revoked or expired, the user isn't in the MCP access group, or (SSO/SAML users) the sign-in re-validation window lapsed — log in to DBHawk once via your identity provider, the same token then works again. Reissue if needed.
  • DBHawk API 401/403 (after exchange) — wrong scope or the user lacks ACCESS_TO_DATA.
  • … needs MCP operation(s) …, which your MCP tier … does not allow — the statement type is not in the user's MCP tier (the default tier is read-only). An admin assigns a higher tier to one of the user's groups (DBHawk → Admin → MCP Management → MCP Tiers, then the User Group dialog → MCP Tier).
  • … cannot run as a read-only query. Use the execute_statement tool instead. — a write was sent through run_query; the model has to use execute_statement, where the client asks the user first.
  • Datasource '…' is read-only … (403) — the datasource is marked read-only in DBHawk, so writes are refused whatever the MCP tier allows; reads still work.
  • confirmationRequired: true, executed: false — not an error: the tier asks for confirmation of writes. Show the statement to the user and, after they approve it, call execute_statement again with confirm: true.
  • Sign in to DBHawk in the browser window that just opened … — no token is configured and the browser sign-in has not finished yet. Sign in, click Allow, then repeat the request (the URL is in the message if no window appeared). To sign in as someone else, delete the oauth-*.json file in the dbhawk-mcp folder above.
  • This DBHawk server does not support signing in from the extension — the DBHawk server predates the MCP connector: configure a personal token.
  • Missing configuration on startup — DBHAWK_BASE_URL not set.
  • Invalid configuration on startup — DBHAWK_BASE_URL is not an https:// / http:// URL, contains credentials, a query or a trailing /api, or DBHAWK_TOKEN is a JWT instead of the personal dbh_… token.
  • Server not listed in /mcp — confirm Node ≥ 18 and that dist/dbhawk-mcp.mjs exists in the installed plugin. In Claude Desktop, use the full path to node (Desktop has a minimal PATH).

來源:README.md,提交 734f35c

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v0.4.2最新Oct 17, 2026
  2. v0.3.0Sep 23, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。