@next-ai-drawio/mcp-server 0.1.3 → 0.1.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.
- package/README.md +1 -0
- package/dist/history.d.ts +16 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +48 -0
- package/dist/history.js.map +1 -0
- package/dist/http-server.d.ts +6 -19
- package/dist/http-server.d.ts.map +1 -1
- package/dist/http-server.js +329 -148
- package/dist/http-server.js.map +1 -1
- package/dist/index.js +53 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/api-client.d.ts +0 -30
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-client.js +0 -87
- package/dist/api-client.js.map +0 -1
- package/dist/session.d.ts +0 -59
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -120
- package/dist/session.js.map +0 -1
package/README.md
CHANGED
|
@@ -86,6 +86,7 @@ Use the standard MCP configuration with:
|
|
|
86
86
|
## Features
|
|
87
87
|
|
|
88
88
|
- **Real-time Preview**: Diagrams appear and update in your browser as the AI creates them
|
|
89
|
+
- **Version History**: Restore previous diagram versions with visual thumbnails - click the clock button (bottom-right) to browse and restore earlier states
|
|
89
90
|
- **Natural Language**: Describe diagrams in plain text - flowcharts, architecture diagrams, etc.
|
|
90
91
|
- **Edit Support**: Modify existing diagrams with natural language instructions
|
|
91
92
|
- **Export**: Save diagrams as `.drawio` files
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple diagram history - matches Next.js app pattern
|
|
3
|
+
* Stores {xml, svg} entries in a circular buffer
|
|
4
|
+
*/
|
|
5
|
+
export declare function addHistory(sessionId: string, xml: string, svg?: string): number;
|
|
6
|
+
export declare function getHistory(sessionId: string): Array<{
|
|
7
|
+
xml: string;
|
|
8
|
+
svg: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function getHistoryEntry(sessionId: string, index: number): {
|
|
11
|
+
xml: string;
|
|
12
|
+
svg: string;
|
|
13
|
+
} | undefined;
|
|
14
|
+
export declare function clearHistory(sessionId: string): void;
|
|
15
|
+
export declare function updateLastHistorySvg(sessionId: string, svg: string): boolean;
|
|
16
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,MAAM,CAsB3E;AAED,wBAAgB,UAAU,CACtB,SAAS,EAAE,MAAM,GAClB,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAErC;AAED,wBAAgB,eAAe,CAC3B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACd;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAG1C;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAS5E"}
|
package/dist/history.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple diagram history - matches Next.js app pattern
|
|
3
|
+
* Stores {xml, svg} entries in a circular buffer
|
|
4
|
+
*/
|
|
5
|
+
import { log } from "./logger.js";
|
|
6
|
+
const MAX_HISTORY = 20;
|
|
7
|
+
const historyStore = new Map();
|
|
8
|
+
export function addHistory(sessionId, xml, svg = "") {
|
|
9
|
+
let history = historyStore.get(sessionId);
|
|
10
|
+
if (!history) {
|
|
11
|
+
history = [];
|
|
12
|
+
historyStore.set(sessionId, history);
|
|
13
|
+
}
|
|
14
|
+
// Dedupe: skip if same as last entry
|
|
15
|
+
const last = history[history.length - 1];
|
|
16
|
+
if (last?.xml === xml) {
|
|
17
|
+
return history.length - 1;
|
|
18
|
+
}
|
|
19
|
+
history.push({ xml, svg });
|
|
20
|
+
// Circular buffer
|
|
21
|
+
if (history.length > MAX_HISTORY) {
|
|
22
|
+
history.shift();
|
|
23
|
+
}
|
|
24
|
+
log.debug(`History: session=${sessionId}, entries=${history.length}`);
|
|
25
|
+
return history.length - 1;
|
|
26
|
+
}
|
|
27
|
+
export function getHistory(sessionId) {
|
|
28
|
+
return historyStore.get(sessionId) || [];
|
|
29
|
+
}
|
|
30
|
+
export function getHistoryEntry(sessionId, index) {
|
|
31
|
+
const history = historyStore.get(sessionId);
|
|
32
|
+
return history?.[index];
|
|
33
|
+
}
|
|
34
|
+
export function clearHistory(sessionId) {
|
|
35
|
+
historyStore.delete(sessionId);
|
|
36
|
+
}
|
|
37
|
+
export function updateLastHistorySvg(sessionId, svg) {
|
|
38
|
+
const history = historyStore.get(sessionId);
|
|
39
|
+
if (!history || history.length === 0)
|
|
40
|
+
return false;
|
|
41
|
+
const last = history[history.length - 1];
|
|
42
|
+
if (!last.svg) {
|
|
43
|
+
last.svg = svg;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,MAAM,YAAY,GAAG,IAAI,GAAG,EAA+C,CAAA;AAE3E,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAE,GAAW,EAAE,GAAG,GAAG,EAAE;IAC/D,IAAI,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACzC,IAAI,C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,CAAC;QAAE,OAAO,KAAK,CAAA;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACxC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACZ,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,OAAO,IAAI,CAAA;IACf,CAAC;IACD,OAAO,KAAK,CAAA;AAChB,CAAC"}
|
package/dist/http-server.d.ts
CHANGED
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Embedded HTTP Server for MCP
|
|
3
|
-
*
|
|
4
|
-
* Serves a static HTML page with draw.io embed and handles state sync.
|
|
5
|
-
* This eliminates the need for an external Next.js app.
|
|
3
|
+
* Serves draw.io embed with state sync and history UI
|
|
6
4
|
*/
|
|
7
5
|
interface SessionState {
|
|
8
6
|
xml: string;
|
|
9
7
|
version: number;
|
|
10
8
|
lastUpdated: Date;
|
|
9
|
+
svg?: string;
|
|
10
|
+
syncRequested?: number;
|
|
11
11
|
}
|
|
12
12
|
export declare const stateStore: Map<string, SessionState>;
|
|
13
|
-
/**
|
|
14
|
-
* Get state for a session
|
|
15
|
-
*/
|
|
16
13
|
export declare function getState(sessionId: string): SessionState | undefined;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export declare function setState(sessionId: string, xml: string): number;
|
|
21
|
-
/**
|
|
22
|
-
* Start the embedded HTTP server
|
|
23
|
-
*/
|
|
14
|
+
export declare function setState(sessionId: string, xml: string, svg?: string): number;
|
|
15
|
+
export declare function requestSync(sessionId: string): boolean;
|
|
16
|
+
export declare function waitForSync(sessionId: string, timeoutMs?: number): Promise<boolean>;
|
|
24
17
|
export declare function startHttpServer(port?: number): Promise<number>;
|
|
25
|
-
/**
|
|
26
|
-
* Stop the HTTP server
|
|
27
|
-
*/
|
|
28
18
|
export declare function stopHttpServer(): void;
|
|
29
|
-
/**
|
|
30
|
-
* Get the current server port
|
|
31
|
-
*/
|
|
32
19
|
export declare function getServerPort(): number;
|
|
33
20
|
export {};
|
|
34
21
|
//# sourceMappingURL=http-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../src/http-server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../src/http-server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,UAAU,YAAY;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,IAAI,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,eAAO,MAAM,UAAU,2BAAkC,CAAA;AAOzD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEpE;AAED,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAY7E;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAStD;AAED,wBAAsB,WAAW,CAC7B,SAAS,EAAE,MAAM,EACjB,SAAS,SAAO,GACjB,OAAO,CAAC,OAAO,CAAC,CASlB;AAED,wBAAgB,eAAe,CAAC,IAAI,SAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAoC5D;AAED,wBAAgB,cAAc,IAAI,IAAI,CAKrC;AAeD,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|