mup-mcp-server 0.1.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.
@@ -0,0 +1,170 @@
1
+ import type { MupManifest, LoadedMup } from "./manager.js";
2
+ export interface FunctionResult {
3
+ content: Array<{
4
+ type: string;
5
+ text?: string;
6
+ data?: unknown;
7
+ mimeType?: string;
8
+ }>;
9
+ isError: boolean;
10
+ }
11
+ export interface FolderTreeNode {
12
+ type: "folder" | "file";
13
+ name: string;
14
+ children?: FolderTreeNode[];
15
+ id?: string;
16
+ description?: string;
17
+ active?: boolean;
18
+ multiInstance?: boolean;
19
+ }
20
+ export interface GridLayoutItem {
21
+ id: string;
22
+ x: number;
23
+ y: number;
24
+ w: number;
25
+ h: number;
26
+ }
27
+ export interface CatalogSummary {
28
+ id: string;
29
+ name: string;
30
+ description: string;
31
+ functions: number;
32
+ active: boolean;
33
+ grid?: MupManifest["grid"];
34
+ multiInstance: boolean;
35
+ }
36
+ export interface WorkspaceListItem {
37
+ name: string;
38
+ displayName: string;
39
+ description: string;
40
+ savedAt: number;
41
+ activeMups: string[];
42
+ }
43
+ export type BrowserMessage = {
44
+ type: "ready";
45
+ } | {
46
+ type: "mup-loaded";
47
+ mupId: string;
48
+ } | {
49
+ type: "result";
50
+ callId: string;
51
+ result: FunctionResult;
52
+ } | {
53
+ type: "state";
54
+ mupId: string;
55
+ summary: string;
56
+ data?: unknown;
57
+ } | {
58
+ type: "interaction";
59
+ mupId: string;
60
+ action: string;
61
+ summary: string;
62
+ data?: unknown;
63
+ } | {
64
+ type: "activate-mup";
65
+ mupId: string;
66
+ } | {
67
+ type: "deactivate-mup";
68
+ mupId: string;
69
+ } | {
70
+ type: "register-and-activate";
71
+ mupId: string;
72
+ html: string;
73
+ fileName: string;
74
+ } | {
75
+ type: "new-instance";
76
+ mupId: string;
77
+ customName?: string;
78
+ } | {
79
+ type: "list-workspaces";
80
+ } | {
81
+ type: "save-workspace";
82
+ name: string;
83
+ description?: string;
84
+ } | {
85
+ type: "load-workspace";
86
+ name: string;
87
+ } | {
88
+ type: "delete-workspace";
89
+ name: string;
90
+ isCurrent?: boolean;
91
+ } | {
92
+ type: "save-grid-layout";
93
+ layout: GridLayoutItem[];
94
+ } | {
95
+ type: "rename-mup";
96
+ mupId: string;
97
+ customName: string;
98
+ };
99
+ export type ServerMessage = {
100
+ type: "mup-catalog";
101
+ catalog: CatalogSummary[];
102
+ } | {
103
+ type: "folder-tree";
104
+ tree: FolderTreeNode[];
105
+ path: string;
106
+ } | {
107
+ type: "load-mup";
108
+ mupId: string;
109
+ html: string;
110
+ manifest: MupManifest;
111
+ savedState?: unknown;
112
+ } | {
113
+ type: "call";
114
+ callId: string;
115
+ mupId: string;
116
+ fn: string;
117
+ args: Record<string, unknown>;
118
+ } | {
119
+ type: "error";
120
+ message: string;
121
+ } | {
122
+ type: "auto-saved";
123
+ } | {
124
+ type: "workspace-list";
125
+ workspaces: WorkspaceListItem[];
126
+ } | {
127
+ type: "workspace-saved";
128
+ name: string;
129
+ } | {
130
+ type: "workspace-loaded";
131
+ name: string;
132
+ customNames: Record<string, string>;
133
+ gridLayout?: GridLayoutItem[];
134
+ description?: string;
135
+ } | {
136
+ type: "workspace-cleared";
137
+ };
138
+ export interface BridgeEvents {
139
+ "browser-connected": () => void;
140
+ "browser-disconnected": () => void;
141
+ "activate-mup": (mupId: string) => void;
142
+ "deactivate-mup": (mupId: string) => void;
143
+ "new-instance": (baseMupId: string, customName?: string) => void;
144
+ "register-and-activate": (mupId: string, html: string, fileName: string) => void;
145
+ "state-update": (mupId: string, summary: string, data?: unknown) => void;
146
+ "interaction": (mupId: string, action: string, summary: string) => void;
147
+ "save-grid-layout": (layout: GridLayoutItem[]) => void;
148
+ "rename-mup": (mupId: string, newName: string) => void;
149
+ "list-workspaces": () => void;
150
+ "save-workspace": (name: string, description?: string) => void;
151
+ "load-workspace": (name: string) => void;
152
+ "delete-workspace": (name: string, isCurrent?: boolean) => void;
153
+ }
154
+ export interface CallHistoryEntry {
155
+ functionName: string;
156
+ args: Record<string, unknown>;
157
+ result: string;
158
+ timestamp: number;
159
+ }
160
+ export interface WorkspaceData {
161
+ name: string;
162
+ description: string;
163
+ savedAt: number;
164
+ activeMups: string[];
165
+ mupStates: Record<string, unknown>;
166
+ callHistory: Record<string, CallHistoryEntry[]>;
167
+ customNames: Record<string, string>;
168
+ gridLayout?: GridLayoutItem[];
169
+ }
170
+ export type SendLoadMupFn = (mupId: string, mup: LoadedMup) => void;
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ // ---- Shared Types for MUP MCP Server ----
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,4CAA4C"}
@@ -0,0 +1,47 @@
1
+ import { MupManager } from "./manager.js";
2
+ import type { UiBridge } from "./bridge.js";
3
+ import type { CallHistoryEntry, WorkspaceData, GridLayoutItem, CatalogSummary, SendLoadMupFn } from "./types.js";
4
+ export type { CallHistoryEntry, GridLayoutItem };
5
+ export declare class WorkspaceManager {
6
+ private manager;
7
+ callHistory: Record<string, CallHistoryEntry[]>;
8
+ customNames: Record<string, string>;
9
+ description: string;
10
+ gridLayout: GridLayoutItem[];
11
+ private bridge;
12
+ private _dirty;
13
+ private _saveTimer;
14
+ private _lastWorkspace;
15
+ constructor(manager: MupManager);
16
+ /** Set instance-specific auto-save key (e.g. port) to avoid conflicts with parallel instances */
17
+ setInstanceId(id: string | number): void;
18
+ /** Set bridge reference for auto-save notifications */
19
+ setBridge(bridge: UiBridge): void;
20
+ addCallHistory(mupId: string, functionName: string, args: Record<string, unknown>, result: string): void;
21
+ /** Mark state as dirty — triggers a debounced auto-save */
22
+ markDirty(): void;
23
+ /** Flush any pending save immediately (for shutdown/disconnect) */
24
+ flushSave(): void;
25
+ save(name: string, desc?: string): void;
26
+ load(name: string): WorkspaceData | null;
27
+ list(): Array<{
28
+ name: string;
29
+ displayName: string;
30
+ description: string;
31
+ savedAt: number;
32
+ activeMups: string[];
33
+ }>;
34
+ delete(name: string): boolean;
35
+ /** Auto-save to _last workspace and notify browser */
36
+ autoSave(): void;
37
+ /** Shared restore logic: applies workspace data to manager state */
38
+ private _applyWorkspaceData;
39
+ /** Silent restore on startup — activates MUPs without sending browser messages */
40
+ silentRestore(): string[];
41
+ /** Full restore — deactivates current MUPs, restores state, sends browser messages */
42
+ restore(bridge: UiBridge, sendLoadMup: SendLoadMupFn, name: string): string[];
43
+ /** Build catalog summary (used by restore + event handlers) */
44
+ buildCatalogSummary(): CatalogSummary[];
45
+ /** Reset workspace state (for "new workspace") */
46
+ reset(): void;
47
+ }
@@ -0,0 +1,234 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import * as os from "node:os";
4
+ import { CONFIG } from "./config.js";
5
+ // ---- Constants ----
6
+ const DATA_DIR = path.join(os.homedir(), ".mup-mcp");
7
+ const WORKSPACES_DIR = path.join(DATA_DIR, "workspaces");
8
+ const DEFAULT_LAST_WORKSPACE = "_last";
9
+ function ensureDir(dir) {
10
+ if (!fs.existsSync(dir))
11
+ fs.mkdirSync(dir, { recursive: true });
12
+ }
13
+ function workspacePath(name) {
14
+ return path.join(WORKSPACES_DIR, `${name.replace(/[^a-zA-Z0-9_-]/g, "_")}.json`);
15
+ }
16
+ // ---- WorkspaceManager ----
17
+ export class WorkspaceManager {
18
+ manager;
19
+ callHistory = {};
20
+ customNames = {};
21
+ description = "";
22
+ gridLayout = [];
23
+ bridge = null;
24
+ _dirty = false;
25
+ _saveTimer = null;
26
+ _lastWorkspace = DEFAULT_LAST_WORKSPACE;
27
+ constructor(manager) {
28
+ this.manager = manager;
29
+ }
30
+ /** Set instance-specific auto-save key (e.g. port) to avoid conflicts with parallel instances */
31
+ setInstanceId(id) {
32
+ this._lastWorkspace = `_last_${id}`;
33
+ }
34
+ /** Set bridge reference for auto-save notifications */
35
+ setBridge(bridge) {
36
+ this.bridge = bridge;
37
+ }
38
+ // ---- Call History ----
39
+ addCallHistory(mupId, functionName, args, result) {
40
+ if (!this.callHistory[mupId])
41
+ this.callHistory[mupId] = [];
42
+ this.callHistory[mupId].push({
43
+ functionName,
44
+ args,
45
+ result: result.slice(0, CONFIG.maxHistoryResultLength),
46
+ timestamp: Date.now(),
47
+ });
48
+ if (this.callHistory[mupId].length > CONFIG.maxCallHistory)
49
+ this.callHistory[mupId].shift();
50
+ }
51
+ // ---- Dirty Flag + Debounced Save ----
52
+ /** Mark state as dirty — triggers a debounced auto-save */
53
+ markDirty() {
54
+ this._dirty = true;
55
+ if (!this._saveTimer) {
56
+ this._saveTimer = setTimeout(() => {
57
+ this._saveTimer = null;
58
+ if (this._dirty) {
59
+ this._dirty = false;
60
+ this.autoSave();
61
+ }
62
+ }, CONFIG.autoSaveDebounceMs);
63
+ }
64
+ }
65
+ /** Flush any pending save immediately (for shutdown/disconnect) */
66
+ flushSave() {
67
+ if (this._saveTimer)
68
+ clearTimeout(this._saveTimer);
69
+ this._saveTimer = null;
70
+ if (this._dirty) {
71
+ this._dirty = false;
72
+ this.autoSave();
73
+ }
74
+ }
75
+ // ---- Persistence ----
76
+ save(name, desc) {
77
+ try {
78
+ ensureDir(WORKSPACES_DIR);
79
+ if (desc !== undefined)
80
+ this.description = desc;
81
+ const data = {
82
+ name,
83
+ description: this.description,
84
+ savedAt: Date.now(),
85
+ activeMups: this.manager.getAll().map((m) => m.manifest.id),
86
+ mupStates: this.manager.getStateSnapshot(),
87
+ callHistory: this.callHistory,
88
+ customNames: { ...this.customNames },
89
+ gridLayout: this.gridLayout.length > 0 ? this.gridLayout : undefined,
90
+ };
91
+ fs.writeFileSync(workspacePath(name), JSON.stringify(data, null, 2));
92
+ }
93
+ catch (err) {
94
+ console.error("[mup-mcp] Failed to save workspace:", err);
95
+ }
96
+ }
97
+ load(name) {
98
+ try {
99
+ const p = workspacePath(name);
100
+ if (fs.existsSync(p))
101
+ return JSON.parse(fs.readFileSync(p, "utf-8"));
102
+ }
103
+ catch (err) {
104
+ console.error(`[mup-mcp] Failed to load workspace "${name}":`, err);
105
+ }
106
+ return null;
107
+ }
108
+ list() {
109
+ try {
110
+ ensureDir(WORKSPACES_DIR);
111
+ const files = fs.readdirSync(WORKSPACES_DIR).filter((f) => f.endsWith(".json"));
112
+ return files.map((f) => {
113
+ try {
114
+ const data = JSON.parse(fs.readFileSync(path.join(WORKSPACES_DIR, f), "utf-8"));
115
+ return {
116
+ name: data.name,
117
+ displayName: data.name,
118
+ description: data.description || "",
119
+ savedAt: data.savedAt,
120
+ activeMups: data.activeMups,
121
+ };
122
+ }
123
+ catch (err) {
124
+ console.error(`[mup-mcp] Failed to parse workspace file "${f}":`, err);
125
+ return null;
126
+ }
127
+ })
128
+ .filter((x) => x !== null)
129
+ .filter((w) => !w.name.startsWith("_last"))
130
+ .sort((a, b) => b.savedAt - a.savedAt);
131
+ }
132
+ catch (err) {
133
+ console.error("[mup-mcp] Failed to list workspaces:", err);
134
+ return [];
135
+ }
136
+ }
137
+ delete(name) {
138
+ try {
139
+ const p = workspacePath(name);
140
+ if (fs.existsSync(p)) {
141
+ fs.unlinkSync(p);
142
+ return true;
143
+ }
144
+ }
145
+ catch (err) {
146
+ console.error(`[mup-mcp] Failed to delete workspace "${name}":`, err);
147
+ }
148
+ return false;
149
+ }
150
+ /** Auto-save to _last workspace and notify browser */
151
+ autoSave() {
152
+ if (this.manager.getAll().length > 0) {
153
+ this.save(this._lastWorkspace);
154
+ if (this.bridge)
155
+ this.bridge.sendRaw({ type: "auto-saved" });
156
+ }
157
+ }
158
+ // ---- Restore ----
159
+ /** Shared restore logic: applies workspace data to manager state */
160
+ _applyWorkspaceData(data) {
161
+ this.description = data.description || "";
162
+ this.gridLayout = data.gridLayout || [];
163
+ if (data.customNames)
164
+ Object.assign(this.customNames, data.customNames);
165
+ if (data.callHistory) {
166
+ for (const [k, v] of Object.entries(data.callHistory))
167
+ this.callHistory[k] = v;
168
+ }
169
+ const restored = [];
170
+ for (const mupId of data.activeMups) {
171
+ const mup = this.manager.activate(mupId);
172
+ if (mup) {
173
+ if (data.mupStates[mupId] !== undefined)
174
+ mup.stateData = data.mupStates[mupId];
175
+ restored.push(this.customNames[mupId] || mup.manifest.name);
176
+ }
177
+ }
178
+ return restored;
179
+ }
180
+ /** Silent restore on startup — activates MUPs without sending browser messages */
181
+ silentRestore() {
182
+ const data = this.load(this._lastWorkspace);
183
+ if (!data || data.activeMups.length === 0)
184
+ return [];
185
+ return this._applyWorkspaceData(data);
186
+ }
187
+ /** Full restore — deactivates current MUPs, restores state, sends browser messages */
188
+ restore(bridge, sendLoadMup, name) {
189
+ const data = this.load(name);
190
+ if (!data)
191
+ return [];
192
+ // Deactivate all current MUPs
193
+ for (const mup of this.manager.getAll())
194
+ this.manager.deactivate(mup.manifest.id);
195
+ this.reset();
196
+ // Apply workspace data
197
+ const restored = this._applyWorkspaceData(data);
198
+ // Notify browser
199
+ bridge.sendRaw({
200
+ type: "workspace-loaded",
201
+ name,
202
+ customNames: { ...this.customNames },
203
+ gridLayout: data.gridLayout,
204
+ description: data.description,
205
+ });
206
+ bridge.sendRaw({ type: "mup-catalog", catalog: this.buildCatalogSummary() });
207
+ for (const mup of this.manager.getAll())
208
+ sendLoadMup(mup.manifest.id, mup);
209
+ return restored;
210
+ }
211
+ // ---- Helpers ----
212
+ /** Build catalog summary (used by restore + event handlers) */
213
+ buildCatalogSummary() {
214
+ return this.manager.getCatalog().map((e) => ({
215
+ id: e.manifest.id,
216
+ name: e.manifest.name,
217
+ description: e.manifest.description,
218
+ functions: e.manifest.functions.length,
219
+ active: e.active,
220
+ grid: e.manifest.grid,
221
+ multiInstance: e.manifest.multiInstance || false,
222
+ }));
223
+ }
224
+ /** Reset workspace state (for "new workspace") */
225
+ reset() {
226
+ for (const k of Object.keys(this.callHistory))
227
+ delete this.callHistory[k];
228
+ for (const k of Object.keys(this.customNames))
229
+ delete this.customNames[k];
230
+ this.description = "";
231
+ this.gridL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AAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE;YACjB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI;YACrB,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW;YACnC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM;YACtC,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI;YACrB,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,IAAI,KAAK;SACjD,CAAC,CAAC,CAAC;IACN,CAAC;IAED,kDAAkD;IAClD,KAAK;QACH,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;YAAE,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC1E,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;YAAE,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "mup-mcp-server",
3
+ "version": "0.1.0",
4
+ "description": "MCP server that turns HTML MUP panels into interactive tools for LLMs — render UI, call functions, and pipe data between panels",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Ricky610329",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Ricky610329/mup.git",
11
+ "directory": "mup-mcp-server"
12
+ },
13
+ "homepage": "https://github.com/Ricky610329/mup",
14
+ "keywords": [
15
+ "mcp",
16
+ "mcp-server",
17
+ "model-context-protocol",
18
+ "mup",
19
+ "llm",
20
+ "ui",
21
+ "interactive",
22
+ "claude",
23
+ "tools"
24
+ ],
25
+ "mcpName": "io.github.ricky610329/mup",
26
+ "bin": {
27
+ "mup-mcp-server": "dist/index.js"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "ui"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc",
35
+ "prepare": "npm run build",
36
+ "start": "node dist/index.js"
37
+ },
38
+ "dependencies": {
39
+ "@modelcontextprotocol/sdk": "^1.12.1",
40
+ "ws": "^8.18.0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^22.0.0",
44
+ "@types/ws": "^8.5.0",
45
+ "typescript": "^5.7.0"
46
+ }
47
+ }