@nuwax-ai/openui-mcp 0.1.12 → 0.2.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/CHANGELOG.md +8 -0
- package/README.md +66 -289
- package/dist/server/artifact-store.d.ts +14 -6
- package/dist/server/artifact-store.d.ts.map +1 -1
- package/dist/server/artifact-store.js +73 -9
- package/dist/server/artifact-store.js.map +1 -1
- package/dist/server/contracts.d.ts +68 -0
- package/dist/server/contracts.d.ts.map +1 -1
- package/dist/server/contracts.js +42 -0
- package/dist/server/contracts.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +4 -6
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/project-root.d.ts +11 -0
- package/dist/server/project-root.d.ts.map +1 -0
- package/dist/server/project-root.js +51 -0
- package/dist/server/project-root.js.map +1 -0
- package/dist/server/render-service.d.ts +3 -8
- package/dist/server/render-service.d.ts.map +1 -1
- package/dist/server/render-service.js +21 -26
- package/dist/server/render-service.js.map +1 -1
- package/dist/server/runtime.d.ts +3 -4
- package/dist/server/runtime.d.ts.map +1 -1
- package/dist/server/runtime.js +4 -7
- package/dist/server/runtime.js.map +1 -1
- package/dist/server/stdio.js +8 -9
- package/dist/server/stdio.js.map +1 -1
- package/dist/web/{sidecar.css → runtime.css} +1 -1
- package/dist/web/{sidecar.js → runtime.js} +7578 -7549
- package/package.json +6 -9
- package/dist/server/config.d.ts +0 -14
- package/dist/server/config.d.ts.map +0 -1
- package/dist/server/config.js +0 -50
- package/dist/server/config.js.map +0 -1
- package/dist/server/http-app.d.ts +0 -11
- package/dist/server/http-app.d.ts.map +0 -1
- package/dist/server/http-app.js +0 -88
- package/dist/server/http-app.js.map +0 -1
- package/dist/server/http-server.d.ts +0 -10
- package/dist/server/http-server.d.ts.map +0 -1
- package/dist/server/http-server.js +0 -30
- package/dist/server/http-server.js.map +0 -1
- package/dist/server/http.d.ts +0 -3
- package/dist/server/http.d.ts.map +0 -1
- package/dist/server/http.js +0 -18
- package/dist/server/http.js.map +0 -1
- package/dist/server/page-template.d.ts +0 -2
- package/dist/server/page-template.d.ts.map +0 -1
- package/dist/server/page-template.js +0 -32
- package/dist/server/page-template.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuwax-ai/openui-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "OpenUI over MCP for Nuwax
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Durable file-based OpenUI artifacts over MCP for Nuwax.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"bin": {
|
|
28
28
|
"openui-mcp": "dist/server/stdio.js",
|
|
29
|
-
"nuwax-openui-mcp": "dist/server/stdio.js"
|
|
30
|
-
"nuwax-openui-mcp-http": "dist/server/http.js"
|
|
29
|
+
"nuwax-openui-mcp": "dist/server/stdio.js"
|
|
31
30
|
},
|
|
32
31
|
"files": [
|
|
33
32
|
"dist",
|
|
@@ -36,15 +35,15 @@
|
|
|
36
35
|
"LICENSE"
|
|
37
36
|
],
|
|
38
37
|
"scripts": {
|
|
39
|
-
"build": "pnpm build:server && pnpm build:web",
|
|
38
|
+
"build": "pnpm clean && pnpm build:server && pnpm build:web",
|
|
40
39
|
"build:server": "tsc -p tsconfig.server.json",
|
|
41
40
|
"build:web": "vite build",
|
|
42
|
-
"
|
|
41
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
43
42
|
"dev:stdio": "tsx src/stdio.ts",
|
|
44
43
|
"format": "prettier --write .",
|
|
45
44
|
"format:check": "prettier --check .",
|
|
46
45
|
"lint": "eslint .",
|
|
47
|
-
"start": "node dist/server/
|
|
46
|
+
"start": "node dist/server/stdio.js",
|
|
48
47
|
"test": "vitest run",
|
|
49
48
|
"test:watch": "vitest",
|
|
50
49
|
"typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p tsconfig.web.json --noEmit",
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
"@openuidev/react-lang": "0.2.8",
|
|
61
60
|
"@openuidev/react-ui": "0.12.1",
|
|
62
61
|
"dotenv": "17.4.2",
|
|
63
|
-
"express": "5.1.0",
|
|
64
62
|
"react": "18.3.1",
|
|
65
63
|
"react-dom": "18.3.1",
|
|
66
64
|
"zod": "4.1.12",
|
|
@@ -68,7 +66,6 @@
|
|
|
68
66
|
},
|
|
69
67
|
"devDependencies": {
|
|
70
68
|
"@eslint/js": "9.39.1",
|
|
71
|
-
"@types/express": "5.0.5",
|
|
72
69
|
"@types/node": "24.10.1",
|
|
73
70
|
"@types/react": "18.3.27",
|
|
74
71
|
"@types/react-dom": "18.3.7",
|
package/dist/server/config.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const configSchema: z.ZodObject<{
|
|
3
|
-
host: z.ZodString;
|
|
4
|
-
port: z.ZodCoercedNumber<unknown>;
|
|
5
|
-
baseUrl: z.ZodString;
|
|
6
|
-
sidecarServerEnabled: z.ZodBoolean;
|
|
7
|
-
allowedHosts: z.ZodArray<z.ZodString>;
|
|
8
|
-
frameAncestors: z.ZodArray<z.ZodString>;
|
|
9
|
-
artifactTtlSeconds: z.ZodCoercedNumber<unknown>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
export type AppConfig = z.infer<typeof configSchema>;
|
|
12
|
-
export declare function loadConfig(env?: NodeJS.ProcessEnv): AppConfig;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,YAAY;;;;;;;;iBAQhB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AA8BrD,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,SAAS,CAoB1E"}
|
package/dist/server/config.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
const configSchema = z.object({
|
|
3
|
-
host: z.string().min(1),
|
|
4
|
-
port: z.coerce.number().int().min(1).max(65_535),
|
|
5
|
-
baseUrl: z.string().url(),
|
|
6
|
-
sidecarServerEnabled: z.boolean(),
|
|
7
|
-
allowedHosts: z.array(z.string().min(1)).min(1),
|
|
8
|
-
frameAncestors: z.array(z.string().min(1)).min(1),
|
|
9
|
-
artifactTtlSeconds: z.coerce.number().int().min(60).max(86_400),
|
|
10
|
-
});
|
|
11
|
-
function parseBoolean(value, fallback) {
|
|
12
|
-
if (value === undefined)
|
|
13
|
-
return fallback;
|
|
14
|
-
if (value === 'true' || value === '1')
|
|
15
|
-
return true;
|
|
16
|
-
if (value === 'false' || value === '0')
|
|
17
|
-
return false;
|
|
18
|
-
throw new Error(`Invalid boolean value "${value}".`);
|
|
19
|
-
}
|
|
20
|
-
function parseCsv(value) {
|
|
21
|
-
return value
|
|
22
|
-
.split(',')
|
|
23
|
-
.map((item) => item.trim())
|
|
24
|
-
.filter(Boolean);
|
|
25
|
-
}
|
|
26
|
-
function parseFrameAncestors(value) {
|
|
27
|
-
return parseCsv(value).map((item) => {
|
|
28
|
-
if (item === "'self'" || item === "'none'")
|
|
29
|
-
return item;
|
|
30
|
-
const url = new URL(item);
|
|
31
|
-
if (!['http:', 'https:'].includes(url.protocol) || url.origin !== item) {
|
|
32
|
-
throw new Error(`Invalid frame ancestor "${item}". Use an exact HTTP(S) origin.`);
|
|
33
|
-
}
|
|
34
|
-
return item;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
export function loadConfig(env = process.env) {
|
|
38
|
-
const host = env.NUWAX_OPENUI_HOST ?? '127.0.0.1';
|
|
39
|
-
const port = env.NUWAX_OPENUI_PORT ?? '8787';
|
|
40
|
-
return configSchema.parse({
|
|
41
|
-
host,
|
|
42
|
-
port,
|
|
43
|
-
baseUrl: env.NUWAX_OPENUI_BASE_URL ?? `http://${host}:${String(port)}`,
|
|
44
|
-
sidecarServerEnabled: parseBoolean(env.NUWAX_OPENUI_SIDECAR_SERVER_ENABLED, true),
|
|
45
|
-
allowedHosts: parseCsv(env.NUWAX_OPENUI_ALLOWED_HOSTS ?? '127.0.0.1,localhost'),
|
|
46
|
-
frameAncestors: parseFrameAncestors(env.NUWAX_OPENUI_FRAME_ANCESTORS ?? "'self'"),
|
|
47
|
-
artifactTtlSeconds: env.NUWAX_OPENUI_ARTIFACT_TTL_SECONDS ?? '3600',
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAChD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACzB,oBAAoB,EAAE,CAAC,CAAC,OAAO,EAAE;IACjC,YAAY,EA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Q,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACvE,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,iCAAiC,CACjE,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC7D,MAAM,IAAI,GAAG,GAAG,CAAC,iBAAiB,IAAI,WAAW,CAAC;IAClD,MAAM,IAAI,GAAG,GAAG,CAAC,iBAAiB,IAAI,MAAM,CAAC;IAE7C,OAAO,YAAY,CAAC,KAAK,CAAC;QACxB,IAAI;QACJ,IAAI;QACJ,OAAO,EAAE,GAAG,CAAC,qBAAqB,IAAI,UAAU,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE;QACtE,oBAAoB,EAAE,YAAY,CAChC,GAAG,CAAC,mCAAmC,EACvC,IAAI,CACL;QACD,YAAY,EAAE,QAAQ,CACpB,GAAG,CAAC,0BAA0B,IAAI,qBAAqB,CACxD;QACD,cAAc,EAAE,mBAAmB,CACjC,GAAG,CAAC,4BAA4B,IAAI,QAAQ,CAC7C;QACD,kBAAkB,EAAE,GAAG,CAAC,iCAAiC,IAAI,MAAM;KACpE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type Express } from 'express';
|
|
2
|
-
import type { ArtifactStore } from './artifact-store.js';
|
|
3
|
-
import type { AppConfig } from './config.js';
|
|
4
|
-
import type { RenderOpenUiService } from './render-service.js';
|
|
5
|
-
export interface HttpAppDependencies {
|
|
6
|
-
config: AppConfig;
|
|
7
|
-
store: ArtifactStore;
|
|
8
|
-
renderService: RenderOpenUiService;
|
|
9
|
-
}
|
|
10
|
-
export declare function createHttpApp(dependencies: HttpAppDependencies): Express;
|
|
11
|
-
//# sourceMappingURL=http-app.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-app.d.ts","sourceRoot":"","sources":["../../src/http-app.ts"],"names":[],"mappings":"AAKA,OAAgB,EAAE,KAAK,OAAO,EAA+B,MAAM,SAAS,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,aAAa,CAAC;IACrB,aAAa,EAAE,mBAAmB,CAAC;CACpC;AAkBD,wBAAgB,aAAa,CAAC,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAwFxE"}
|
package/dist/server/http-app.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
5
|
-
import express from 'express';
|
|
6
|
-
import { createOpenUiMcpServer } from './mcp-server.js';
|
|
7
|
-
import { createSidecarPageHtml } from './page-template.js';
|
|
8
|
-
function requestHost(request) {
|
|
9
|
-
return (request.headers.host ?? '').split(':')[0] ?? '';
|
|
10
|
-
}
|
|
11
|
-
function addSecurityHeaders(response, frameAncestors) {
|
|
12
|
-
response.setHeader('Referrer-Policy', 'no-referrer');
|
|
13
|
-
response.setHeader('X-Content-Type-Options', 'nosniff');
|
|
14
|
-
response.setHeader('Content-Security-Policy', `default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'none'; form-action 'self'; frame-ancestors ${frameAncestors.join(' ')}`);
|
|
15
|
-
}
|
|
16
|
-
export function createHttpApp(dependencies) {
|
|
17
|
-
const { config, renderService, store } = dependencies;
|
|
18
|
-
const app = express();
|
|
19
|
-
app.disable('x-powered-by');
|
|
20
|
-
app.use(express.json({ limit: '1mb' }));
|
|
21
|
-
app.use((request, response, next) => {
|
|
22
|
-
if (!config.allowedHosts.includes(requestHost(request))) {
|
|
23
|
-
response.status(421).json({ error: 'Untrusted Host header.' });
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
next();
|
|
27
|
-
});
|
|
28
|
-
app.get('/healthz', (_request, response) => {
|
|
29
|
-
response.json({ status: 'ok', service: 'nuwax-openui-mcp' });
|
|
30
|
-
});
|
|
31
|
-
app.post('/mcp', async (request, response) => {
|
|
32
|
-
const server = createOpenUiMcpServer(renderService);
|
|
33
|
-
const transport = new StreamableHTTPServerTransport({
|
|
34
|
-
sessionIdGenerator: undefined,
|
|
35
|
-
enableJsonResponse: true,
|
|
36
|
-
});
|
|
37
|
-
response.on('close', () => {
|
|
38
|
-
void transport.close();
|
|
39
|
-
void server.close();
|
|
40
|
-
});
|
|
41
|
-
try {
|
|
42
|
-
await server.connect(transport);
|
|
43
|
-
await transport.handleRequest(request, response, request.body);
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
if (!response.headersSent) {
|
|
47
|
-
response.status(500).json({
|
|
48
|
-
error: error instanceof Error ? error.message : 'MCP request failed.',
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
app.get('/openui/artifacts/:artifactId', async (request, response) => {
|
|
54
|
-
const artifact = await store.get(request.params.artifactId);
|
|
55
|
-
if (!artifact) {
|
|
56
|
-
response.status(404).json({ error: 'Artifact not found or expired.' });
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
response.setHeader('Cache-Control', 'private, no-store');
|
|
60
|
-
response.json(artifact);
|
|
61
|
-
});
|
|
62
|
-
app.get('/openui/pages/:artifactId', async (request, response) => {
|
|
63
|
-
const artifact = await store.get(request.params.artifactId);
|
|
64
|
-
// The page runtime is shared by inline and sidecar hosts. Presentation
|
|
65
|
-
// controls how the host displays it, not whether a page can be rendered.
|
|
66
|
-
if (!artifact) {
|
|
67
|
-
response.status(404).send('Artifact not found or expired.');
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
addSecurityHeaders(response, config.frameAncestors);
|
|
71
|
-
response.setHeader('Cache-Control', 'private, no-store');
|
|
72
|
-
response
|
|
73
|
-
.type('html')
|
|
74
|
-
.send(createSidecarPageHtml(artifact.artifactId, artifact.title, request.query.transport === 'desktop-query'
|
|
75
|
-
? 'desktop-query'
|
|
76
|
-
: 'path'));
|
|
77
|
-
});
|
|
78
|
-
const moduleDirectory = dirname(fileURLToPath(import.meta.url));
|
|
79
|
-
const webAssetsDirectory = resolve(moduleDirectory, '../web');
|
|
80
|
-
if (existsSync(webAssetsDirectory)) {
|
|
81
|
-
app.use('/openui/assets', express.static(webAssetsDirectory, {
|
|
82
|
-
immutable: true,
|
|
83
|
-
maxAge: '1y',
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
return app;
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=http-app.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-app.js","sourceRoot":"","sources":["../../src/http-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,OAAsD,MAAM,SAAS,CAAC;AAI7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAS3D,SAAS,WAAW,CAAC,OAAgB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O,CAAC,MAAM,CAAC,kBAAkB,EAAE;YACjC,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Server } from 'node:http';
|
|
2
|
-
import type { AppConfig } from './config.js';
|
|
3
|
-
import type { OpenUiRuntime } from './runtime.js';
|
|
4
|
-
export interface StartHttpServerOptions {
|
|
5
|
-
config: AppConfig;
|
|
6
|
-
runtime: OpenUiRuntime;
|
|
7
|
-
}
|
|
8
|
-
export declare function startHttpServer({ config, runtime, }: StartHttpServerOptions): Promise<Server>;
|
|
9
|
-
export declare function closeHttpServer(server: Server): Promise<void>;
|
|
10
|
-
//# sourceMappingURL=http-server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../../src/http-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,wBAAsB,eAAe,CAAC,EACpC,MAAM,EACN,OAAO,GACR,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB1C;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASnE"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createHttpApp } from './http-app.js';
|
|
2
|
-
export async function startHttpServer({ config, runtime, }) {
|
|
3
|
-
const app = createHttpApp({ config, ...runtime });
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
const server = app.listen(config.port, config.host);
|
|
6
|
-
const onError = (error) => {
|
|
7
|
-
server.off('listening', onListening);
|
|
8
|
-
reject(error);
|
|
9
|
-
};
|
|
10
|
-
const onListening = () => {
|
|
11
|
-
server.off('error', onError);
|
|
12
|
-
resolve(server);
|
|
13
|
-
};
|
|
14
|
-
server.once('error', onError);
|
|
15
|
-
server.once('listening', onListening);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export async function closeHttpServer(server) {
|
|
19
|
-
if (!server.listening)
|
|
20
|
-
return;
|
|
21
|
-
await new Promise((resolve, reject) => {
|
|
22
|
-
server.close((error) => {
|
|
23
|
-
if (error)
|
|
24
|
-
reject(error);
|
|
25
|
-
else
|
|
26
|
-
resolve();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=http-server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.js","sourceRoot":"","sources":["../../src/http-server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQ9C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,MAAM,EACN,OAAO,GACgB;IACvB,MAAM,GAAG,GAAG,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAElD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,CAAC,KAAY,EAAQ,EAAE;YACrC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,MAAM,WAAW,GAAG,GAAS,EAAE;YAC7B,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7B,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAc;IAClD,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO;IAE9B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,IAAI,KAAK;gBAAE,MAAM,CAAC,KAAK,CAAC,CAAC;;gBACpB,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/server/http.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC"}
|
package/dist/server/http.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import 'dotenv/config';
|
|
3
|
-
import { loadConfig } from './config.js';
|
|
4
|
-
import { closeHttpServer, startHttpServer } from './http-server.js';
|
|
5
|
-
import { createRuntime } from './runtime.js';
|
|
6
|
-
const config = loadConfig();
|
|
7
|
-
const runtime = createRuntime(config);
|
|
8
|
-
const server = await startHttpServer({ config, runtime });
|
|
9
|
-
console.log(`nuwax-openui-mcp listening at ${config.baseUrl} (MCP: ${config.baseUrl}/mcp)`);
|
|
10
|
-
function shutdown() {
|
|
11
|
-
void closeHttpServer(server).catch((error) => {
|
|
12
|
-
console.error(error);
|
|
13
|
-
process.exitCode = 1;
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
process.on('SIGINT', shutdown);
|
|
17
|
-
process.on('SIGTERM', shutdown);
|
|
18
|
-
//# sourceMappingURL=http.js.map
|
package/dist/server/http.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;AAC5B,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AACtC,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAE1D,OAAO,CAAC,GAAG,CACT,iCAAiC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,OAAO,OAAO,CAC/E,CAAC;AAEF,SAAS,QAAQ;IACf,KAAK,eAAe,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACpD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-template.d.ts","sourceRoot":"","sources":["../../src/page-template.ts"],"names":[],"mappings":"AAWA,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAM,GAAG,eAAwB,GAC3C,MAAM,CAuBR"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { OPENUI_MCP_VERSION } from './version.js';
|
|
2
|
-
function escapeHtml(value) {
|
|
3
|
-
return value
|
|
4
|
-
.replaceAll('&', '&')
|
|
5
|
-
.replaceAll('<', '<')
|
|
6
|
-
.replaceAll('>', '>')
|
|
7
|
-
.replaceAll('"', '"')
|
|
8
|
-
.replaceAll("'", ''');
|
|
9
|
-
}
|
|
10
|
-
export function createSidecarPageHtml(artifactId, title, transport = 'path') {
|
|
11
|
-
const stylesheetUrl = transport === 'desktop-query'
|
|
12
|
-
? `?openui=css&v=${OPENUI_MCP_VERSION}`
|
|
13
|
-
: `../assets/sidecar.css?v=${OPENUI_MCP_VERSION}`;
|
|
14
|
-
const scriptUrl = transport === 'desktop-query'
|
|
15
|
-
? `?openui=js&v=${OPENUI_MCP_VERSION}`
|
|
16
|
-
: `../assets/sidecar.js?v=${OPENUI_MCP_VERSION}`;
|
|
17
|
-
return `<!doctype html>
|
|
18
|
-
<html lang="en">
|
|
19
|
-
<head>
|
|
20
|
-
<meta charset="UTF-8" />
|
|
21
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
22
|
-
<meta name="referrer" content="no-referrer" />
|
|
23
|
-
<title>${escapeHtml(title)}</title>
|
|
24
|
-
<link rel="stylesheet" href="${stylesheetUrl}" />
|
|
25
|
-
</head>
|
|
26
|
-
<body>
|
|
27
|
-
<main id="root" data-artifact-id="${escapeHtml(artifactId)}"></main>
|
|
28
|
-
<script type="module" src="${scriptUrl}"></script>
|
|
29
|
-
</body>
|
|
30
|
-
</html>`;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=page-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-template.js","sourceRoot":"","sources":["../../src/page-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC;SACzB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,UAAkB,EAClB,KAAa,EACb,YAAsC,MAAM;IAE5C,MAAM,aAAa,GACjB,SAAS,KAAK,eAAe;QAC3B,CAAC,CAAC,iBAAiB,kBAAkB,EAAE;QACvC,CAAC,CAAC,2BAA2B,kBAAkB,EAAE,CAAC;IACtD,MAAM,SAAS,GACb,SAAS,KAAK,eAAe;QAC3B,CAAC,CAAC,gBAAgB,kBAAkB,EAAE;QACtC,CAAC,CAAC,0BAA0B,kBAAkB,EAAE,CAAC;IACrD,OAAO;;;;;;aAMI,UAAU,CAAC,KAAK,CAAC;mCACK,aAAa;;;wCAGR,UAAU,CAAC,UAAU,CAAC;iCAC7B,SAAS;;QAElC,CAAC;AACT,CAAC"}
|