@modudraft/mcp 0.2.0 → 0.3.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 +124 -59
- package/dist/index.js +19318 -18708
- package/package.json +6 -11
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,98 +1,163 @@
|
|
|
1
|
-
# modudraft
|
|
1
|
+
# @modudraft/mcp
|
|
2
2
|
|
|
3
|
-
MCP server for [Modudraft](https://
|
|
3
|
+
Model Context Protocol (MCP) server for [Modudraft](https://modudraft.com) — the system-design diagramming tool.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Connect your AI assistant (Claude, Cursor, Copilot, etc.) to your Modudraft diagrams and let it build and edit architecture, sequence, DB schema, and API diagrams for you.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
| `delete_node` | Remove a node and its connected edges |
|
|
17
|
-
| `add_edge` | Connect two nodes with a directed edge |
|
|
18
|
-
| `delete_edge` | Remove an edge |
|
|
19
|
-
| `clear_diagram` | Reset to an empty diagram |
|
|
20
|
-
| `export_diagram` | Export as a `.modudraft` JSON string |
|
|
21
|
-
| `import_diagram` | Load a diagram from a `.modudraft` string |
|
|
22
|
-
| `list_archetypes` | List all node archetypes (database, compute, queue…) |
|
|
23
|
-
| `list_tools` | List concrete tools for an archetype (postgresql, kafka…) |
|
|
24
|
-
| `list_protocols` | List edge protocol labels (HTTPS, gRPC, Kafka…) |
|
|
25
|
-
|
|
26
|
-
State is held in memory for the lifetime of the server process. Use `export_diagram` to save and `import_diagram` to reload.
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- **Modudraft Pro** account — API access is a Pro feature
|
|
12
|
+
- **Node.js 18+**
|
|
13
|
+
- An API key from your Modudraft dashboard
|
|
14
|
+
|
|
15
|
+
---
|
|
27
16
|
|
|
28
17
|
## Setup
|
|
29
18
|
|
|
30
|
-
###
|
|
19
|
+
### 1. Create an API key
|
|
20
|
+
|
|
21
|
+
Go to your [Modudraft dashboard](https://app.modudraft.com/dashboard) → **Settings → API Keys** → **Create new key**.
|
|
31
22
|
|
|
32
|
-
|
|
23
|
+
Copy the key — you'll only see it once.
|
|
24
|
+
|
|
25
|
+
### 2. Add to your MCP config
|
|
26
|
+
|
|
27
|
+
**Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
33
28
|
|
|
34
29
|
```json
|
|
35
30
|
{
|
|
36
31
|
"mcpServers": {
|
|
37
32
|
"modudraft": {
|
|
38
33
|
"command": "npx",
|
|
39
|
-
"args": ["-y", "modudraft
|
|
34
|
+
"args": ["-y", "@modudraft/mcp"],
|
|
35
|
+
"env": {
|
|
36
|
+
"MODUDRAFT_API_KEY": "mdft_your_key_here"
|
|
37
|
+
}
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
```
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### Claude Code
|
|
43
|
+
**Cursor** (`.cursor/mcp.json` in your project or `~/.cursor/mcp.json` globally):
|
|
48
44
|
|
|
49
|
-
```
|
|
50
|
-
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"modudraft": {
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["-y", "@modudraft/mcp"],
|
|
51
|
+
"env": {
|
|
52
|
+
"MODUDRAFT_API_KEY": "mdft_your_key_here"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
51
57
|
```
|
|
52
58
|
|
|
53
|
-
###
|
|
59
|
+
### Environment variables
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
| Variable | Required | Description |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `MODUDRAFT_API_KEY` | Yes | Your `mdft_…` API key |
|
|
64
|
+
| `MODUDRAFT_API_URL` | No | Override API base URL (default: `https://api.modudraft.com`) |
|
|
56
65
|
|
|
57
|
-
|
|
58
|
-
npx modudraft-mcp
|
|
59
|
-
```
|
|
66
|
+
---
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
## Tools
|
|
69
|
+
|
|
70
|
+
### Diagram management
|
|
71
|
+
| Tool | Description |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `list_diagrams` | List all your diagrams |
|
|
74
|
+
| `create_diagram` | Create a new diagram |
|
|
75
|
+
| `get_diagram` | Get full diagram state + missing-metadata hints |
|
|
76
|
+
| `delete_diagram` | Move diagram to Bin |
|
|
77
|
+
| `clear_diagram` | Remove all content from a diagram |
|
|
78
|
+
| `layout_diagram` | Auto-arrange nodes (dagre, supports LR/TB/RL/BT) |
|
|
79
|
+
| `get_share_link` | Get or create a share link |
|
|
80
|
+
|
|
81
|
+
### Architecture nodes & edges
|
|
82
|
+
| Tool | Description |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `add_node` | Add a component (compute, database, queue, gateway, etc.) |
|
|
85
|
+
| `update_node` | Update label, tool, or archetype |
|
|
86
|
+
| `delete_node` | Remove a node and its connections |
|
|
87
|
+
| `add_edge` | Connect two nodes with optional label and protocol |
|
|
88
|
+
| `update_edge` | Update edge label or protocol |
|
|
89
|
+
| `delete_edge` | Remove a connection |
|
|
90
|
+
| `add_boundary` | Add a grouping boundary box |
|
|
91
|
+
| `add_note` | Add a sticky note annotation |
|
|
92
|
+
|
|
93
|
+
### Node metadata
|
|
94
|
+
| Tool | Description |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `set_node_metadata` | Set a configuration property on a node (host, port, framework, region, etc.) |
|
|
97
|
+
| `suggest_metadata` | Find nodes with missing configuration and suggest what to fill in |
|
|
98
|
+
| `get_node_schema` | Get expected metadata fields for an archetype |
|
|
99
|
+
|
|
100
|
+
### Sequence diagram
|
|
101
|
+
| Tool | Description |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `add_sequence_message` | Add a message between participants |
|
|
104
|
+
| `add_sequence_participant` | Register a named participant |
|
|
105
|
+
| `clear_sequence` | Remove all sequence messages |
|
|
106
|
+
| `auto_sequence` | Derive sequence messages from the architecture edges |
|
|
107
|
+
|
|
108
|
+
### DB schema (ER diagram)
|
|
109
|
+
| Tool | Description |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `add_db_table` | Add a database table with columns |
|
|
112
|
+
| `update_db_table` | Replace a table's columns |
|
|
113
|
+
| `delete_db_table` | Remove a table |
|
|
114
|
+
| `export_er_diagram` | Export schema as SQL DDL |
|
|
115
|
+
|
|
116
|
+
### API schema (OpenAPI)
|
|
117
|
+
| Tool | Description |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `add_api_endpoint` | Add a REST/GraphQL/gRPC endpoint |
|
|
120
|
+
| `update_api_endpoint` | Update endpoint details |
|
|
121
|
+
| `delete_api_endpoint` | Remove an endpoint |
|
|
122
|
+
| `export_openapi` | Export schema as OpenAPI 3.0 JSON |
|
|
123
|
+
|
|
124
|
+
### Discovery (static, no API call)
|
|
125
|
+
| Tool | Description |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `list_archetypes` | All component archetypes with metadata field schemas |
|
|
128
|
+
| `list_tools` | Available tech tools per archetype (postgresql, redis, kafka, etc.) |
|
|
129
|
+
| `list_protocols` | Valid edge protocol values |
|
|
62
130
|
|
|
63
131
|
---
|
|
64
132
|
|
|
65
|
-
|
|
133
|
+
## Example prompts
|
|
66
134
|
|
|
67
|
-
|
|
68
|
-
git clone https://github.com/modudraft/modudraft-mcp
|
|
69
|
-
git clone https://github.com/modudraft/modudraft # sibling dir, needed for @modudraft/core
|
|
70
|
-
cd modudraft-mcp
|
|
71
|
-
npm install
|
|
72
|
-
npm run build
|
|
73
|
-
```
|
|
135
|
+
> "Create a diagram of a typical e-commerce backend with a React frontend, API gateway, user service, product service, order service, PostgreSQL databases, Redis cache, and Kafka queue. Connect them and layout the diagram."
|
|
74
136
|
|
|
75
|
-
|
|
137
|
+
> "Add the DB schema for the order service — orders, order_items, and payments tables."
|
|
76
138
|
|
|
77
|
-
|
|
78
|
-
{ "command": "node", "args": ["/path/to/modudraft-mcp/dist/index.js"] }
|
|
79
|
-
```
|
|
139
|
+
> "Auto-generate a sequence diagram from the architecture."
|
|
80
140
|
|
|
81
|
-
|
|
141
|
+
> "What metadata is missing from the diagram nodes? Fill in the hosts and ports based on our .env file."
|
|
82
142
|
|
|
83
|
-
|
|
84
|
-
npm run dev # watch mode (rebuilds on change)
|
|
85
|
-
npm run typecheck # type-check without building
|
|
86
|
-
```
|
|
143
|
+
---
|
|
87
144
|
|
|
88
|
-
##
|
|
145
|
+
## How it works
|
|
146
|
+
|
|
147
|
+
Each tool call requires a `diagram_id`. The server reads the current diagram from the Modudraft API, applies the change in memory, and writes it back. Changes appear instantly in the Modudraft web app.
|
|
89
148
|
|
|
90
|
-
|
|
149
|
+
The `get_diagram` response includes a `hints` array listing nodes with empty metadata fields so your AI assistant knows what context to ask you for.
|
|
91
150
|
|
|
92
|
-
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Security
|
|
93
154
|
|
|
94
|
-
|
|
155
|
+
- API keys are hashed (SHA-256) server-side and never stored in plain text
|
|
156
|
+
- Keys can be revoked at any time from the dashboard
|
|
157
|
+
- All requests use HTTPS
|
|
95
158
|
|
|
96
|
-
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## License
|
|
97
162
|
|
|
98
|
-
|
|
163
|
+
MIT © [Modudraft](https://modudraft.com)
|