@simpligen/mcp 0.8.1 → 0.9.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/src/client.js CHANGED
@@ -1,171 +1,174 @@
1
- // packages/mcp-server/src/client.js
2
- // Thin client over the SimpliGen local control API. Resolves base URL + token,
3
- // does authed fetch calls, throws a structured error on non-2xx.
4
- import fs from 'node:fs';
5
- import http from 'node:http';
6
- import path from 'node:path';
7
- import { resolveUserDataDir, readDiscoveryPort } from './userdata.js';
8
-
9
- export class ControlApiError extends Error {
10
- constructor(status, errorCode, message) {
11
- super(message || errorCode || `HTTP ${status}`);
12
- this.name = 'ControlApiError';
13
- this.status = status;
14
- this.errorCode = errorCode || null;
15
- }
16
- }
17
-
18
- // A film export may run for up to 20 minutes on the app's side. fetch (undici) gives up
19
- // waiting for the response headers after 5 minutes, so the export goes over node:http
20
- // with a socket timeout just past the route's own limit.
21
- export const LONG_REQUEST_TIMEOUT_MS = 21 * 60 * 1000;
22
-
23
- export class ControlApiClient {
24
- // opts: { baseUrl?, token?, fetchImpl?, env? }. Falls back to discovery file + env.
25
- constructor(opts = {}) {
26
- const env = opts.env || process.env;
27
- this.token = opts.token || env.SIMPLIGEN_TOKEN || null;
28
- this.fetch = opts.fetchImpl || globalThis.fetch;
29
- if (opts.baseUrl) {
30
- this.baseUrl = opts.baseUrl;
31
- } else {
32
- const port = env.SIMPLIGEN_API_PORT ? Number(env.SIMPLIGEN_API_PORT) : readDiscoveryPort(resolveUserDataDir(env));
33
- this.baseUrl = port ? `http://127.0.0.1:${port}` : null;
34
- }
35
- }
36
-
37
- async #req(method, p, body) {
38
- this.#ready();
39
- const res = await this.fetch(`${this.baseUrl}${p}`, {
40
- method,
41
- headers: { Authorization: `Bearer ${this.token}`, 'Content-Type': 'application/json' },
42
- ...(body !== undefined ? { body: JSON.stringify(body) } : {}),
43
- });
44
- let json = {};
45
- try { json = await res.json(); } catch { /* empty body */ }
46
- if (!res.ok) throw new ControlApiError(res.status, json.errorCode, json.message);
47
- return json;
48
- }
49
-
50
- #ready() {
51
- if (!this.baseUrl) throw new ControlApiError(0, 'app_not_running', 'SimpliGen is not running (no control-API port found). Start the app.');
52
- if (!this.token) throw new ControlApiError(0, 'missing_token', 'No pairing token. Set SIMPLIGEN_TOKEN (Settings -> Connect an agent).');
53
- }
54
-
55
- /** The same request as #req, over node:http with a long socket timeout (for an export). */
56
- #longReq(method, p, body) {
57
- this.#ready();
58
- const data = body !== undefined ? JSON.stringify(body) : null;
59
- return new Promise((resolve, reject) => {
60
- const req = http.request(new URL(p, this.baseUrl), {
61
- method,
62
- headers: {
63
- Authorization: `Bearer ${this.token}`, 'Content-Type': 'application/json',
64
- ...(data !== null ? { 'Content-Length': Buffer.byteLength(data) } : {}),
65
- },
66
- timeout: LONG_REQUEST_TIMEOUT_MS,
67
- }, (res) => {
68
- let raw = '';
69
- res.setEncoding('utf8');
70
- res.on('data', (c) => { raw += c; });
71
- res.on('error', reject);
72
- res.on('end', () => {
73
- let json = {};
74
- try { json = raw ? JSON.parse(raw) : {}; } catch { /* not JSON */ }
75
- if (res.statusCode < 200 || res.statusCode >= 300) reject(new ControlApiError(res.statusCode, json.errorCode, json.message));
76
- else resolve(json);
77
- });
78
- });
79
- req.on('timeout', () => req.destroy(new ControlApiError(0, 'timeout', 'The app did not answer in time.')));
80
- req.on('error', reject);
81
- if (data !== null) req.write(data);
82
- req.end();
83
- });
84
- }
85
-
86
- getCapabilities() { return this.#req('GET', '/capabilities'); }
87
- getStatus() { return this.#req('GET', '/status'); }
88
- startEngine() { return this.#req('POST', '/engine/start'); }
89
- stopEngine() { return this.#req('POST', '/engine/stop'); }
90
- restartEngine() { return this.#req('POST', '/engine/restart'); }
91
- listProjects() { return this.#req('GET', '/projects'); }
92
- createProject(name) { return this.#req('POST', '/projects', { name }); }
93
- listLoras() { return this.#req('GET', '/loras'); }
94
- getPromptGuide(presetId) { return this.#req('GET', `/prompt-guide/${encodeURIComponent(presetId)}`); }
95
- generate(args) { return this.#req('POST', '/generate', args); }
96
- waitForApproval(id, timeoutSeconds) { return this.#req('GET', `/approvals/${encodeURIComponent(id)}/wait?timeoutSeconds=${timeoutSeconds}`); }
97
- getAppContext() { return this.#req('GET', '/app/context'); }
98
- fillGenerateForm(body) { return this.#req('POST', '/app/generate-form', body); }
99
- openScreen(body) { return this.#req('POST', '/app/screen', body); }
100
- getJob(id) { return this.#req('GET', `/jobs/${encodeURIComponent(id)}`); }
101
- listJobs() { return this.#req('GET', '/jobs'); }
102
- cancelJob(id) { return this.#req('POST', `/jobs/${encodeURIComponent(id)}/cancel`, {}); }
103
- preparePreset(args) { return this.#req('POST', '/presets/prepare', args); }
104
- getActiveDownloads() { return this.#req('GET', '/presets/prepare'); }
105
-
106
- listCharacters() { return this.#req('GET', '/characters'); }
107
- getCharacter(id) { return this.#req('GET', `/characters/${encodeURIComponent(id)}`); }
108
- listCharacterFeatures() { return this.#req('GET', '/character-features'); }
109
- listCharacterPresets() { return this.#req('GET', '/character-presets'); }
110
- createCharacter(args) { return this.#req('POST', '/characters', args); }
111
- generateCharacterImage(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/generate-image`, args); }
112
- generateCharacterFrame(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/generate-frame`, args); }
113
- animateCharacter(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/animate`, args); }
114
- acceptBase(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/accept-base`, args); }
115
- setCharacterPreset(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/preset`, args); }
116
- enhanceCharacterMedia(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/enhance`, args); }
117
- regenerateCharacterBase(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/regenerate-base`, args); }
118
- removeCharacter(id) { return this.#req('DELETE', `/characters/${encodeURIComponent(id)}`); }
119
-
120
- listRecipeBlocks() { return this.#req('GET', '/recipe-blocks'); }
121
- composeRecipe(args) { return this.#req('POST', '/recipes', args); }
122
- validateRecipe(args) { return this.#req('POST', '/recipes/validate', args); }
123
- listRecipes() { return this.#req('GET', '/recipes'); }
124
- getRecipe(id) { return this.#req('GET', `/recipes/${encodeURIComponent(id)}`); }
125
- publishRecipe(id, args) { return this.#req('POST', `/recipes/${encodeURIComponent(id)}/publish`, args); }
126
- runRecipe(id, args) { return this.#req('POST', `/recipes/${encodeURIComponent(id)}/run`, args); }
127
- listRecipeRuns(id) { return this.#req('GET', `/recipes/${encodeURIComponent(id)}/runs`); }
128
- getRecipeRun(runId) { return this.#req('GET', `/recipe-runs/${encodeURIComponent(runId)}`); }
129
- cancelRecipeRun(runId) { return this.#req('POST', `/recipe-runs/${encodeURIComponent(runId)}/cancel`, {}); }
130
- listSubjects() { return this.#req('GET', '/subjects'); }
131
- listProducts() { return this.#req('GET', '/products'); }
132
- createProduct(args) { return this.#req('POST', '/products', args); }
133
- removeProduct(id) { return this.#req('DELETE', `/products/${encodeURIComponent(id)}`); }
134
-
135
- // The Video Studio (TASK-1310). Clips and tracks are named by id, name or number.
136
- #film(filmId, rest = '') { return `/films/${encodeURIComponent(filmId)}${rest}`; }
137
- #clip(filmId, clip, rest = '') { return this.#film(filmId, `/clips/${encodeURIComponent(String(clip))}${rest}`); }
138
- listFilms(projectId) { return this.#req('GET', `/films${projectId ? `?projectId=${encodeURIComponent(projectId)}` : ''}`); }
139
- createFilm(args) { return this.#req('POST', '/films', args); }
140
- getFilm(filmId) { return this.#req('GET', this.#film(filmId)); }
141
- updateFilmSettings(filmId, args) { return this.#req('PATCH', this.#film(filmId), args); }
142
- addTrack(filmId, args) { return this.#req('POST', this.#film(filmId, '/tracks'), args); }
143
- moveTrack(filmId, track, args) { return this.#req('PATCH', this.#film(filmId, `/tracks/${encodeURIComponent(String(track))}`), args); }
144
- detectTempo(filmId, args = {}) { return this.#req('POST', this.#film(filmId, '/tempo'), args); }
145
- addClip(filmId, args = {}) { return this.#req('POST', this.#film(filmId, '/clips'), args); }
146
- importClip(filmId, args = {}) { return this.#req('POST', this.#film(filmId, '/clips/import'), args); }
147
- updateClip(filmId, clip, args) { return this.#req('PATCH', this.#clip(filmId, clip), args); }
148
- moveClip(filmId, clip, args) { return this.#req('POST', this.#clip(filmId, clip, '/move'), args); }
149
- trimClip(filmId, clip, args) { return this.#req('POST', this.#clip(filmId, clip, '/trim'), args); }
150
- removeClip(filmId, clip) { return this.#req('DELETE', this.#clip(filmId, clip)); }
151
- applyFilmPlan(filmId, plan) { return this.#req('POST', this.#film(filmId, '/plan'), plan); }
152
- setFades(filmId, args) { return this.#req('POST', this.#film(filmId, '/fades'), args); }
153
- addMarker(filmId, args) { return this.#req('POST', this.#film(filmId, '/markers'), args); }
154
- setExportRange(filmId, args) { return this.#req('POST', this.#film(filmId, '/export-range'), args); }
155
- renderClips(filmId, args = {}) { return this.#req('POST', this.#film(filmId, '/renders'), args); }
156
- listTakes(filmId, clip) { return this.#req('GET', this.#clip(filmId, clip, '/takes')); }
157
- useTake(filmId, clip, generationId) { return this.#req('POST', this.#clip(filmId, clip, '/take'), { generationId }); }
158
- exportFilm(filmId) { return this.#longReq('POST', this.#film(filmId, '/export'), {}); }
159
- listLocations() { return this.#req('GET', '/locations'); }
160
- createLocation(args) { return this.#req('POST', '/locations', args); }
161
-
162
- async uploadFile(filePath) {
163
- let buf;
164
- try {
165
- buf = fs.readFileSync(filePath);
166
- } catch (e) {
167
- throw new ControlApiError(0, 'file_not_found', `Cannot read file to upload: ${filePath} (${e.code || e.message}).`);
168
- }
169
- return this.#req('POST', '/uploads', { filename: path.basename(filePath), dataBase64: buf.toString('base64') });
170
- }
171
- }
1
+ // packages/mcp-server/src/client.js
2
+ // Thin client over the SimpliGen local control API. Resolves base URL + token,
3
+ // does authed fetch calls, throws a structured error on non-2xx.
4
+ import fs from 'node:fs';
5
+ import http from 'node:http';
6
+ import path from 'node:path';
7
+ import { resolveUserDataDir, readDiscoveryPort } from './userdata.js';
8
+
9
+ export class ControlApiError extends Error {
10
+ constructor(status, errorCode, message) {
11
+ super(message || errorCode || `HTTP ${status}`);
12
+ this.name = 'ControlApiError';
13
+ this.status = status;
14
+ this.errorCode = errorCode || null;
15
+ }
16
+ }
17
+
18
+ // A film export may run for up to 20 minutes on the app's side. fetch (undici) gives up
19
+ // waiting for the response headers after 5 minutes, so the export goes over node:http
20
+ // with a socket timeout just past the route's own limit.
21
+ export const LONG_REQUEST_TIMEOUT_MS = 21 * 60 * 1000;
22
+
23
+ export class ControlApiClient {
24
+ // opts: { baseUrl?, token?, fetchImpl?, env? }. Falls back to discovery file + env.
25
+ constructor(opts = {}) {
26
+ const env = opts.env || process.env;
27
+ this.token = opts.token || env.SIMPLIGEN_TOKEN || null;
28
+ this.fetch = opts.fetchImpl || globalThis.fetch;
29
+ if (opts.baseUrl) {
30
+ this.baseUrl = opts.baseUrl;
31
+ } else {
32
+ // opts.port is the CLI argument, for a client that forwards args but not
33
+ // env. Then the environment, then the discovery file the App writes.
34
+ const port = opts.port
35
+ || (env.SIMPLIGEN_API_PORT ? Number(env.SIMPLIGEN_API_PORT) : readDiscoveryPort(resolveUserDataDir(env)));
36
+ this.baseUrl = port ? `http://127.0.0.1:${port}` : null;
37
+ }
38
+ }
39
+
40
+ async #req(method, p, body) {
41
+ this.#ready();
42
+ const res = await this.fetch(`${this.baseUrl}${p}`, {
43
+ method,
44
+ headers: { Authorization: `Bearer ${this.token}`, 'Content-Type': 'application/json' },
45
+ ...(body !== undefined ? { body: JSON.stringify(body) } : {}),
46
+ });
47
+ let json = {};
48
+ try { json = await res.json(); } catch { /* empty body */ }
49
+ if (!res.ok) throw new ControlApiError(res.status, json.errorCode, json.message);
50
+ return json;
51
+ }
52
+
53
+ #ready() {
54
+ if (!this.baseUrl) throw new ControlApiError(0, 'app_not_running', 'SimpliGen is not running (no control-API port found). Start the app.');
55
+ if (!this.token) throw new ControlApiError(0, 'missing_token', 'No pairing token. Set SIMPLIGEN_TOKEN (Settings -> Connect an agent).');
56
+ }
57
+
58
+ /** The same request as #req, over node:http with a long socket timeout (for an export). */
59
+ #longReq(method, p, body) {
60
+ this.#ready();
61
+ const data = body !== undefined ? JSON.stringify(body) : null;
62
+ return new Promise((resolve, reject) => {
63
+ const req = http.request(new URL(p, this.baseUrl), {
64
+ method,
65
+ headers: {
66
+ Authorization: `Bearer ${this.token}`, 'Content-Type': 'application/json',
67
+ ...(data !== null ? { 'Content-Length': Buffer.byteLength(data) } : {}),
68
+ },
69
+ timeout: LONG_REQUEST_TIMEOUT_MS,
70
+ }, (res) => {
71
+ let raw = '';
72
+ res.setEncoding('utf8');
73
+ res.on('data', (c) => { raw += c; });
74
+ res.on('error', reject);
75
+ res.on('end', () => {
76
+ let json = {};
77
+ try { json = raw ? JSON.parse(raw) : {}; } catch { /* not JSON */ }
78
+ if (res.statusCode < 200 || res.statusCode >= 300) reject(new ControlApiError(res.statusCode, json.errorCode, json.message));
79
+ else resolve(json);
80
+ });
81
+ });
82
+ req.on('timeout', () => req.destroy(new ControlApiError(0, 'timeout', 'The app did not answer in time.')));
83
+ req.on('error', reject);
84
+ if (data !== null) req.write(data);
85
+ req.end();
86
+ });
87
+ }
88
+
89
+ getCapabilities() { return this.#req('GET', '/capabilities'); }
90
+ getStatus() { return this.#req('GET', '/status'); }
91
+ startEngine() { return this.#req('POST', '/engine/start'); }
92
+ stopEngine() { return this.#req('POST', '/engine/stop'); }
93
+ restartEngine() { return this.#req('POST', '/engine/restart'); }
94
+ listProjects() { return this.#req('GET', '/projects'); }
95
+ createProject(name) { return this.#req('POST', '/projects', { name }); }
96
+ listLoras() { return this.#req('GET', '/loras'); }
97
+ getPromptGuide(presetId) { return this.#req('GET', `/prompt-guide/${encodeURIComponent(presetId)}`); }
98
+ generate(args) { return this.#req('POST', '/generate', args); }
99
+ waitForApproval(id, timeoutSeconds) { return this.#req('GET', `/approvals/${encodeURIComponent(id)}/wait?timeoutSeconds=${timeoutSeconds}`); }
100
+ getAppContext() { return this.#req('GET', '/app/context'); }
101
+ fillGenerateForm(body) { return this.#req('POST', '/app/generate-form', body); }
102
+ openScreen(body) { return this.#req('POST', '/app/screen', body); }
103
+ getJob(id) { return this.#req('GET', `/jobs/${encodeURIComponent(id)}`); }
104
+ listJobs() { return this.#req('GET', '/jobs'); }
105
+ cancelJob(id) { return this.#req('POST', `/jobs/${encodeURIComponent(id)}/cancel`, {}); }
106
+ preparePreset(args) { return this.#req('POST', '/presets/prepare', args); }
107
+ getActiveDownloads() { return this.#req('GET', '/presets/prepare'); }
108
+
109
+ listCharacters() { return this.#req('GET', '/characters'); }
110
+ getCharacter(id) { return this.#req('GET', `/characters/${encodeURIComponent(id)}`); }
111
+ listCharacterFeatures() { return this.#req('GET', '/character-features'); }
112
+ listCharacterPresets() { return this.#req('GET', '/character-presets'); }
113
+ createCharacter(args) { return this.#req('POST', '/characters', args); }
114
+ generateCharacterImage(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/generate-image`, args); }
115
+ generateCharacterFrame(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/generate-frame`, args); }
116
+ animateCharacter(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/animate`, args); }
117
+ acceptBase(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/accept-base`, args); }
118
+ setCharacterPreset(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/preset`, args); }
119
+ enhanceCharacterMedia(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/enhance`, args); }
120
+ regenerateCharacterBase(id, args) { return this.#req('POST', `/characters/${encodeURIComponent(id)}/regenerate-base`, args); }
121
+ removeCharacter(id) { return this.#req('DELETE', `/characters/${encodeURIComponent(id)}`); }
122
+
123
+ listRecipeBlocks() { return this.#req('GET', '/recipe-blocks'); }
124
+ composeRecipe(args) { return this.#req('POST', '/recipes', args); }
125
+ validateRecipe(args) { return this.#req('POST', '/recipes/validate', args); }
126
+ listRecipes() { return this.#req('GET', '/recipes'); }
127
+ getRecipe(id) { return this.#req('GET', `/recipes/${encodeURIComponent(id)}`); }
128
+ publishRecipe(id, args) { return this.#req('POST', `/recipes/${encodeURIComponent(id)}/publish`, args); }
129
+ runRecipe(id, args) { return this.#req('POST', `/recipes/${encodeURIComponent(id)}/run`, args); }
130
+ listRecipeRuns(id) { return this.#req('GET', `/recipes/${encodeURIComponent(id)}/runs`); }
131
+ getRecipeRun(runId) { return this.#req('GET', `/recipe-runs/${encodeURIComponent(runId)}`); }
132
+ cancelRecipeRun(runId) { return this.#req('POST', `/recipe-runs/${encodeURIComponent(runId)}/cancel`, {}); }
133
+ listSubjects() { return this.#req('GET', '/subjects'); }
134
+ listProducts() { return this.#req('GET', '/products'); }
135
+ createProduct(args) { return this.#req('POST', '/products', args); }
136
+ removeProduct(id) { return this.#req('DELETE', `/products/${encodeURIComponent(id)}`); }
137
+
138
+ // The Video Studio (TASK-1310). Clips and tracks are named by id, name or number.
139
+ #film(filmId, rest = '') { return `/films/${encodeURIComponent(filmId)}${rest}`; }
140
+ #clip(filmId, clip, rest = '') { return this.#film(filmId, `/clips/${encodeURIComponent(String(clip))}${rest}`); }
141
+ listFilms(projectId) { return this.#req('GET', `/films${projectId ? `?projectId=${encodeURIComponent(projectId)}` : ''}`); }
142
+ createFilm(args) { return this.#req('POST', '/films', args); }
143
+ getFilm(filmId) { return this.#req('GET', this.#film(filmId)); }
144
+ updateFilmSettings(filmId, args) { return this.#req('PATCH', this.#film(filmId), args); }
145
+ addTrack(filmId, args) { return this.#req('POST', this.#film(filmId, '/tracks'), args); }
146
+ moveTrack(filmId, track, args) { return this.#req('PATCH', this.#film(filmId, `/tracks/${encodeURIComponent(String(track))}`), args); }
147
+ detectTempo(filmId, args = {}) { return this.#req('POST', this.#film(filmId, '/tempo'), args); }
148
+ addClip(filmId, args = {}) { return this.#req('POST', this.#film(filmId, '/clips'), args); }
149
+ importClip(filmId, args = {}) { return this.#req('POST', this.#film(filmId, '/clips/import'), args); }
150
+ updateClip(filmId, clip, args) { return this.#req('PATCH', this.#clip(filmId, clip), args); }
151
+ moveClip(filmId, clip, args) { return this.#req('POST', this.#clip(filmId, clip, '/move'), args); }
152
+ trimClip(filmId, clip, args) { return this.#req('POST', this.#clip(filmId, clip, '/trim'), args); }
153
+ removeClip(filmId, clip) { return this.#req('DELETE', this.#clip(filmId, clip)); }
154
+ applyFilmPlan(filmId, plan) { return this.#req('POST', this.#film(filmId, '/plan'), plan); }
155
+ setFades(filmId, args) { return this.#req('POST', this.#film(filmId, '/fades'), args); }
156
+ addMarker(filmId, args) { return this.#req('POST', this.#film(filmId, '/markers'), args); }
157
+ setExportRange(filmId, args) { return this.#req('POST', this.#film(filmId, '/export-range'), args); }
158
+ renderClips(filmId, args = {}) { return this.#req('POST', this.#film(filmId, '/renders'), args); }
159
+ listTakes(filmId, clip) { return this.#req('GET', this.#clip(filmId, clip, '/takes')); }
160
+ useTake(filmId, clip, generationId) { return this.#req('POST', this.#clip(filmId, clip, '/take'), { generationId }); }
161
+ exportFilm(filmId) { return this.#longReq('POST', this.#film(filmId, '/export'), {}); }
162
+ listLocations() { return this.#req('GET', '/locations'); }
163
+ createLocation(args) { return this.#req('POST', '/locations', args); }
164
+
165
+ async uploadFile(filePath) {
166
+ let buf;
167
+ try {
168
+ buf = fs.readFileSync(filePath);
169
+ } catch (e) {
170
+ throw new ControlApiError(0, 'file_not_found', `Cannot read file to upload: ${filePath} (${e.code || e.message}).`);
171
+ }
172
+ return this.#req('POST', '/uploads', { filename: path.basename(filePath), dataBase64: buf.toString('base64') });
173
+ }
174
+ }
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
- // packages/mcp-server/src/index.js
2
- export { ControlApiClient, ControlApiError } from './client.js';
3
- export { createMcpServer } from './server.js';
4
- export { registerTools, TOOL_NAMES, STUDIO_TOOL_NAMES } from './tools.js';
5
- export { buildResultImageContent } from './resultImage.js';
6
- export { resolveUserDataDir, readDiscoveryPort } from './userdata.js';
1
+ // packages/mcp-server/src/index.js
2
+ export { ControlApiClient, ControlApiError } from './client.js';
3
+ export { createMcpServer } from './server.js';
4
+ export { registerTools, TOOL_NAMES, STUDIO_TOOL_NAMES } from './tools.js';
5
+ export { buildResultImageContent } from './resultImage.js';
6
+ export { resolveUserDataDir, readDiscoveryPort } from './userdata.js';
package/src/server.js CHANGED
@@ -1,15 +1,15 @@
1
- // packages/mcp-server/src/server.js
2
- import { createRequire } from 'node:module';
3
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
- import { registerTools } from './tools.js';
5
-
6
- const { version } = createRequire(import.meta.url)('../package.json');
7
-
8
- /**
9
- * @param {object} client a ControlApiClient
10
- */
11
- export function createMcpServer(client) {
12
- const server = new McpServer({ name: 'simpligen', version });
13
- registerTools(server, client);
14
- return server;
15
- }
1
+ // packages/mcp-server/src/server.js
2
+ import { createRequire } from 'node:module';
3
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
+ import { registerTools } from './tools.js';
5
+
6
+ const { version } = createRequire(import.meta.url)('../package.json');
7
+
8
+ /**
9
+ * @param {object} client a ControlApiClient
10
+ */
11
+ export function createMcpServer(client) {
12
+ const server = new McpServer({ name: 'simpligen', version });
13
+ registerTools(server, client);
14
+ return server;
15
+ }