Skip to content

feat: erd-studio-mcp — read-only MCP server#45

Merged
liam-machine merged 3 commits into
mainfrom
feat/mcp-server
May 12, 2026
Merged

feat: erd-studio-mcp — read-only MCP server#45
liam-machine merged 3 commits into
mainfrom
feat/mcp-server

Conversation

@liam-machine
Copy link
Copy Markdown
Owner

Summary

Adds an MCP (Model Context Protocol) server at mcp-server/ that gives Claude, Cursor, Continue, Zed, Claude Desktop, or any MCP-compatible AI client read-only access to a dbt project's ERD Studio semantic model.

The MCP is intentionally read-only. For write/design workflows (creating ERDs, adding models, drawing relationships, generating dbt SQL), the AI is instructed to point users at the VS Code extension + its bundled skill — which provides deeper integration (multi-file edits, refactor-style changes) than atomic MCP tool calls could.

The two distribution paths are complementary:

  • Extension + skill = the deep integration for Claude Code / VS Code users
  • MCP = the broad integration for non-Claude-Code AI ecosystems, plus discoverability via the MCP registry

Commits

  • b599e5d docs: mark project as explicitly open source
  • 4e65959 feat: add MCP server (erd-studio-mcp v0.1.0)
  • 2a3037f feat(mcp-server): position MCP as read-only complement to the extension

What's in this PR

New package mcp-server/ (16 files, ~2700 lines)

  • package.json — published independently as erd-studio-mcp on npm
  • src/index.ts — McpServer with stdio transport, instructions block leading with "READ-ONLY by design"
  • src/services.ts — reuses parent DomainService, LogicalModelService, ManifestService directly (these were already pure-Node, no refactor needed)
  • src/lib/setup.ts — extension marketplace URL + canonical "not initialized" tip
  • src/tools/*.ts — one file per tool

Tools (6 total, all read-only)

Tool Returns
list_domains ERDs grouped by layer
read_domain Full domain incl. models + columns + relationships + cardinality + rationale
list_models All logical models from erd-studio/logical-models/*.yml
read_model One logical model with column-level metadata
list_manifest_models Models from target/manifest.json with test coverage
get_editor_setup Returns extension install instructions — the AI calls this when the user wants to edit/design/build

UX details

  • If erd-studio/ doesn't exist: list-tools return empty result + tip field pointing at the marketplace; read-tools throw the same tip. The AI naturally surfaces the install path to the user — no scary errors.
  • Server instructions block explicitly says READ-ONLY and tells the AI to recommend the extension for edits.

Build

esbuild bundles index.js (~150KB) + manifestWorker.js (~6KB) with ESM __dirname polyfill so the worker_threads spawn resolves correctly.

Tested

mcp-server/test-smoke.mjs exercises the full JSON-RPC protocol against test/fixtures/dbt-project:

  • ✅ initialize handshake
  • ✅ tools/list — 6 tools advertised
  • ✅ All 6 tool calls return expected data
  • ✅ Uninitialized project → returns install tip (not an error)

Test plan

  • Review the tool surface in mcp-server/src/tools/
  • Eyeball the server instructions in mcp-server/src/index.ts — these are loaded into AI context by every MCP client
  • Skim mcp-server/README.md — what users see on npm + the GitHub package page
  • (Optional) Run cd mcp-server && node test-smoke.mjs locally
  • Merge

Once merged: I'll npm publish from mcp-server/, then open PRs to modelcontextprotocol/servers and punkpeye/awesome-mcp-servers to register the package.

🤖 Generated with Claude Code

liam-machine and others added 3 commits May 12, 2026 12:22
Adds "open source" language to the pitch and footer. The repo was
already public + MIT, but the README didn't say so in words — now it
does, with a "View source" link in the footer for discoverability.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a Model Context Protocol server at mcp-server/ that gives Claude,
Cursor, Continue, Zed, etc. read-only access to a dbt project's ERD
Studio semantic model.

Architecture:
- New package mcp-server/, published independently as erd-studio-mcp
- Reuses existing pure-Node services (DomainService, LogicalModelService,
  ManifestService) — no refactoring needed; those services were already
  isolated from vscode APIs
- stdio transport via @modelcontextprotocol/sdk
- One file per tool, thin wrappers around the services
- esbuild bundles index.js + manifestWorker.js with ESM __dirname polyfill
  so the worker_threads spawn path resolves correctly

Tools (v1, all read-only, all idempotent):
- list_domains       — ERDs grouped by layer
- read_domain        — full domain incl. models, columns, relationships,
                       cardinality, rationale
- list_models        — all logical models from logical-models/*.yml
- read_model         — one logical model with column-level metadata
- list_manifest_models — what dbt actually built, from target/manifest.json,
                         including unique/relationship test coverage

Mutation tools (propose_model_change, apply_sync_plan) deferred to v2.

Verified end-to-end via mcp-server/test-smoke.mjs against
test/fixtures/dbt-project — initialize handshake + all 5 tool calls
return expected data.

Install: `npx erd-studio-mcp` or `claude mcp add erd-studio -- npx -y erd-studio-mcp`

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The MCP server now explicitly signals it is read-only and points users to
the ERD Studio VS Code extension (which ships an AI coding skill) for any
write/design workflow. The two are complementary distribution paths, not
redundant: the skill is deeper for Claude Code users; the MCP is broader
for Cursor/Continue/Zed/Claude Desktop and discoverability via the MCP
registry.

Changes:
- New tool: get_editor_setup returns canonical install commands +
  marketplace link. AI is instructed to call this when the user asks
  about editing/designing/building.
- Server instructions block now leads with "READ-ONLY by design" and
  the extension path.
- list_domains / list_models gracefully return empty result + a `tip`
  field when erd-studio/ doesn't exist, instead of erroring on
  fs.readdir. Same friendly path on read_domain / read_model (throw
  with the tip in the error message).
- Smoke test extended: verifies get_editor_setup returns the marketplace
  link, and verifies an uninitialized project returns the install tip.
- README rewritten to lead with the read-only + extension positioning,
  with a clear "pick the right tool" table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@liam-machine liam-machine merged commit 5d9bc84 into main May 12, 2026
2 checks passed
@liam-machine liam-machine deleted the feat/mcp-server branch May 12, 2026 02:54
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.

1 participant