Skip to content

feat: package DBHub as a Claude Desktop MCP Bundle (.mcpb)#356

Merged
tianzhou merged 4 commits into
mainfrom
add-mcpb-bundle
Jul 10, 2026
Merged

feat: package DBHub as a Claude Desktop MCP Bundle (.mcpb)#356
tianzhou merged 4 commits into
mainfrom
add-mcpb-bundle

Conversation

@tianzhou

@tianzhou tianzhou commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

Adds one-click Claude Desktop distribution via the MCP Bundle format, as requested in #146 (bitconym, and addressing the Desktop-without-OAuth case from Moongazer): download dbhub-<version>.mcpb, double-click, enter a connection string. Runs locally over stdio — no remote HTTP endpoint, no OAuth.

No server code changes. The bundle ships a static dbhub.toml using the existing ${ENV_VAR} interpolation (dsn = "${DBHUB_DSN}"); Claude Desktop injects DBHUB_DSN from the user's extension settings, which are stored in the OS keychain.

Read-only by design. The bundled config sets readonly = true + max_rows = 1000 on execute_sql, so writes are rejected by the classifier and the DB session is set read-only at the engine level (#342). Teams needing a different policy repackage with their own TOML — documented recipe included.

Changes

  • mcpb/ — MCPB v0.3 manifest (single required+sensitive dsn setting), read-only TOML config, icon
  • scripts/build-mcpb.mjs (pnpm run build:mcpb) — stages dist/ (minus workbench frontend, demo data, .d.ts), installs runtime deps + DB drivers (derived from optionalDependencies; cloud-auth packages excluded for size), validates and packs with @anthropic-ai/mcpb. Output: ~12 MB packed
  • scripts/smoke-test-mcpb.mjs (pnpm run test:mcpb) — unpacks the packed archive into an OS temp dir outside the repo (so module resolution can't silently lean on the project's node_modules — this caught a real packaging bug during development) and drives it over stdio with the MCP SDK client
  • .github/workflows/mcpb-release.yml — on any push to main touching package.json: skips when release v<version> already has the bundle asset, otherwise build → smoke test → create the release and attach the bundle (same semantics as npm-publish.yml: publish iff this version isn't in the channel yet). Skip decision runs before pnpm install so no-op runs are cheap
  • Docs: new dbhub.ai/mcpb page (install, security model, package-your-own recipe), pointers from README and installation guide
  • .gitignore: anchored dbhub.toml/dbhub.toml so the tracked mcpb/dbhub.toml template needs no negation

Notes for review

  • This introduces GitHub releases to the repo (none exist today) as the distribution channel for the bundle. The PR bumps the version to 0.23.0 (minor: new distribution channel), so merging publishes v0.23.0 across all channels — npm, Docker, MCP registry, and the first GitHub release with the bundle attached
  • Requires Node ≥ 22.5 at runtime (declared in manifest compatibility), matching the existing engines constraint

Test plan

  • pnpm run build:mcpb — manifest validates, packs at 11.8 MB
  • pnpm run test:mcpb — all checks pass against the packed archive: initialize, exactly two tools listed, SELECT succeeds, CREATE rejected read-only, all five connectors load from bundled drivers
  • pnpm run test:unit — 782 tests pass
  • Install the built .mcpb in Claude Desktop and query a real database

🤖 Generated with Claude Code

Add one-click Claude Desktop distribution via the MCP Bundle format:
double-click install, DSN prompted from user settings (stored in the OS
keychain), running locally over stdio. The bundle is read-only by design
(readonly = true, max_rows = 1000 on execute_sql) — the curated path for
giving non-technical users database access without a remote HTTP endpoint
or OAuth setup (#146).

No server code changes: the bundle ships a static dbhub.toml that uses the
existing ${ENV_VAR} interpolation (dsn = "${DBHUB_DSN}"), with DBHUB_DSN
injected by the client from the manifest's user_config.

- mcpb/: manifest (MCPB v0.3), read-only TOML config, icon
- scripts/build-mcpb.mjs: stages dist/ + runtime deps + drivers (derived
  from optionalDependencies, cloud-auth packages excluded), packs and
  validates with @anthropic-ai/mcpb; `pnpm run build:mcpb`
- scripts/smoke-test-mcpb.mjs: unpacks the archive outside the repo (so
  module resolution can't lean on the project's node_modules) and drives
  it over stdio with the MCP SDK client; `pnpm run test:mcpb`
- .github/workflows/mcpb-release.yml: on version bumps, builds, smoke
  tests, and attaches the bundle to GitHub release v<version>
- docs: new dbhub.ai/mcpb page + pointers from README/installation

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 10, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an MCP Bundle (.mcpb) distribution path for DBHub, enabling one-click installation in Claude Desktop with a bundled, read-only configuration and a CI workflow to publish the bundle as a GitHub release asset.

Changes:

  • Add MCPB manifest + bundled dbhub.toml template configured for read-only operation with DSN injected via DBHUB_DSN.
  • Add build + smoke-test scripts (pnpm run build:mcpb, pnpm run test:mcpb) to stage, pack, unpack, and validate the bundle over stdio.
  • Add release automation and documentation updates to surface the new installation path.

Reviewed changes

Copilot reviewed 12 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/smoke-test-mcpb.mjs Adds an end-to-end smoke test that unpacks the .mcpb outside the repo and drives the server over stdio.
scripts/mcpb-common.mjs Shared constants/helpers for MCPB build/test scripts (root path, bundle version, local bin resolution).
scripts/build-mcpb.mjs Stages dist/ + bundle assets, installs runtime deps/drivers, validates and packs the .mcpb.
README.md Documents the Claude Desktop MCP Bundle installation path and security/read-only posture.
pnpm-lock.yaml Adds @anthropic-ai/mcpb and its dependency graph to the lockfile.
package.json Adds build:mcpb / test:mcpb scripts and the @anthropic-ai/mcpb devDependency.
mcpb/manifest.json Introduces MCPB v0.3 manifest with user-configured DSN and stdio server launch config.
mcpb/dbhub.toml Adds the bundled read-only TOML template using ${DBHUB_DSN} interpolation.
docs/mcpb.mdx New documentation page describing install flow, security model, and repackaging instructions.
docs/installation.mdx Adds MCP Bundle as a recommended install option and cross-links to the new guide.
docs/docs.json Adds the new mcpb page to the docs navigation.
CLAUDE.md Documents the new MCP Bundle build/test commands and design notes for contributors.
.gitignore Ignores only root /dbhub.toml (keeps mcpb/dbhub.toml tracked) and ignores dist-mcpb/.
.github/workflows/mcpb-release.yml Adds GitHub Actions workflow to build/smoke-test and upload .mcpb to releases on version bumps.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread scripts/smoke-test-mcpb.mjs
Comment thread scripts/smoke-test-mcpb.mjs
Comment thread scripts/smoke-test-mcpb.mjs
Comment thread scripts/build-mcpb.mjs
- Attach the stderr listener before connect() — the SDK exposes the
  PassThrough before spawning, so a startup crash now surfaces its stderr
  instead of logging an empty string
- Convert stderr chunks to text explicitly
- Handle non-Error throws in the catch path; make client.close()
  best-effort so a close failure can't mask the real outcome
- Include the spawn error message when mcpb unpack fails to start

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 15 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread .github/workflows/mcpb-release.yml
…top-only

MCPB is governed by the Model Context Protocol project and installs
directly in Claude Desktop, Claude Code, and MCP for Windows; other
clients can run the unpacked bundle as a plain stdio server. Reword
README, docs, manifest, and comments accordingly, keeping Claude
Desktop as the concrete install walkthrough.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tianzhou tianzhou requested a review from Copilot July 10, 2026 16:38
build-mcpb.mjs stages the bundle's node_modules via npm install, and
Node 22.22.2's bundled npm is broken (missing promise-retry). Apply the
same bootstrap-without-npm upgrade step npm-publish.yml already uses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 15 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread .github/workflows/mcpb-release.yml
@tianzhou tianzhou merged commit 6647caa into main Jul 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants