@modudraft/mcp 0.12.3 → 0.12.5

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.
Files changed (3) hide show
  1. package/README.md +165 -1
  2. package/dist/index.js +1 -1
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -177,6 +177,7 @@ Copy the key - you'll only see it once.
177
177
  | Tool | Description |
178
178
  |---|---|
179
179
  | `export_mermaid` | Export as Mermaid flowchart or ER diagram (paste into GitHub Markdown) |
180
+ | `render_diagram_text` | Draw the architecture, sequence, DB schema (ER), cloud, network or data-flow tab as plain-text line art, the whole tab or a part of it (see [Viewing diagrams as text](#viewing-diagrams-as-text)) |
180
181
  | `export_plantuml` | Export as PlantUML component diagram |
181
182
  | `export_drawio` | Export as draw.io / diagrams.net XML |
182
183
  | `export_terraform` | Generate Terraform resource stubs from the cloud tab |
@@ -261,7 +262,9 @@ The `get_diagram` response includes a `hints` array listing nodes with empty met
261
262
 
262
263
  ## License
263
264
 
264
- MIT © [Modudraft](https://modudraft.com)
265
+ Proprietary software. Copyright © 2026 [Modudraft](https://modudraft.com). All rights reserved.
266
+
267
+ You may install and run this package to connect your own AI tools to the Modudraft service under a valid Modudraft account. Copying, modifying, redistributing, and reverse-engineering it are not permitted. The full terms are in the `LICENSE` file included in this package, and use of the service is governed by the [Terms of Service](https://modudraft.com/terms). Questions: security@modudraft.com.
265
268
 
266
269
  ## Auto-tidy
267
270
 
@@ -287,3 +290,164 @@ A node's `tool` is a catalog key (`better-auth`, `postgresql`, `google-oauth`),
287
290
  - `suggest_architecture` also recognises these names when it looks for an auth component in a description, and the nodes it proposes now carry real catalog archetypes (`client`, `gateway`, `auth`, `notification`, `search`, `database`, `cache`, `queue`, `storage`, `observability`, `compute`).
288
291
  - Aliases are part of the catalog itself (an `aliases` list on each tool in `@modudraft/core`), so the editor's palette search finds a tool by them too: typing `entra`, `next auth` or `sign in with google` finds Azure AD, Auth.js and Google OAuth.
289
292
  - Importing a dependency manifest (`import_file` on `package.json`, `requirements.txt`, `Gemfile`, `go.mod`, `composer.json`, `pom.xml`) now also reports an `auth` list of the authentication libraries it finds, under their catalog names (`Better Auth`, `Auth.js`, `Clerk`, `Keycloak`, `Microsoft OAuth`...), ready to pass straight to `add_node`. Bare `@supabase/supabase-js` and `firebase` are not counted as auth.
293
+
294
+ ## Viewing diagrams as text
295
+
296
+ `render_diagram_text` draws a tab as plain-text line art, so any agent or terminal can *see* a diagram without a Mermaid or PlantUML renderer. Print the returned `text` inside a code fence. It is read-only.
297
+
298
+ It draws the **full** tab or a **part** of it. `diagram_type` is `architecture` (default), `sequence`, `er` (the DB schema), `cloud`, `network` or `data_flow`.
299
+
300
+ | Selector | Applies to | Example | Shows |
301
+ |---|---|---|---|
302
+ | `focus` + `hops` + `direction` | architecture | `focus: "Auth", hops: 2, direction: "out"` | that node and everything within N edges (`out` = downstream, `in` = callers, `both` = default) |
303
+ | `nodes` | architecture | `nodes: ["Auth", "Postgres DB"]` | exactly those nodes and the edges between them |
304
+ | `boundary` | architecture | `boundary: "VPC"` | the nodes inside that boundary |
305
+ | `archetype` | architecture | `archetype: "database"` | only nodes of that archetype |
306
+ | `from_message` / `to_message` | sequence | `from_message: 13, to_message: 15` | messages 13 to 15 (0-based, inclusive) |
307
+ | `participants` | sequence | `participants: ["Web App", "API Server"]` | only messages between them |
308
+ | `focus` + `hops` + `direction` | er | `focus: "orders", hops: 1` | that table and the tables related to it (`out` = the tables it references, `in` = the tables that reference it) |
309
+ | `tables` / `name_prefix` / `schema` | er | `tables: ["users", "orders"]`, `name_prefix: "order"`, `schema: "audit"` | exactly those tables / tables whose name starts with it / tables of one schema |
310
+ | `detail` | er | `detail: "keys"` | `full` (default, every column), `keys` (only PK / FK / unique columns) or `names` (just the table names) |
311
+ | `root` | cloud, network | `root: "main-vpc"` | that resource and everything inside it |
312
+ | `depth` | cloud, network | `depth: 1` | this many levels below the root(s); `0` = only the roots. Boxes with hidden children show `(+N)` |
313
+ | `type` | cloud, network | `type: "ec2"` | resources of that type plus the chain of ancestors above them, marked as context |
314
+ | `config` / `style` | cloud, network | `config: "all"`, `style: "tree"` | how much config to show (`none`, `summary` = first 3 entries, `all`); `nested` boxes, an indented `tree`, or `auto` (nested, falling back to a tree when too wide or deeper than 4 levels) |
315
+ | `flow` / `descriptions` | data_flow | `flow: "Orders pipeline"`, `descriptions: true` | one flow / each stage's description under its name |
316
+
317
+ Selectors combine (each narrows the view). Nodes, boundaries, participants, tables, resources and flows are given by id or exact name, case-insensitive; an unknown or ambiguous one is an error that lists the choices. A partial view says what it leaves out: a box that still has hidden neighbours shows `(+N)` and they are listed below the diagram, and omitted messages are counted.
318
+
319
+ Options: `layout` (`LR` or `TB`, architecture and er), `max_width` (default 120; the renderer switches layout, moves edge labels to a numbered legend, or falls back to a tree, to fit), and `charset` (`unicode` or `ascii` for terminals and agents that cannot show box-drawing characters). The result also carries structured `shown`, `hidden` and `warnings`.
320
+
321
+ `focus: "Auth", hops: 2, direction: "out"`:
322
+
323
+ ```
324
+ ┌─────────────────┐
325
+ ┌►│ Microsoft OAuth │
326
+ │ │ external │
327
+ │ └─────────────────┘
328
+ │
329
+ │
330
+ ┌───────────┐ OAuth 2.0 │ ┌──────────────┐
331
+ │ Auth │─────────────┘ ┌►│ GitHub OAuth │
332
+ │ auth (+1) │── OAuth 2.0 ──┘ │ external │
333
+ │ │───────────────┐ └──────────────┘
334
+ └───────────┘ OAuth 2.0 │
335
+ │
336
+ │ ┌──────────────┐
337
+ └►│ Google OAuth │
338
+ │ external │
339
+ └──────────────┘
340
+
341
+ Partial view: 4 of 12 nodes, 3 of 11 edges shown (focus "Auth", 2 hops out).
342
+ Hidden neighbours:
343
+ Auth: <- API Server
344
+ ```
345
+
346
+ `diagram_type: "sequence", from_message: 13, to_message: 15, participants: ["Web App", "API Server"]`:
347
+
348
+ ```
349
+ Web App API
350
+ │ │
351
+ │ │ ... 13 earlier messages omitted
352
+ │ │ ┏ loop: on each edit (autosave)
353
+ │──────►│ ┃ 13 PATCH /api/diagrams/:id/ops {seq, ops}
354
+ │◄┄┄┄┄┄┄│ ┃ 15 200 { ok, seq }
355
+ │ │ ┗
356
+ │ │ ... 15 later messages omitted
357
+ │ │ ... 1 message with other participants hidden
358
+
359
+ Columns: API = API Server
360
+ ```
361
+
362
+ The ER view draws each table as a box of columns (`PK`, `FK`, `UK`; `?` marks a nullable column) and each relation as a line from the table that holds the foreign key, labelled with the column and `N:1`, `1:1` or `N:M`. Relations come from foreign-key columns and from stored relations, merged. Tables with no relations are packed into a grid. `diagram_type: "er", focus: "orders"`:
363
+
364
+ ```
365
+ ┌─────────────────────────┐
366
+ │ order_items │
367
+ │ (+1) │
368
+ │ PK id uuid │
369
+ │ FK order_id uuid │
370
+ │ FK,UK product_id uuid │
371
+ │ quantity integer │
372
+ └─────────────────────────┘
373
+ │
374
+ │ order_id N:1
375
+ ┌┘
376
+ ▼
377
+ ┌──────────────────────────────┐
378
+ │ orders │
379
+ │ PK id uuid │
380
+ │ FK user_id uuid │
381
+ │ FK billing_address_id uuid │
382
+ │ FK shipping_address_id uuid │
383
+ │ total numeric(10, 2) │
384
+ └──────────────────────────────┘
385
+ │ │ │
386
+ │ │ user_id N:1 │
387
+ [1] │ [2] │ ┌──┘
388
+ ┌────┘ ┌────┘ ▼
389
+ ▼ ▼ ┌────────────────┐
390
+ ┌────────────────┐ │ users │
391
+ │ addresses │ │ (+2) │
392
+ │ PK id uuid │ │ PK id uuid │
393
+ │ line1 text │ │ UK email text │
394
+ │ city text │ │ name? text │
395
+ └────────────────┘ └────────────────┘
396
+
397
+ Legend:
398
+ [1] orders -> addresses: billing_address_id N:1
399
+ [2] orders -> addresses: shipping_address_id N:1
400
+ Partial view: 4 of 10 tables, 4 of 9 relations shown (focus "orders", 1 hop).
401
+ Hidden neighbours:
402
+ users: <- profiles, <- audit.events
403
+ order_items: -> products
404
+ ```
405
+
406
+ Cloud and network are containment hierarchies (a VPC contains subnets), not graphs, so they are drawn as boxes nested inside their parent, or as an indented tree. `diagram_type: "cloud", style: "tree", config: "none"`:
407
+
408
+ ```
409
+ prod-account (aws-account)
410
+ · account_id: 123456789012
411
+ · region: eu-west-1
412
+ ├── main-vpc (vpc)
413
+ │ · cidr: 10.0.0.0/16
414
+ │ ├── public-a (subnet)
415
+ │ │ · cidr: 10.0.1.0/24
416
+ │ │ · az: eu-west-1a
417
+ │ │ ├── web-alb (load-balancer)
418
+ │ │ │ · scheme: internet-facing
419
+ │ │ ├── web-1 (ec2)
420
+ │ │ │ · instance_type: t3.small
421
+ │ │ │ · ami: ami-0abc
422
+ │ │ │ · key_pair: prod
423
+ │ │ │ · +1 more
424
+ │ │ └── web-2 (ec2)
425
+ │ │ · instance_type: t3.small
426
+ │ └── private-a (subnet)
427
+ │ · cidr: 10.0.2.0/24
428
+ │ └── orders-db (rds)
429
+ │ · engine: postgres
430
+ │ · size: db.t3.medium
431
+ └── assets (s3-bucket)
432
+ ```
433
+
434
+ A data flow is drawn as one lane per flow, sources to transforms to sinks: **all sources feed all transforms, and all transforms feed all sinks** (a column with several stages joins the next through a shared bus). The flow's notes sit on the arrows, or in a numbered legend when they are long. `diagram_type: "data_flow", flow: "Orders pipeline", descriptions: true`:
435
+
436
+ ```
437
+ Flow: Orders pipeline
438
+ Sources Transforms Sinks
439
+ ┌────────────────────────────────┐ ┌────────────────────────────┐ ┌──────────────────────┐
440
+ │ Orders API │ raw events │ Deduplicate │ [1] │ Warehouse │
441
+ │ source · postgresql │ ┌──────►│ transform · spark │───┬──►│ sink · snowflake │
442
+ │ Orders written by the checkout │──────┤ │ Drop repeated events by id │ │ └──────────────────────┘
443
+ │ service │ │ └────────────────────────────┘ │
444
+ └────────────────────────────────┘ │ │ ┌──────────────────────┐
445
+ │ │ │ Search index │
446
+ ┌────────────────────────────────┐ │ └──►│ sink · elasticsearch │
447
+ │ Web events │ │ └──────────────────────┘
448
+ │ source · kafka │──────┘
449
+ └────────────────────────────────┘
450
+
451
+ Legend:
452
+ [1] Orders pipeline: transforms -> sinks: cleaned, deduplicated rows ready for analytics and search
453
+ ```