agentic-numerical-control 0.1.4 → 0.1.6

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.
@@ -1,6 +1,7 @@
1
1
  // Keeps this PC linked to a Agentic Numerical Control cloud account. The PC dials out to the
2
2
  // cloud over a WebSocket; MCP requests from Claude arrive on it and are
3
3
  // answered by the local MCP endpoint. Nothing listens on the network.
4
+ import { spawn } from "node:child_process";
4
5
  import fs from "node:fs";
5
6
  import os from "node:os";
6
7
  import path from "node:path";
@@ -29,6 +30,18 @@ async function postJson(url, body) {
29
30
  throw new Error(json.error ?? `${res.status} ${res.statusText}`);
30
31
  return json;
31
32
  }
33
+ /** Best effort: the link is also printed for when no browser opens. */
34
+ function openBrowser(url) {
35
+ const [cmd, args] = process.platform === "win32" ? ["rundll32", ["url.dll,FileProtocolHandler", url]]
36
+ : process.platform === "darwin" ? ["open", [url]]
37
+ : ["xdg-open", [url]];
38
+ try {
39
+ spawn(cmd, args, { detached: true, stdio: "ignore" }).on("error", () => { }).unref();
40
+ }
41
+ catch {
42
+ // no browser available (a headless machine): the printed link is enough
43
+ }
44
+ }
32
45
  /** Device-code pairing: show a code, wait for the person to approve it online. */
