Skip to main content

Introduction

@dineug/erd-editor-mcp is an MCP server that lets a coding agent edit erd-editor diagrams. Claude Code, Codex, and any other client of the Model Context Protocol get one tool per operation on a document: add a table, rename a column, relate two tables, import a DDL dump, read the schema back as SQL.

When the document is open in the ERD Editor of VS Code, Obsidian, or a JetBrains IDE, the agent joins the editor like a collaborator. Each change shows up on the canvas as it happens, and the agent's undo reverts only its own edits. VS Code keeps the agent's changes unsaved until the agent or you save, while Obsidian and a JetBrains IDE save them as they save your own. With no editor on the document, the same tools edit the file itself.

A coding agent adding tables and relationships to a diagram open in VS Code

What an Agent Can Do​

  • Build or change a schema in conversation: tables, columns and every column option, relationships with their cardinality and their ON DELETE and ON UPDATE actions, indexes, memos, colors, and positions on the canvas. See Relationships.
  • Replace the document with a schema parsed from SQL DDL, GraphQL SDL, DBML, or AML, or with another .erd.json document.
  • Read the diagram back as a list of ids, as whole entities, as DDL for any of the eight databases, or as the raw JSON. On a schema of thousands of tables it reads a page or a few tables at a time. See Reading a Document.
  • Change the settings the document stores: the database, the Code Generator language and name cases, the bracket type, and which parts of the diagram are shown, such as alternate key marks or the ON DELETE and ON UPDATE labels on relationship lines. See Settings.
  • Run several edits as one, all or none, which one undo reverts. See erd_batch.
  • Undo and redo its own edits, never yours.

What it does not do:

  • Zoom, scroll, or switch tabs. Those belong to each viewer, not to the document, so no tool changes them.
  • Run the Code Generator. erd_read answers DDL or JSON, and the agent writes code from that itself.

How It Works​

The server is a stdio process your MCP client starts. For every call it looks for an editor that holds the document: a VS Code window, an Obsidian vault window, or a JetBrains IDE, each with the ERD Editor extension or plugin.

  • Live — an editor has the document in its workspace, its vault, or one of its open projects, or has it open. The server joins that editor's editing session and the edit lands in the editor: unsaved in VS Code, and saved as your own edits are in Obsidian and a JetBrains IDE.
  • Headless — no editor. The server loads the file, applies the edit, and writes the file back.
  • Refused — an editor holds the document but has its hub off. The server reads from disk but writes nothing, since the open editor could overwrite the file on its next save.

See Live and Headless for the details.

Requirements​

Node.js22.12 or later, to run the server
An MCP clientClaude Code, Codex, or any client that can start a stdio server
VS Code, for live editing1.101.0 or later, with the ERD Editor extension 3.0.0 or later, 3.1.0 recommended
Obsidian, for live editingThe desktop app 1.5.7 or later, with the ERD Editor plugin 0.1.0 or later, 0.2.0 recommended
A JetBrains IDE, for live editingAn IntelliJ-based IDE 2025.2 or later, with the ERD Editor plugin 0.9.0 or later, 0.10.0 recommended

An extension or plugin that meets the minimum but is older than the recommended version still lets the agent edit live. It ignores the ON DELETE and ON UPDATE actions of a relationship, whether the agent sets them or imports them with a schema — see Updating.

Next: Install.