@dineug/erd-editor-mcp 0.1.0 → 0.2.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 +54 -16
- package/dist/erd-editor-mcp.js +56 -52
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# @dineug/erd-editor-mcp
|
|
2
2
|
|
|
3
3
|
> An MCP server that lets a coding agent edit [erd-editor](https://github.com/dineug/erd-editor)
|
|
4
|
-
> diagrams, live in VS Code or straight on disk
|
|
4
|
+
> diagrams, live in VS Code, Obsidian or a JetBrains IDE, or straight on disk
|
|
5
5
|
|
|
6
6
|
Claude Code, Codex and any other client of the [Model Context Protocol](https://modelcontextprotocol.io)
|
|
7
7
|
get one tool per editing operation on an `.erd.json` document: add a table, rename a column,
|
|
8
8
|
relate two tables, import a DDL dump, read the schema back as SQL. When the document is open in
|
|
9
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,
|
|
10
12
|
the agent joins the editor as a collaborator: every call shows up on the canvas as it happens, with
|
|
11
13
|
the agent's focus on the cell it is editing. With no editor around, the same tools edit the file
|
|
12
14
|
itself.
|
|
@@ -39,25 +41,45 @@ args = ["-y", "@dineug/erd-editor-mcp"]
|
|
|
39
41
|
Run `npx -y @dineug/erd-editor-mcp` as a stdio server. It resolves relative document paths
|
|
40
42
|
against its working directory, so start it in your project.
|
|
41
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 `:`.
|
|
48
|
+
|
|
42
49
|
## Live and headless
|
|
43
50
|
|
|
44
|
-
For every edit the server looks for
|
|
45
|
-
|
|
51
|
+
For every edit the server looks for an editor that holds the document, a VS Code window with the
|
|
52
|
+
ERD Editor extension, an Obsidian vault window with the ERD Editor plugin or an IntelliJ-based IDE
|
|
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/`:
|
|
46
55
|
|
|
47
56
|
| What it finds | What an edit does |
|
|
48
57
|
| --- | --- |
|
|
49
|
-
| A window whose workspace contains the document, or that has it open | **Live.** Opens the document in the ERD editor if needed, joins the editing session and applies the change there. Edits appear at once
|
|
50
|
-
| No
|
|
51
|
-
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
| A window whose workspace or vault contains the document, an IDE with a project that contains it, or an editor that has it open | **Live.** Opens the document in the ERD editor if needed, joins the editing session and applies the change there. Edits appear at once. VS Code keeps them unsaved until the agent calls `erd_save` (or you save); Obsidian saves them about two seconds later and a JetBrains IDE a fraction of a second after editing stops, as each saves your own edits, and `erd_save` writes them at once. The agent's `erd_undo` reverts only its own edits. |
|
|
59
|
+
| No editor | **Headless.** Loads the file, applies the change and replaces the file atomically. `erd_save` has nothing to do. A read-only file, such as a Perforce or TFVC file not checked out, is refused with `readonly` until you make it writable. On Windows, a file with permissions of its own, unlike its folder's, is written in place so that it keeps them, and a file another program holds open is tried again for up to two seconds. |
|
|
60
|
+
| An editor with its hub off | **Refused.** Reads still work, from disk. Writing the file under an open editor would be overwritten by its next save, so the server does not. |
|
|
61
|
+
| On Windows, an editor that holds the document under another path to the same file: the agent named it through a network share or a mapped drive of this computer, such as `\\localhost\C$\…`, and the editor opened it by its drive path, or the other way round | **Refused**, reads included; the result names the path the editor holds the document by, to call again with. |
|
|
62
|
+
| An editor Windows keeps the agent out of: one started as administrator while the agent was not, or any editor when the agent runs in a sandbox | **Refused**, reads included, with a result that says why. Run the editor and the agent with the same rights, for example by starting the editor again without administrator rights. With Windows 11's Administrator protection on, an editor started as administrator runs as a separate account whose lock files the agent never sees, so the edit goes headless under that editor: start it without administrator rights there. |
|
|
63
|
+
|
|
64
|
+
In VS Code the live hub runs in trusted workspaces and is on by default. Turn it off with the
|
|
65
|
+
setting `dineug.erd-editor.agentHub.enabled`; the window then still guards its documents from
|
|
66
|
+
headless writes. The extension activates in workspaces that contain `.erd`, `.erd.json`, `.vuerd`
|
|
67
|
+
or `.vuerd.json` files.
|
|
68
|
+
|
|
69
|
+
In Obsidian the live hub runs in every vault window while the ERD Editor plugin is enabled, and is
|
|
70
|
+
on by default. Turn it off with the plugin's coding-agent setting; the vault window then still
|
|
71
|
+
guards its files from headless writes.
|
|
72
|
+
|
|
73
|
+
In a JetBrains IDE the live hub runs while the ERD Editor plugin is enabled, one for the whole IDE
|
|
74
|
+
and every project open in it, and is on by default. Turn it off with Coding agents under
|
|
75
|
+
Settings | Tools | ERD Editor; the IDE then still guards the files of its projects from headless
|
|
76
|
+
writes. Trust is per project: an agent reads the ERD files of a project the IDE does not trust but
|
|
77
|
+
cannot change them. On Windows it listens on a named pipe, as the VS Code and Obsidian hubs do.
|
|
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.
|
|
61
83
|
|
|
62
84
|
## Documents
|
|
63
85
|
|
|
@@ -89,7 +111,7 @@ refused with how to narrow it.
|
|
|
89
111
|
| Session | `erd_list_documents`, `erd_open_document`, `erd_list`, `erd_get`, `erd_read`, `erd_save`, `erd_undo`, `erd_redo` |
|
|
90
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` |
|
|
91
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` |
|
|
92
|
-
| Relationships | `erd_add_relationship`, `erd_link_columns`, `erd_remove_relationship`, `erd_change_relationship_type` |
|
|
114
|
+
| Relationships | `erd_add_relationship`, `erd_link_columns`, `erd_remove_relationship`, `erd_change_relationship_type`, `erd_change_relationship_on_delete`, `erd_change_relationship_on_update` |
|
|
93
115
|
| 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` |
|
|
94
116
|
| Memos | `erd_add_memo`, `erd_remove_memo`, `erd_change_memo_value`, `erd_change_memo_color`, `erd_move_memo`, `erd_resize_memo` |
|
|
95
117
|
| Settings | `erd_set_database`, `erd_set_database_name`, `erd_set_language`, `erd_set_table_name_case`, `erd_set_column_name_case`, `erd_set_bracket_type`, `erd_set_relationship_data_type_sync`, `erd_set_relationship_optimization`, `erd_set_column_order`, `erd_set_max_width_comment`, `erd_set_ignore_save_settings`, `erd_set_show` |
|
|
@@ -101,6 +123,11 @@ a copy of the document first, so a refused one is named and nothing is applied,
|
|
|
101
123
|
reverts the whole batch. An operation named with `as` lets a later one pass `$name` (or `$name.1`
|
|
102
124
|
for its second created id) where it takes an entity id, so a table and its columns take one call.
|
|
103
125
|
|
|
126
|
+
`erd_change_relationship_on_delete` and `erd_change_relationship_on_update`, and the `onDelete` /
|
|
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
|
+
|
|
104
131
|
Every edit tool takes the document `path`. Settings other than `erd_set_show`, and
|
|
105
132
|
`erd_resize_memo`, make no undo entry in the editor, so `erd_undo` passes over them and the result
|
|
106
133
|
says so.
|
|
@@ -110,6 +137,17 @@ argument they do not declare, or one of the wrong type, with a JSON-RPC invalid
|
|
|
110
137
|
(-32602) before touching the document, so a misspelled argument is never silently dropped. The
|
|
111
138
|
other session tools ignore arguments they do not know.
|
|
112
139
|
|
|
140
|
+
## Documentation
|
|
141
|
+
|
|
142
|
+
- [Introduction](https://docs.erd-editor.io/docs/mcp/introduction) — what an agent can and cannot
|
|
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
|
|
150
|
+
|
|
113
151
|
## License
|
|
114
152
|
|
|
115
153
|
[MIT](https://github.com/dineug/erd-editor/blob/main/LICENSE)
|