Skip to content

Commit dd150f3

Browse files
committed
Add LogicSRC standards MCP server
1 parent 4e4c781 commit dd150f3

26 files changed

Lines changed: 2253 additions & 18 deletions

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ apps/
1212
commandboard-web PWA shell
1313
packages/
1414
cli commandboard/cb command line client
15+
logicsrc-mcp @profullstack/logicsrc-mcp standards MCP server
1516
tui terminal UI
1617
schemas LogicSRC JSON schemas
1718
validators schema validation utilities
@@ -33,8 +34,15 @@ npm install
3334
npm run check
3435
npm --workspace @logicsrc/cli run dev -- plugins
3536
npm --workspace @logicsrc/cli run dev -- tui
37+
npm --workspace @profullstack/logicsrc-mcp run build
38+
node packages/logicsrc-mcp/dist/index.js
3639
```
3740

41+
## MCP
42+
43+
LogicSRC exposes a standards-focused MCP server as `@profullstack/logicsrc-mcp`.
44+
It provides read-only resources for docs and schemas, validation/example tools, and prompt templates for creating LogicSRC-compatible documents.
45+
3846
## v1.0.0 Priorities
3947

4048
- LogicSRC task, agent, run, event, permission, and plugin schemas.

apps/commandboard-web/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<meta name="theme-color" content="#151515" />
77
<link rel="manifest" href="/manifest.webmanifest" />
8-
<link rel="stylesheet" href="/src/styles.css" />
98
<title>CommandBoard.run</title>
109
</head>
1110
<body>

apps/commandboard-web/manifest.webmanifest

Lines changed: 0 additions & 10 deletions
This file was deleted.

apps/commandboard-web/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
"description": "CommandBoard.run PWA shell.",
55
"type": "module",
66
"scripts": {
7-
"build": "node scripts/check-assets.js",
7+
"build": "node scripts/check-assets.js && vite build",
88
"dev": "vite --host 0.0.0.0",
9+
"start": "node server.js",
910
"test:e2e": "playwright test"
1011
},
1112
"dependencies": {
13+
"@logicsrc/commandboard-api": "file:../commandboard-api",
1214
"@vitejs/plugin-react": "^5.1.1",
1315
"vite": "^7.2.6",
1416
"typescript": "^5.9.3"
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "CommandBoard.run",
3+
"short_name": "CommandBoard",
4+
"description": "LogicSRC command board for humans and AI agents.",
5+
"start_url": "/",
6+
"scope": "/",
7+
"display": "standalone",
8+
"background_color": "#f7f2ea",
9+
"theme_color": "#151515",
10+
"icons": [
11+
{
12+
"src": "/icon.svg",
13+
"sizes": "any",
14+
"type": "image/svg+xml",
15+
"purpose": "any maskable"
16+
}
17+
]
18+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const CACHE_NAME = "commandboard-shell-v1";
2+
const SHELL_ASSETS = ["/", "/manifest.webmanifest", "/icon.svg"];
3+
4+
self.addEventListener("install", (event) => {
5+
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(SHELL_ASSETS)));
6+
self.skipWaiting();
7+
});
8+
9+
self.addEventListener("activate", (event) => {
10+
event.waitUntil(
11+
caches.keys().then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))))
12+
);
13+
self.clients.claim();
14+
});
15+
16+
self.addEventListener("fetch", (event) => {
17+
if (event.request.method !== "GET") {
18+
return;
19+
}
20+
21+
event.respondWith(
22+
fetch(event.request)
23+
.then((response) => {
24+
if (response.ok && new URL(event.request.url).origin === self.location.origin) {
25+
const clone = response.clone();
26+
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
27+
}
28+
return response;
29+
})
30+
.catch(() => caches.match(event.request).then((cached) => cached || caches.match("/")))
31+
);
32+
});

apps/commandboard-web/scripts/check-assets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { accessSync } from "node:fs";
22

3-
for (const file of ["index.html", "manifest.webmanifest", "src/main.ts", "src/styles.css"]) {
3+
for (const file of ["index.html", "public/manifest.webmanifest", "public/icon.svg", "public/service-worker.js", "src/main.ts", "src/styles.css"]) {
44
accessSync(new URL(`../${file}`, import.meta.url));
55
}
66

apps/commandboard-web/server.js

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import { createReadStream, existsSync, statSync } from "node:fs";
2+
import { createServer } from "node:http";
3+
import { extname, join, normalize, resolve } from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
import { createCommandBoardServer } from "../commandboard-api/dist/index.js";
6+
7+
const appDirectory = fileURLToPath(new URL(".", import.meta.url));
8+
const distDirectory = resolve(appDirectory, "dist");
9+
const indexFile = join(distDirectory, "index.html");
10+
const apiServer = createCommandBoardServer();
11+
const port = Number(process.env.PORT ?? 4173);
12+
13+
const mimeTypes = {
14+
".css": "text/css; charset=utf-8",
15+
".html": "text/html; charset=utf-8",
16+
".ico": "image/x-icon",
17+
".js": "text/javascript; charset=utf-8",
18+
".json": "application/json; charset=utf-8",
19+
".png": "image/png",
20+
".svg": "image/svg+xml",
21+
".webmanifest": "application/manifest+json; charset=utf-8"
22+
};
23+
24+
createServer((request, response) => {
25+
const url = new URL(request.url ?? "/", `http://${request.headers.host ?? "localhost"}`);
26+
27+
if (url.pathname === "/health" || url.pathname.startsWith("/api/")) {
28+
apiServer.emit("request", request, response);
29+
return;
30+
}
31+
32+
if (request.method !== "GET" && request.method !== "HEAD") {
33+
response.writeHead(405, { allow: "GET, HEAD" });
34+
response.end("Method not allowed");
35+
return;
36+
}
37+
38+
const file = resolveStaticPath(url.pathname);
39+
if (!file) {
40+
response.writeHead(403);
41+
response.end("Forbidden");
42+
return;
43+
}
44+
45+
sendFile(file, request.method === "HEAD", response);
46+
}).listen(port, () => {
47+
console.log(`CommandBoard.run PWA listening on http://localhost:${port}`);
48+
});
49+
50+
function resolveStaticPath(pathname) {
51+
const decodedPath = decodeURIComponent(pathname);
52+
const normalizedPath = normalize(decodedPath).replace(/^(\.\.[/\\])+/, "");
53+
let candidate = join(distDirectory, normalizedPath);
54+
55+
if (!candidate.startsWith(distDirectory)) {
56+
return null;
57+
}
58+
59+
if (existsSync(candidate) && statSync(candidate).isDirectory()) {
60+
candidate = join(candidate, "index.html");
61+
}
62+
63+
if (existsSync(candidate) && statSync(candidate).isFile()) {
64+
return candidate;
65+
}
66+
67+
return indexFile;
68+
}
69+
70+
function sendFile(file, headOnly, response) {
71+
if (!existsSync(file)) {
72+
response.writeHead(500, { "content-type": "text/plain; charset=utf-8" });
73+
response.end("Build output missing. Run `npm run build` before `npm start`.");
74+
return;
75+
}
76+
77+
const extension = extname(file);
78+
response.writeHead(200, {
79+
"cache-control": extension === ".html" ? "no-store" : "public, max-age=31536000, immutable",
80+
"content-type": mimeTypes[extension] ?? "application/octet-stream"
81+
});
82+
83+
if (headOnly) {
84+
response.end();
85+
return;
86+
}
87+
88+
createReadStream(file).pipe(response);
89+
}

apps/commandboard-web/src/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,9 @@ document.querySelector<HTMLDivElement>("#app")!.innerHTML = `
101101
</section>
102102
</main>
103103
`;
104+
105+
if ("serviceWorker" in navigator) {
106+
window.addEventListener("load", () => {
107+
navigator.serviceWorker.register("/service-worker.js").catch(() => undefined);
108+
});
109+
}

0 commit comments

Comments
 (0)