33
46
  export async function pair(cloudUrl) {
34
47
  for (;;) {
@@ -42,10 +55,10 @@ async function pairOnce(cloudUrl) {
42
55
  const name = `${os.hostname()} (Agentic Numerical Control)`;
43
56
  const start = await postJson(`${cloudUrl}/api/device/start`, { name });
44
57
  console.log("");
45
- console.log(" Link this PC to your Agentic Numerical Control account:");
46
- console.log(` 1. Open ${start.verificationUri}`);
47
- console.log(` 2. Sign in and check the code is ${start.userCode}`);
58
+ console.log(` Link this computer to your account. Your code is ${start.userCode}.`);
59
+ console.log(` A browser page should open. If it doesn't, open ${start.verificationUri}`);
48
60
  console.log("");
61
+ openBrowser(start.verificationUri);
49
62
  const deadline = Date.now() + start.expiresIn * 1000;
50
63
  while (Date.now() < deadline) {
51
64
  await sleep(start.interval * 1000);
@@ -4,7 +4,7 @@ import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { z } from "zod";
6
6
  import { currentJob, jobSummary, jobsDir, listJobFiles, loadJobFile, loadJobFromCncjs, loadJobText, parsedLineAt, } from "./jobs.js";
7
- import { ROOT, VERSION } from "./product.js";
7
+ import { PRODUCT, ROOT, VERSION } from "./product.js";
8
8
  import { CNCJS_URL, cncjs } from "./cncjs.js";
9
9
  // The viewer follows whatever program CNCjs has loaded, including files
10
10
  // loaded from the CNCjs interface itself.
@@ -24,7 +24,18 @@ function fail(message) {
24
24
  return { content: [{ type: "text", text: message }], isError: true };
25
25
  }
26
26
  export function createServer() {
27
- const server = new McpServer({ name: "agentic-numerical-control", version: VERSION });
27
+ // The icon assistants show for the connector, in light and dark versions.
28
+ const icon = (theme) => [
29
+ { src: `${PRODUCT.siteUrl}/icons/icon-${theme}.svg`, mimeType: "image/svg+xml", sizes: ["any"], theme },
30
+ { src: `${PRODUCT.siteUrl}/icons/icon-${theme}-512.png`, mimeType: "image/png", sizes: ["512x512"], theme },
31
+ ];
32
+ const server = new McpServer({
33
+ name: "agentic-numerical-control",
34
+ title: PRODUCT.displayName,
35
+ version: VERSION,
36
+ websiteUrl: PRODUCT.siteUrl,
37
+ icons: [...icon("light"), ...icon("dark")],
38
+ });
28
39
  registerAppTool(server, "anc_show_job", {
29
40
  title: "Show CNC job",
30
41
  description: "Open the Agentic Numerical Control 3D toolpath viewer for a G-code job. Pass `file` (a name from anc_list_jobs) or `gcode` text. " +
package/package.json CHANGED
@@ -1,73 +1,73 @@
1
- {
2
- "name": "agentic-numerical-control",
3
- "version": "0.1.4",
4
- "description": "Agentic Numerical Control: see and run CNC jobs from your AI assistant. A 3D toolpath viewer, live machine status and job control for CNCjs/GRBL machines.",
5
- "scripts": {
6
- "build": "tsc --noEmit -p tsconfig.app.json && cross-env INPUT=viewer.html vite build && tsc -p tsconfig.build.json",
7
- "dev": "npm run build && tsx server/cli.ts start",
8
- "dev:serve": "npm run build && tsx server/cli.ts serve",
9
- "dev:stdio": "npm run build 1>&2 && tsx server/cli.ts stdio",
10
- "sim:build": "node sim/build.mjs",
11
- "sim:e2e": "node sim/e2e.mjs",
12
- "prepack": "npm run build",
13
- "demo:site": "tsx scripts/build-demo.ts"
14
- },
15
- "license": "MIT",
16
- "dependencies": {
17
- "@modelcontextprotocol/express": "^2.0.0",
18
- "@modelcontextprotocol/ext-apps": "^2.0.3",
19
- "@modelcontextprotocol/node": "^2.0.0",
20
- "@modelcontextprotocol/server": "^2.0.0",
21
- "cncjs": "^1.11.5",
22
- "cors": "^2.8.6",
23
- "express": "^5.3.0",
24
- "gcode-toolpath": "^3.0.0",
25
- "jsonwebtoken": "^9.0.3",
26
- "socket.io-client": "^2.2.0",
27
- "three": "^0.186.1",
28
- "ws": "^8.22.0",
29
- "zod": "^4.6.7"
30
- },
31
- "devDependencies": {
32
- "@types/cors": "^2.8.19",
33
- "@types/express": "^5.0.6",
34
- "@types/jsonwebtoken": "^9.0.10",
35
- "@types/node": "^26.6.5",
36
- "@types/three": "^0.186.0",
37
- "@types/ws": "^8.18.2",
38
- "cross-env": "^10.1.0",
39
- "tsx": "^4.23.15",
40
- "typescript": "^5.9.3",
41
- "vite": "^6.4.4",
42
- "vite-plugin-singlefile": "^2.3.3"
43
- },
44
- "type": "module",
45
- "bin": {
46
- "agentic-numerical-control": "dist/server/cli.js",
47
- "anc": "dist/server/cli.js"
48
- },
49
- "files": [
50
- "dist",
51
- "product.json",
52
- "samples/demo-pocket-profile.nc",
53
- "sim/virtual-port.cjs"
54
- ],
55
- "engines": {
56
- "node": ">=20"
57
- },
58
- "homepage": "https://agenticnumericalcontrol.com",
59
- "keywords": [
60
- "cnc",
61
- "grbl",
62
- "cncjs",
63
- "mcp",
64
- "mcp-app",
65
- "claude",
66
- "gcode",
67
- "toolpath"
68
- ],
69
- "repository": {
70
- "type": "git",
71
- "url": "git+https://github.com/EdwardCoventry/agentic-numerical-control.git"
72
- }
73
- }
1
+ {
2
+ "name": "agentic-numerical-control",
3
+ "version": "0.1.6",
4
+ "description": "Agentic Numerical Control: see and run CNC jobs from your AI assistant. A 3D toolpath viewer, live machine status and job control for CNCjs/GRBL machines.",
5
+ "scripts": {
6
+ "build": "tsc --noEmit -p tsconfig.app.json && cross-env INPUT=viewer.html vite build && tsc -p tsconfig.build.json",
7
+ "dev": "npm run build && tsx server/cli.ts start",
8
+ "dev:serve": "npm run build && tsx server/cli.ts serve",
9
+ "dev:stdio": "npm run build 1>&2 && tsx server/cli.ts stdio",
10
+ "sim:build": "node sim/build.mjs",
11
+ "sim:e2e": "node sim/e2e.mjs",
12
+ "prepack": "npm run build",
13
+ "demo:site": "tsx scripts/build-demo.ts && tsx scripts/build-catalogue.ts"
14
+ },
15
+ "license": "MIT",
16
+ "dependencies": {
17
+ "@modelcontextprotocol/express": "^2.0.0",
18
+ "@modelcontextprotocol/ext-apps": "^2.0.3",
19
+ "@modelcontextprotocol/node": "^2.0.0",
20
+ "@modelcontextprotocol/server": "^2.0.0",
21
+ "cncjs": "^1.11.5",
22
+ "cors": "^2.8.6",
23
+ "express": "^5.3.0",
24
+ "gcode-toolpath": "^3.0.0",
25
+ "jsonwebtoken": "^9.0.3",
26
+ "socket.io-client": "^2.2.0",
27
+ "three": "^0.186.1",
28
+ "ws": "^8.22.0",
29
+ "zod": "^4.6.7"
30
+ },
31
+ "devDependencies": {
32
+ "@types/cors": "^2.8.19",
33
+ "@types/express": "^5.0.6",
34
+ "@types/jsonwebtoken": "^9.0.10",
35
+ "@types/node": "^26.6.5",
36
+ "@types/three": "^0.186.0",
37
+ "@types/ws": "^8.18.2",
38
+ "cross-env": "^10.1.0",
39
+ "tsx": "^4.23.15",
40
+ "typescript": "^5.9.3",
41
+ "vite": "^6.4.4",
42
+ "vite-plugin-singlefile": "^2.3.3"
43
+ },
44
+ "type": "module",
45
+ "bin": {
46
+ "agentic-numerical-control": "dist/server/cli.js",
47
+ "anc": "dist/server/cli.js"
48
+ },
49
+ "files": [
50
+ "dist",
51
+ "product.json",
52
+ "samples/demo-pocket-profile.nc",
53
+ "sim/virtual-port.cjs"
54
+ ],
55
+ "engines": {
56
+ "node": ">=20"
57
+ },
58
+ "homepage": "https://agenticnumericalcontrol.com",
59
+ "keywords": [
60
+ "cnc",
61
+ "grbl",
62
+ "cncjs",
63
+ "mcp",
64
+ "mcp-app",
65
+ "claude",
66
+ "gcode",
67
+ "toolpath"
68
+ ],
69
+ "repository": {
70
+ "type": "git",
71
+ "url": "git+https://github.com/EdwardCoventry/agentic-numerical-control.git"
72
+ }
73
+ }