@hiabhee/archdraw-mcp-server 1.0.4 → 1.0.6

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 (72) hide show
  1. package/README.md +119 -0
  2. package/dist/cli/project-link.d.ts +18 -0
  3. package/dist/cli/project-link.d.ts.map +1 -0
  4. package/dist/cli/project-link.js +129 -0
  5. package/dist/cli/project-link.js.map +1 -0
  6. package/dist/index.js +16 -812
  7. package/dist/index.js.map +1 -1
  8. package/dist/lib/checkpoints.d.ts +4 -0
  9. package/dist/lib/checkpoints.d.ts.map +1 -1
  10. package/dist/lib/checkpoints.js +14 -1
  11. package/dist/lib/checkpoints.js.map +1 -1
  12. package/dist/lib/diagram-state.d.ts +1 -0
  13. package/dist/lib/diagram-state.d.ts.map +1 -1
  14. package/dist/lib/diagram-state.js +5 -2
  15. package/dist/lib/diagram-state.js.map +1 -1
  16. package/dist/lib/http.d.ts +12 -0
  17. package/dist/lib/http.d.ts.map +1 -1
  18. package/dist/lib/http.js +11 -1
  19. package/dist/lib/http.js.map +1 -1
  20. package/dist/lib/project-binding.d.ts +29 -0
  21. package/dist/lib/project-binding.d.ts.map +1 -0
  22. package/dist/lib/project-binding.js +57 -0
  23. package/dist/lib/project-binding.js.map +1 -0
  24. package/dist/server.d.ts +32 -34
  25. package/dist/server.d.ts.map +1 -1
  26. package/dist/server.js +739 -141
  27. package/dist/server.js.map +1 -1
  28. package/dist/tools/apply-template.js +2 -2
  29. package/dist/tools/apply-template.js.map +1 -1
  30. package/dist/tools/export-diagram.d.ts +1 -1
  31. package/dist/tools/export-diagram.d.ts.map +1 -1
  32. package/dist/tools/export-diagram.js +6 -6
  33. package/dist/tools/export-diagram.js.map +1 -1
  34. package/dist/tools/fix-layout.js +2 -2
  35. package/dist/tools/fix-layout.js.map +1 -1
  36. package/dist/tools/generate-diagram.js +2 -2
  37. package/dist/tools/generate-diagram.js.map +1 -1
  38. package/dist/tools/update-diagram.js +2 -2
  39. package/dist/tools/update-diagram.js.map +1 -1
  40. package/package.json +12 -3
  41. package/dist/lib/__tests__/constants.test.d.ts +0 -2
  42. package/dist/lib/__tests__/constants.test.d.ts.map +0 -1
  43. package/dist/lib/__tests__/constants.test.js +0 -47
  44. package/dist/lib/__tests__/constants.test.js.map +0 -1
  45. package/dist/lib/__tests__/diagram-state.test.d.ts +0 -2
  46. package/dist/lib/__tests__/diagram-state.test.d.ts.map +0 -1
  47. package/dist/lib/__tests__/diagram-state.test.js +0 -82
  48. package/dist/lib/__tests__/diagram-state.test.js.map +0 -1
  49. package/dist/lib/__tests__/elk-runner.test.d.ts +0 -2
  50. package/dist/lib/__tests__/elk-runner.test.d.ts.map +0 -1
  51. package/dist/lib/__tests__/elk-runner.test.js +0 -87
  52. package/dist/lib/__tests__/elk-runner.test.js.map +0 -1
  53. package/dist/lib/elk-runner.d.ts +0 -29
  54. package/dist/lib/elk-runner.d.ts.map +0 -1
  55. package/dist/lib/elk-runner.js +0 -532
  56. package/dist/lib/elk-runner.js.map +0 -1
  57. package/dist/lib/prompt-builder.d.ts +0 -14
  58. package/dist/lib/prompt-builder.d.ts.map +0 -1
  59. package/dist/lib/prompt-builder.js +0 -133
  60. package/dist/lib/prompt-builder.js.map +0 -1
  61. package/dist/tools/__tests__/export-diagram.test.d.ts +0 -2
  62. package/dist/tools/__tests__/export-diagram.test.d.ts.map +0 -1
  63. package/dist/tools/__tests__/export-diagram.test.js +0 -40
  64. package/dist/tools/__tests__/export-diagram.test.js.map +0 -1
  65. package/dist/tools/__tests__/preview-links.test.d.ts +0 -2
  66. package/dist/tools/__tests__/preview-links.test.d.ts.map +0 -1
  67. package/dist/tools/__tests__/preview-links.test.js +0 -74
  68. package/dist/tools/__tests__/preview-links.test.js.map +0 -1
  69. package/dist/tools/__tests__/update-diagram.test.d.ts +0 -2
  70. package/dist/tools/__tests__/update-diagram.test.d.ts.map +0 -1
  71. package/dist/tools/__tests__/update-diagram.test.js +0 -98
  72. package/dist/tools/__tests__/update-diagram.test.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # @hiabhee/archdraw-mcp-server
