@dineug/erd-editor-mcp 0.2.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -98
- package/dist/erd-editor-mcp.js +75 -56
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,34 +1,47 @@
|
|
|
1
1
|
# @dineug/erd-editor-mcp
|
|
2
2
|
|
|
3
|
-
> An MCP server that lets a coding agent edit [
|
|
3
|
+
> An MCP server that lets a coding agent edit [ERD Editor](https://github.com/dineug/erd-editor)
|
|
4
4
|
> diagrams, live in VS Code, Obsidian or a JetBrains IDE, or straight on disk
|
|
5
5
|
|
|
6
|
-
Claude Code, Codex
|
|
7
|
-
|
|
8
|
-
relate two tables, import a DDL dump, read the schema back as SQL. When the document is open in
|
|
9
|
-
the [ERD Editor VS Code extension](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode),
|
|
10
|
-
the [ERD Editor Obsidian plugin](https://community.obsidian.md/plugins/erd-editor) or the
|
|
11
|
-
[ERD Editor plugin](https://plugins.jetbrains.com/plugin/23594-erd-editor) for IntelliJ-based IDEs,
|
|
12
|
-
the agent joins the editor as a collaborator: every call shows up on the canvas as it happens, with
|
|
13
|
-
the agent's focus on the cell it is editing. With no editor around, the same tools edit the file
|
|
14
|
-
itself.
|
|
6
|
+
Ask Claude Code, Codex or any [Model Context Protocol](https://modelcontextprotocol.io) client to
|
|
7
|
+
change your schema, and watch the change land on the canvas.
|
|
15
8
|
|
|
16
9
|

|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
- **One tool per edit** — add a table, rename a column, relate two tables, import a DDL dump, read
|
|
12
|
+
the schema back as SQL
|
|
13
|
+
- **Live in your editor** — when
|
|
14
|
+
[VS Code](https://marketplace.visualstudio.com/items?itemName=dineug.vuerd-vscode),
|
|
15
|
+
[Obsidian](https://community.obsidian.md/plugins/erd-editor) or a
|
|
16
|
+
[JetBrains IDE](https://plugins.jetbrains.com/plugin/23594-erd-editor) holds the diagram, the
|
|
17
|
+
agent joins as one more collaborator, and its undo reverts only its own edits
|
|
18
|
+
- **Headless on disk** — with no editor around, the same tools edit the file itself
|
|
19
|
+
- **Large schemas** — paged, searchable reads, and DDL of just the tables the agent needs
|
|
20
|
+
- **Self-contained** — one file with no runtime dependencies
|
|
20
21
|
|
|
21
22
|
## Install
|
|
22
23
|
|
|
24
|
+
The server needs Node.js 22.12 or later; `npx` downloads it the first time the agent starts it.
|
|
25
|
+
Keep ERD Editor and the server up to date together: when one speaks an older hub protocol than the
|
|
26
|
+
other, the server refuses to connect and says which one to update.
|
|
27
|
+
|
|
23
28
|
### Claude Code
|
|
24
29
|
|
|
30
|
+
Run in your project folder:
|
|
31
|
+
|
|
25
32
|
```sh
|
|
26
33
|
claude mcp add --transport stdio erd-editor -- npx -y @dineug/erd-editor-mcp
|
|
27
34
|
```
|
|
28
35
|
|
|
29
36
|
### Codex
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
Run once; the Codex CLI, app and IDE extension share the setting:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
codex mcp add erd-editor -- npx -y @dineug/erd-editor-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or add it to `~/.codex/config.toml`, or to `.codex/config.toml` in a trusted project:
|
|
32
45
|
|
|
33
46
|
```toml
|
|
34
47
|
[mcp_servers.erd-editor]
|
|
@@ -38,115 +51,99 @@ args = ["-y", "@dineug/erd-editor-mcp"]
|
|
|
38
51
|
|
|
39
52
|
### Any other MCP client
|
|
40
53
|
|
|
41
|
-
Run `npx -y @dineug/erd-editor-mcp` as a stdio server
|
|
42
|
-
against its working directory
|
|
43
|
-
|
|
44
|
-
On Windows it refuses a document name with a colon, such as `orders:v2.erd`, a device name such
|
|
45
|
-
as `NUL.erd` or `CON.erd`, or a name ending in a dot or a space, and leaves such files out when it
|
|
46
|
-
lists documents from disk: Windows would store another file than the one named. Use `-` in place
|
|
47
|
-
of `:`.
|
|
54
|
+
Run `npx -y @dineug/erd-editor-mcp` as a stdio server, started in your project folder: it resolves
|
|
55
|
+
relative document paths against its working directory.
|
|
48
56
|
|
|
49
57
|
## Live and headless
|
|
50
58
|
|
|
51
|
-
For
|
|
52
|
-
|
|
53
|
-
with the ERD Editor plugin, which keeps one lock for all its open projects, through the lock files
|
|
54
|
-
each keeps in `~/.erd-editor/ide/`:
|
|
59
|
+
For each call, the server looks in `~/.erd-editor/ide/` for an editor that holds the document: one
|
|
60
|
+
that has it open, or whose workspace, vault or project contains it.
|
|
55
61
|
|
|
56
62
|
| What it finds | What an edit does |
|
|
57
63
|
| --- | --- |
|
|
58
|
-
|
|
|
59
|
-
| No editor | **Headless.**
|
|
60
|
-
| An editor with its
|
|
61
|
-
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
The server never falls back to the file on its own while an editor holds a document: if the
|
|
80
|
-
connection drops it reconnects, and only when that editor has exited, or has closed the document
|
|
81
|
-
and stopped serving it, as Obsidian does when the plugin is disabled and a JetBrains IDE does when
|
|
82
|
-
a project closes or the plugin is disabled, does it edit the file and say so in the result.
|
|
64
|
+
| An editor that holds the document | **Live.** The change shows on the canvas at once. VS Code keeps it unsaved until you, Auto Save or `erd_save` save it; Obsidian and JetBrains IDEs save it as they save your own edits. |
|
|
65
|
+
| No editor | **Headless.** The change is written to the file. |
|
|
66
|
+
| An editor with its connection off, or an untrusted workspace or project | **Refused**, since the editor's next save would overwrite the change. Reads still come from disk. |
|
|
67
|
+
| An editor on another hub protocol | **Refused**, naming the side to update. |
|
|
68
|
+
|
|
69
|
+
The connection is on by default in each editor:
|
|
70
|
+
|
|
71
|
+
- **VS Code** — a hub per window, in trusted workspaces, off with `dineug.erd-editor.agentHub.enabled`.
|
|
72
|
+
The extension starts once the folder holds an `.erd.json` file or you open a diagram.
|
|
73
|
+
- **Obsidian** — a hub per vault window, off with **Settings → ERD Editor → Coding agents**.
|
|
74
|
+
- **JetBrains IDEs** — one hub for every open project, off with
|
|
75
|
+
**Settings | Tools | ERD Editor → Coding agents**.
|
|
76
|
+
|
|
77
|
+
Obsidian from Flathub and a JetBrains IDE installed as a Flatpak run no hub, so there the agent
|
|
78
|
+
edits the file on disk even while the diagram is open. Close it first in a JetBrains IDE, which
|
|
79
|
+
does not reload it and would overwrite the agent's change with your next edit; in Obsidian, an edit
|
|
80
|
+
you have not saved yet gives way to the agent's.
|
|
81
|
+
|
|
82
|
+
Windows paths, Flatpak sandboxes, reconnecting and conflicts on disk are in
|
|
83
|
+
[Live and Headless](https://docs.erd-editor.io/docs/mcp/live-and-headless).
|
|
83
84
|
|
|
84
85
|
## Documents
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
eight supported databases and the `json` format is the raw file. Editing the JSON file by hand is
|
|
97
|
-
not supported.
|
|
98
|
-
|
|
99
|
-
Schemas of hundreds or thousands of tables work too. A read answers at most 40,000 characters,
|
|
100
|
-
under the point where Claude Code sets a tool result aside in a file. `erd_list` answers a page of
|
|
101
|
-
100 tables and says where the next one starts; its `query` finds tables by a word in a table or
|
|
102
|
-
column name or comment, and `namesOnly` lists the table names alone, 2,000 short names in one
|
|
103
|
-
answer. `erd_get` and `erd_read` take `tableNames` as well as ids, so an agent asked for a SQL query
|
|
104
|
-
on a large schema reads the DDL of just the tables it needs. A read too large for one answer is
|
|
105
|
-
refused with how to narrow it.
|
|
87
|
+
- `erd_open_document` with `create` makes a missing file, adding `.erd.json` to a name with no
|
|
88
|
+
extension. In an Obsidian vault, name it `.erd`, which the file explorer lists.
|
|
89
|
+
- `erd_list` lists the tables by id, 100 to a page, then the table groups, memos and dictionary
|
|
90
|
+
rows, and finds tables by name, logical name or comment with `query`. `erd_get` reads entities by
|
|
91
|
+
id or table name.
|
|
92
|
+
- `erd_read` answers the whole document as a `snapshot`, as `sql` for any of the eight databases,
|
|
93
|
+
as `json` or as its `scripts`, or the DDL of just the tables or table groups it names.
|
|
94
|
+
- A read answers at most 40,000 characters, or one larger entity whole: `erd_read` says how to
|
|
95
|
+
narrow a larger read, and `erd_get` lists the ids it had no room for.
|
|
96
|
+
- Have the agent edit through the tools rather than write the JSON file itself.
|
|
106
97
|
|
|
107
98
|
## Tools
|
|
108
99
|
|
|
109
100
|
| Group | Tools |
|
|
110
101
|
| --- | --- |
|
|
111
|
-
| Session | `erd_list_documents`, `erd_open_document`, `erd_list`, `erd_get`, `erd_read`, `erd_save`, `erd_undo`, `erd_redo` |
|
|
112
|
-
| Tables | `erd_add_table`, `erd_remove_table`, `erd_change_table_name`, `erd_change_table_comment`, `erd_change_table_color`, `erd_move_table`, `erd_move_tables`, `erd_sort_tables` |
|
|
113
|
-
| Columns | `erd_add_column`, `erd_remove_columns`, `erd_change_column_name`, `erd_change_column_data_type`, `erd_change_column_default`, `erd_change_column_comment`, `erd_set_column_primary_key`, `erd_set_column_unique`, `erd_set_column_not_null`, `erd_set_column_auto_increment`, `erd_move_column` |
|
|
102
|
+
| Session | `erd_list_documents`, `erd_open_document`, `erd_list`, `erd_get`, `erd_read`, `erd_list_checks`, `erd_save`, `erd_undo`, `erd_redo` |
|
|
103
|
+
| Tables | `erd_add_table`, `erd_remove_table`, `erd_change_table_name`, `erd_change_table_comment`, `erd_set_table_logical_name`, `erd_change_table_color`, `erd_move_table`, `erd_move_tables`, `erd_sort_tables` |
|
|
104
|
+
| Columns | `erd_add_column`, `erd_remove_columns`, `erd_change_column_name`, `erd_change_column_data_type`, `erd_change_column_default`, `erd_change_column_comment`, `erd_set_column_logical_name`, `erd_set_column_domain`, `erd_set_column_primary_key`, `erd_set_column_unique`, `erd_set_column_not_null`, `erd_set_column_auto_increment`, `erd_move_column` |
|
|
114
105
|
| Relationships | `erd_add_relationship`, `erd_link_columns`, `erd_remove_relationship`, `erd_change_relationship_type`, `erd_change_relationship_on_delete`, `erd_change_relationship_on_update` |
|
|
115
106
|
| Indexes | `erd_add_index`, `erd_remove_index`, `erd_change_index_name`, `erd_set_index_unique`, `erd_add_index_column`, `erd_remove_index_column`, `erd_move_index_column`, `erd_set_index_column_order` |
|
|
116
107
|
| Memos | `erd_add_memo`, `erd_remove_memo`, `erd_change_memo_value`, `erd_change_memo_color`, `erd_move_memo`, `erd_resize_memo` |
|
|
117
|
-
|
|
|
108
|
+
| Table groups | `erd_add_table_group`, `erd_remove_table_group`, `erd_change_table_group_name`, `erd_change_table_group_color`, `erd_move_table_group`, `erd_resize_table_group`, `erd_set_table_group` |
|
|
109
|
+
| Dictionaries | `erd_add_word`, `erd_update_word`, `erd_remove_word`, `erd_add_term`, `erd_update_term`, `erd_remove_term`, `erd_add_domain`, `erd_update_domain`, `erd_remove_domain`, `erd_derive_physical_names` |
|
|
110
|
+
| Settings | `erd_set_database`, `erd_set_database_name`, `erd_set_ddl_script` |
|
|
118
111
|
| Import | `erd_import_sql`, `erd_import_graphql`, `erd_import_dbml`, `erd_import_aml`, `erd_import_json` |
|
|
119
112
|
| Batch | `erd_batch` |
|
|
120
113
|
|
|
121
|
-
`erd_batch` runs
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
114
|
+
- `erd_batch` runs up to 100 edits in order as one, all or none, and one `erd_undo` reverts it. A
|
|
115
|
+
step named with `as` passes the ids it creates to later steps as `$name`, so a table and its
|
|
116
|
+
columns take one call.
|
|
117
|
+
- A logical name set with `erd_set_table_logical_name` or `erd_set_column_logical_name` gives the
|
|
118
|
+
physical name, and a column its domain, from the word, term and domain dictionaries, as in the
|
|
119
|
+
editor; a name set by hand stays while it is not empty. `erd_derive_physical_names` derives the
|
|
120
|
+
names of a column, a table or the whole document again, as the editor's Derive Physical Names
|
|
121
|
+
Again does, after a word or term changed.
|
|
122
|
+
- `erd_list_checks` lists what the dictionaries find, as the Dictionary tab's Checks sheet does:
|
|
123
|
+
forbidden words, words no dictionary lists, synonyms, names two rows share, links to a removed
|
|
124
|
+
domain, physical names other than a term gives and column types other than their domain's, with
|
|
125
|
+
what to use instead where the dictionaries have it.
|
|
126
|
+
- The import tools replace the diagram by default and add to it with `mode: "append"`. The SQL,
|
|
127
|
+
GraphQL, DBML and AML imports keep the dictionaries.
|
|
128
|
+
- The agent sets the database, its name and the Schema SQL scripts; the view and code settings stay
|
|
129
|
+
yours to set in the editor.
|
|
130
|
+
- The edit and read tools refuse an unknown or mistyped argument before the document changes.
|
|
131
|
+
|
|
132
|
+
Every tool with its arguments and results is in [Tools](https://docs.erd-editor.io/docs/mcp/tools).
|
|
125
133
|
|
|
126
|
-
|
|
127
|
-
`onUpdate` of `erd_add_relationship` and `erd_link_columns`, set a foreign key's ON DELETE and ON
|
|
128
|
-
UPDATE actions. An ERD Editor extension or plugin released before referential actions ignores them
|
|
129
|
-
when it serves the document, so update it.
|
|
130
|
-
|
|
131
|
-
Every edit tool takes the document `path`. Settings other than `erd_set_show`, and
|
|
132
|
-
`erd_resize_memo`, make no undo entry in the editor, so `erd_undo` passes over them and the result
|
|
133
|
-
says so.
|
|
134
|
+
## Documentation
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
(-
|
|
138
|
-
|
|
136
|
+
- [Introduction](https://docs.erd-editor.io/docs/mcp/introduction) — what an agent can do and how it
|
|
137
|
+
works
|
|
138
|
+
- [Install](https://docs.erd-editor.io/docs/mcp/installation) — each client and each editor
|
|
139
|
+
- [Live and Headless](https://docs.erd-editor.io/docs/mcp/live-and-headless) — where an edit lands,
|
|
140
|
+
saving, undo, conflicts
|
|
141
|
+
- [Tools](https://docs.erd-editor.io/docs/mcp/tools) — every tool, paging a large schema, results
|
|
142
|
+
and refusals
|
|
139
143
|
|
|
140
|
-
##
|
|
144
|
+
## Issues
|
|
141
145
|
|
|
142
|
-
|
|
143
|
-
do, how it works, requirements
|
|
144
|
-
- [Install](https://docs.erd-editor.io/docs/mcp/installation) — Claude Code, Codex and any other
|
|
145
|
-
client, setting up VS Code, updating
|
|
146
|
-
- [Live and Headless](https://docs.erd-editor.io/docs/mcp/live-and-headless) — where an edit
|
|
147
|
-
lands, saving, undo, a window that goes away, conflicts on disk
|
|
148
|
-
- [Tools](https://docs.erd-editor.io/docs/mcp/tools) — every tool with its arguments, paging a
|
|
149
|
-
large schema, `erd_batch`, results and refusals
|
|
146
|
+
Found a bug or want a feature? [Open an issue](https://github.com/dineug/erd-editor/issues).
|
|
150
147
|
|
|
151
148
|
## License
|
|
152
149
|
|