@air-jam/mcp-server 0.9.2 → 0.9.3

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/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # `@air-jam/mcp-server`
2
+
3
+ The official Air Jam MCP server exposes the same project, development,
4
+ evaluation, semantic game-session, and hosted-release services as the Air Jam
5
+ CLI.
6
+
7
+ ## Discover and connect
8
+
9
+ ```bash
10
+ pnpm exec airjam mcp doctor --dir . --json
11
+ pnpm exec airjam mcp config --profile portable --dir .
12
+ pnpm exec airjam-mcp
13
+ ```
14
+
15
+ The portable project declaration is `.mcp.json`. Codex and Claude Desktop can
16
+ also use their explicit profiles through `airjam mcp config`.
17
+
18
+ For Claude Desktop, generate the client-global configuration for your game:
19
+
20
+ ```bash
21
+ pnpm exec airjam mcp config --profile claude-desktop --dir . --json
22
+ ```
23
+
24
+ The result includes the destination `configPath` and JSON `content`. In
25
+ Claude Desktop's **Settings > Developer > Edit config**, merge the `airjam`
26
+ entry into `mcpServers`, preserving any existing connectors. Restart Desktop
27
+ and check the server's connection status in Developer settings. This profile
28
+ pins the game's absolute directory so Desktop can find its installed MCP
29
+ package regardless of where the app launches. The `pnpm` executable must be
30
+ available to Desktop; if it cannot find it, use its absolute executable path
31
+ in the entry's `command` field.
32
+
33
+ Rendering a profile does not install it. `claude mcp add` registers a server
34
+ with Claude Code, not Claude Desktop. Use `airjam mcp doctor --dir . --json`
35
+ to inspect registration; registration alone does not prove a live connection.
36
+
37
+ ## Complete evaluation
38
+
39
+ Call `airjam.evaluate` before sharing a game and again after any repair. It
40
+ runs typecheck, lint, tests, and the production build, returning one stable
41
+ `air-jam-complete-evaluation/v1` result. Use `airjam.run_quality_gate` when you
42
+ only need to narrow a failure.
43
+
44
+ For reliable gameplay assertions, use `airjam.open_game_session`,
45
+ `airjam.read_game_session`, `airjam.invoke_game_session_action`, and
46
+ `airjam.close_game_session`. Use `airjam.capture_game_session_visuals` to
47
+ capture the owning room's canonical host and controller views when the client
48
+ cannot launch its own browser. Browser interaction remains visual proof rather
49
+ than the primary automation lane.
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { spawn } from "node:child_process";
3
4
  import { existsSync } from "node:fs";
4
5
  import path from "node:path";
5
- import { spawn } from "node:child_process";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
 
8
8
  const packageRoot = path.resolve(
@@ -10,35 +10,57 @@ const packageRoot = path.resolve(
10
10
  "..",
11
11
  );
12
12
  const distEntry = path.join(packageRoot, "dist", "cli.js");
13
- const sourceEntry = path.join(packageRoot, "src", "cli.ts");
13
+ const repoRoot = path.resolve(packageRoot, "../..");
14
+ const workspaceBuildScript = path.join(
15
+ repoRoot,
16
+ "scripts",
17
+ "ensure-workspace-package-build.mjs",
18
+ );
19
+
20
+ const buildWorkspacePackage = async () => {
21
+ if (!existsSync(workspaceBuildScript)) {
22
+ throw new Error(
23
+ "The installed @air-jam/mcp-server package is missing its built CLI entrypoint.",
24
+ );
25
+ }
14
26
 
15
- const forwardToSourceCli = async () =>
16
- new Promise((resolve, reject) => {
27
+ await new Promise((resolve, reject) => {
17
28
  const child = spawn(
18
29
  process.execPath,
19
- ["--import", "tsx", sourceEntry, ...process.argv.slice(2)],
30
+ [workspaceBuildScript, "@air-jam/mcp-server"],
20
31
  {
21
- cwd: packageRoot,
32
+ cwd: repoRoot,
22
33
  stdio: "inherit",
23
34
  env: process.env,
24
35
  },
25
36
  );
26
37
 
27
38
  child.on("exit", (code, signal) => {
28
- if (signal) {
29
- process.kill(process.pid, signal);
39
+ if (code === 0) {
40
+ resolve(undefined);
30
41
  return;
31
42
  }
32
43
 
33
- process.exitCode = code ?? 0;
34
- resolve(undefined);
44
+ reject(
45
+ new Error(
46
+ signal
47
+ ? `Workspace MCP build terminated by signal ${signal}.`
48
+ : `Workspace MCP build exited with code ${code}.`,
49
+ ),
50
+ );
35
51
  });
36
-
37
52
  child.on("error", reject);
38
53
  });
54
+ };
55
+
56
+ if (!existsSync(distEntry)) {
57
+ await buildWorkspacePackage();
58
+ }
39
59
 
40
- if (existsSync(distEntry)) {
41
- await import(pathToFileURL(distEntry).href);
42
- } else {
43
- await forwardToSourceCli();
60
+ if (!existsSync(distEntry)) {
61
+ throw new Error(
62
+ "The @air-jam/mcp-server build completed without producing dist/cli.js.",
63
+ );
44
64
  }
65
+
66
+ await import(pathToFileURL(distEntry).href);