2
+
3
+ The MCP server for [ArchDraw](https://archdraw.hiabhee.online). It lets an AI agent make, change, validate, and export software architecture diagrams.
4
+
5
+ The server uses the same Mermaid → Dagre layout pipeline as the ArchDraw editor. Each new diagram gets a preview link that you can open in a browser.
6
+
7
+ This document uses ASD-STE100 Simplified Technical English.
8
+
9
+ ## Select a connection type
10
+
11
+ | Connection type | Value | Use it when |
12
+ | --- | --- | --- |
13
+ | **Remote (HTTP)** | `https://archdraw.hiabhee.online/api/mcp` | The client can connect to a remote MCP server. This is the recommended type. You do not install this package. |
14
+ | **Local (stdio)** | `npx -y @hiabhee/archdraw-mcp-server@1.0.6` | The client can only start a local process. |
15
+
16
+ For the steps for each client (Claude Code, Claude apps, Codex, Cursor, VS Code, Gemini CLI, OpenCode, and others), refer to the [connection guide](https://archdraw.hiabhee.online/docs/connect-agents).
17
+
18
+ ## Use the local server
19
+
20
+ ### Requirements
21
+
22
+ - Node.js 18 or later
23
+ - Network access to `archdraw.hiabhee.online`
24
+
25
+ ### Configuration
26
+
27
+ Most clients use this format:
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "archdraw": {
33
+ "command": "npx",
34
+ "args": ["-y", "@hiabhee/archdraw-mcp-server@1.0.6"],
35
+ "env": {
36
+ "API_BASE_URL": "https://archdraw.hiabhee.online"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ > **CAUTION:** You must set `API_BASE_URL`. If you do not set it, the server starts and shows its tools, but `generate_diagram`, `fix_layout`, and preview links do not operate.
44
+
45
+ ### Environment variables
46
+
47
+ | Variable | Necessary | Function |
48
+ | --- | --- | --- |
49
+ | `API_BASE_URL` | Yes | The ArchDraw web API that does the layout, publishes previews, and keeps sessions. Use `https://archdraw.hiabhee.online`, or the URL of your own deployment. |
50
+
51
+ ## Link a repository to a live project
52
+
53
+ A live project is an ArchDraw canvas that shows which coding-agent session works on which component. To connect a repository to a live project:
54
+
55
+ 1. In the ArchDraw editor, open the canvas and select **Make live project**.
56
+ 2. In the repository, run:
57
+
58
+ ```bash
59
+ npx -y @hiabhee/archdraw-mcp-server@1.0.6 link --api https://archdraw.hiabhee.online
60
+ ```
61
+
62
+ 3. In the editor, select **Live project → Connect an agent** and enter the code that the command shows.
63
+
64
+ The command keeps the link in `~/.archdraw/projects.json` (mode `0600`), outside the repository. The file contains a project token. Do not share it. Other commands:
65
+
66
+ | Command | Result |
67
+ | --- | --- |
68
+ | `link --api <URL>` | Links the current repository (or its main repository, for a git worktree). |
69
+ | `status` | Shows the project that the current repository is linked to. |
70
+ | `unlink` | Removes the local link. To revoke the token, select **Stop** in the editor. |
71
+
72
+ The ArchDraw plugin for Claude Code uses this link to report the files that each session edits. It sends file paths only.
73
+
74
+ ## Tools
75
+
76
+ | Tool | Function |
77
+ | --- | --- |
78
+ | `read_me` | Gives the reference guide for the agent. The agent calls it first. |
79
+ | `generate_diagram` | Makes a diagram from Mermaid text or from nodes and edges. |
80
+ | `update_diagram` | Adds, removes, or changes nodes and edges in the current diagram. |
81
+ | `get_diagram_state` | Gives the nodes and edges of the current diagram. |
82
+ | `validate_diagram` | Finds structural problems and gives recommendations. |
83
+ | `fix_layout` | Calculates the layout again with the ArchDraw editor pipeline. |
84
+ | `apply_template` | Loads an architecture template. |
85
+ | `list_templates` | Gives the list of templates. |
86
+ | `list_node_types` | Gives the list of component types in the ArchDraw library. |
87
+ | `save_checkpoint` | Saves the current diagram with a name. |
88
+ | `load_checkpoint` | Restores a saved diagram. |
89
+ | `export_diagram` | Exports the diagram as JSON, PNG, or SVG. |
90
+
91
+ ## Data and privacy
92
+
93
+ - The server sends the diagram content that the agent gives it to `API_BASE_URL`. This includes component names, labels, connections, and Mermaid text. The server does not read your source files.
94
+ - Each new diagram gets a preview link by default. Anyone with the link can see the diagram. The link expires after 7 days. To prevent a link, tell the agent to keep the diagram private (`publish: false`).
95
+ - The local server keeps the working diagram and its checkpoints in memory. It discards them when the process stops.
96
+
97
+ > **WARNING:** Do not put passwords, API keys, or other secrets in diagram labels.
98
+
99
+ Refer to the [privacy policy](https://archdraw.hiabhee.online/privacy).
100
+
101
+ ## Use the server in your own code
102
+
103
+ The package exports a server factory for Streamable HTTP hosts:
104
+
105
+ ```ts
106
+ import { createArchDrawMCPServer, handleMcpHttpRequest } from '@hiabhee/archdraw-mcp-server/server';
107
+ ```
108
+
109
+ The hosted endpoint at `/api/mcp` uses this export.
110
+
111
+ ## Links
112
+
113
+ - [Source code](https://github.com/hiabhee/ArchDraw/tree/main/mcp-server)
114
+ - [Connection guide](https://archdraw.hiabhee.online/docs/connect-agents)
115
+ - [Issues](https://github.com/hiabhee/ArchDraw/issues)
116
+
117
+ ## License
118
+
119
+ MIT
@@ -0,0 +1,18 @@
1
+ /**
2
+ * `archdraw-mcp-server link|unlink|status` — pair this git checkout with an
3
+ * ArchDraw live project. Pairing uses the browser approval flow
4
+ * (`/api/agentic/pairing`): the CLI shows a code, the user enters it in the
5
+ * editor's Live project panel, and the CLI receives a project-scoped token.
6
+ * Output goes to stderr except the final machine-readable line.
7
+ */
8
+ export declare const PROJECT_COMMANDS: Set<string>;
9
+ interface CliIO {
10
+ log: (message: string) => void;
11
+ fetch: typeof fetch;
12
+ sleep: (ms: number) => Promise<void>;
13
+ cwd: string;
14
+ env: NodeJS.ProcessEnv;
15
+ }
16
+ export declare function runProjectCommand(command: string, argv: string[], io?: CliIO): Promise<number>;
17
+ export {};
18
+ //# sourceMappingURL=project-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-link.d.ts","sourceRoot":"","sources":["../../src/cli/project-link.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,eAAO,MAAM,gBAAgB,aAAwC,CAAC;AAItE,UAAU,KAAK;IACb,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB;AA0HD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjH"}
@@ -0,0 +1,129 @@
1
+ import { getBinding, removeBinding, resolveRepoRoot, saveBinding, bindingFilePath } from '../lib/project-binding.js';
2
+ /**
3
+ * `archdraw-mcp-server link|unlink|status` — pair this git checkout with an
4
+ * ArchDraw live project. Pairing uses the browser approval flow
5
+ * (`/api/agentic/pairing`): the CLI shows a code, the user enters it in the
6
+ * editor's Live project panel, and the CLI receives a project-scoped token.
7
+ * Output goes to stderr except the final machine-readable line.
8
+ */
9
+ export const PROJECT_COMMANDS = new Set(['link', 'unlink', 'status']);
10
+ const POLL_INTERVAL_MS = 3000;
11
+ const defaultIO = () => ({
12
+ log: (message) => process.stderr.write(`${message}\n`),
13
+ fetch,
14
+ sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
15
+ cwd: process.cwd(),
16
+ env: process.env,
17
+ });
18
+ function parseArgs(argv) {
19
+ const flags = {};
20
+ for (let i = 0; i < argv.length; i++) {
21
+ const arg = argv[i];
22
+ if (arg.startsWith('--')) {
23
+ const [key, inline] = arg.slice(2).split('=', 2);
24
+ flags[key] = inline ?? argv[++i] ?? '';
25
+ }
26
+ }
27
+ return flags;
28
+ }
29
+ function formatUserCode(code) {
30
+ return code.match(/.{1,4}/g)?.join('-') ?? code;
31
+ }
32
+ function normalizeApiBase(value) {
33
+ if (!value)
34
+ return null;
35
+ try {
36
+ const url = new URL(value);
37
+ if (url.protocol !== 'https:' && !['localhost', '127.0.0.1'].includes(url.hostname))
38
+ return null;
39
+ return url.origin;
40
+ }
41
+ catch {
42
+ return null;
43
+ }
44
+ }
45
+ async function link(flags, io) {
46
+ const apiBase = normalizeApiBase(flags.api || io.env.API_BASE_URL);
47
+ if (!apiBase) {
48
+ io.log('Pass the ArchDraw URL: link --api https://archdraw.hiabhee.online (https, or http://localhost for development).');
49
+ return 2;
50
+ }
51
+ const repoRoot = resolveRepoRoot(io.cwd);
52
+ const start = await io.fetch(`${apiBase}/api/agentic/pairing`, { method: 'POST' });
53
+ if (!start.ok) {
54
+ io.log(`Could not start pairing (${start.status}).`);
55
+ return 1;
56
+ }
57
+ const pairing = (await start.json());
58
+ io.log('');
59
+ io.log(`Linking ${repoRoot} to an ArchDraw live project.`);
60
+ io.log(`Open your project canvas in ArchDraw → Live project → Connect an agent, and enter:`);
61
+ io.log('');
62
+ io.log(` ${formatUserCode(pairing.userCode)}`);
63
+ io.log('');
64
+ io.log(`Waiting for approval (expires ${new Date(pairing.expiresAt).toLocaleTimeString()})…`);
65
+ const deadline = new Date(pairing.expiresAt).getTime();
66
+ while (Date.now() < deadline) {
67
+ await io.sleep(POLL_INTERVAL_MS);
68
+ const res = await io.fetch(`${apiBase}/api/agentic/pairing/poll`, {
69
+ method: 'POST',
70
+ headers: { 'Content-Type': 'application/json' },
71
+ body: JSON.stringify({ pairingId: pairing.pairingId, pollToken: pairing.pollToken }),
72
+ });
73
+ if (res.status === 202)
74
+ continue;
75
+ if (res.status === 410)
76
+ break;
77
+ const body = (await res.json().catch(() => ({})));
78
+ if (res.ok && body.status === 'complete' && body.projectId && body.workspaceId) {
79
+ if (!body.canvasId) {
80
+ io.log('Approved, but that project is not linked to a canvas. Use "Make live project" on a canvas and try again.');
81
+ return 1;
82
+ }
83
+ saveBinding(repoRoot, {
84
+ apiBase,
85
+ canvasId: body.canvasId,
86
+ agenticProjectId: body.projectId,
87
+ workspaceId: body.workspaceId,
88
+ token: pairing.pollToken,
89
+ linkedAt: new Date().toISOString(),
90
+ });
91
+ io.log(`Linked. Credentials saved to ${bindingFilePath()} (outside the repository).`);
92
+ io.log(`Project canvas: ${apiBase}/editor?canvas=${encodeURIComponent(body.canvasId)}`);
93
+ return 0;
94
+ }
95
+ if (!res.ok && res.status !== 409) {
96
+ io.log(`Pairing failed (${res.status}).`);
97
+ return 1;
98
+ }
99
+ }
100
+ io.log('Pairing code expired. Run link again.');
101
+ return 1;
102
+ }
103
+ function unlink(io) {
104
+ const repoRoot = resolveRepoRoot(io.cwd);
105
+ const removed = removeBinding(repoRoot);
106
+ io.log(removed
107
+ ? `Unlinked ${repoRoot}. To revoke the credential too, use "Stop" in the editor's Live project panel.`
108
+ : `${repoRoot} is not linked.`);
109
+ return 0;
110
+ }
111
+ function status(io) {
112
+ const repoRoot = resolveRepoRoot(io.cwd);
113
+ const binding = getBinding(repoRoot);
114
+ if (!binding) {
115
+ io.log(`${repoRoot} is not linked to an ArchDraw project.`);
116
+ return 1;
117
+ }
118
+ io.log(`${repoRoot} → ${binding.apiBase}/editor?canvas=${encodeURIComponent(binding.canvasId)} (linked ${binding.linkedAt})`);
119
+ return 0;
120
+ }
121
+ export async function runProjectCommand(command, argv, io = defaultIO()) {
122
+ const flags = parseArgs(argv);
123
+ if (command === 'link')
124
+ return link(flags, io);
125
+ if (command === 'unlink')
126
+ return unlink(io);
127
+ return status(io);
128
+ }
129
+ //# sourceMappingURL=project-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-link.js","sourceRoot":"","sources":["../../src/cli/project-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAErH;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEtE,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAU9B,MAAM,SAAS,GAAG,GAAU,EAAE,CAAC,CAAC;IAC9B,GAAG,EA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