aker-mcp 0.0.0-stage → 1.7.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/README.md +39 -2
- package/bin/aker-mcp.js +257 -0
- package/package.json +35 -4
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# aker-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Launcher for **[AkerMCP](https://github.com/lorenzo-cambiaghi/AkerMCP)**, the live MCP server for **Unity**, **Godot 4** and **Stride Game Studio**: it gives Claude Code, Claude Desktop, Codex, Cursor, Windsurf, Copilot, Cline and Antigravity live scene inspection and editing, Roslyn C# execution, viewport screenshots, automated playtesting and placeholder sprite and audio generation, all running on your machine.
|
|
4
|
+
|
|
5
|
+
## Connect your AI clients
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y aker-mcp@latest setup
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
finds the AI clients installed on this computer and adds AkerMCP to each one, keeping a `.aker-backup` copy of every file it changes. `npx -y aker-mcp@latest doctor` then checks the clients and the running editors. `setup --help` lists the options (one client, a tool profile, a dry run, uninstall).
|
|
12
|
+
|
|
13
|
+
## Or add it by hand
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Claude Code (macOS, Linux)
|
|
17
|
+
claude mcp add --scope user game-engine -- npx -y aker-mcp@latest
|
|
18
|
+
# Claude Code (Windows: npx is a .cmd script, which a client cannot start without a shell)
|
|
19
|
+
claude mcp add --scope user game-engine -- cmd /c npx -y aker-mcp@latest
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"mcpServers": {
|
|
25
|
+
"game-engine": { "command": "npx", "args": ["-y", "aker-mcp@latest"] }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
On Windows the entry is `"command": "cmd"` with `"args": ["/c", "npx", "-y", "aker-mcp@latest"]`. Codex uses TOML in `~/.codex/config.toml`: a `[mcp_servers.game-engine]` table with the same `command` and `args`. Add `"--profile", "full"` to the arguments for sprite and audio authoring, `playtest`, build tools and `ui_action`.
|
|
31
|
+
|
|
32
|
+
## What it does
|
|
33
|
+
|
|
34
|
+
On first use it downloads the standalone `AkerMcp.Server` of its own version from the [GitHub release](https://github.com/lorenzo-cambiaghi/AkerMCP/releases) (about 30 MB) into a per-user folder, the same one the Unity plugin uses (`%LOCALAPPDATA%\AkerMcp\server`, `~/Library/Application Support/AkerMcp/server`, `~/.local/share/AkerMcp/server`), and runs it on stdio. With `@latest` it follows new releases: when one lands, the next start runs the server already on disk and downloads the new one in the background for the start after. `npx -y aker-mcp@latest update` downloads it right away.
|
|
35
|
+
|
|
36
|
+
`AKER_MCP_HOME` moves the folder; `AKER_MCP_BINARY` runs a server binary of your own. Nothing is ever written to stdout but MCP itself.
|
|
37
|
+
|
|
38
|
+
## The editor plugin
|
|
39
|
+
|
|
40
|
+
AkerMCP also needs its plugin inside your editor: see the [Quick Start](https://github.com/lorenzo-cambiaghi/AkerMCP#quick-start-recommended).
|
package/bin/aker-mcp.js
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Zero-dependency launcher for AkerMcp.Server.
|
|
4
|
+
*
|
|
5
|
+
* Runs the standalone server binary of this package's version, downloaded once from the GitHub Release into the
|
|
6
|
+
* per-user install folder the editor plugins use too (AkerMcp.Shared.Setup.ServerInstall, same layout):
|
|
7
|
+
* Windows %LOCALAPPDATA%\AkerMcp\server\v<version>\win-x64\AkerMcp.Server.exe
|
|
8
|
+
* macOS ~/Library/Application Support/AkerMcp/server/v<version>/osx-x64/AkerMcp.Server
|
|
9
|
+
* Linux ${XDG_DATA_HOME:-~/.local/share}/AkerMcp/server/v<version>/linux-x64/AkerMcp.Server
|
|
10
|
+
* AKER_MCP_HOME moves the whole folder; AKER_MCP_BINARY runs a binary of your own instead.
|
|
11
|
+
*
|
|
12
|
+
* When an AI client starts it and only an older server is on disk (the day a release lands), it starts that one at
|
|
13
|
+
* once and downloads the new one in the background for the next start: a ~30 MB download inside the client's MCP
|
|
14
|
+
* start-up window would time out exactly when the user expects the update to just work.
|
|
15
|
+
*
|
|
16
|
+
* IMPORTANT: never write to stdout. It belongs to MCP JSON-RPC; every diagnostic goes to stderr.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { spawn, execFileSync } from "node:child_process";
|
|
20
|
+
import fs from "node:fs";
|
|
21
|
+
import os from "node:os";
|
|
22
|
+
import path from "node:path";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
24
|
+
|
|
25
|
+
const REPO = "lorenzo-cambiaghi/AkerMCP";
|
|
26
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
27
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"));
|
|
28
|
+
const CLI_COMMANDS = new Set(["setup", "doctor", "update", "--version", "-v", "version", "--help", "-h", "help"]);
|
|
29
|
+
|
|
30
|
+
function log(msg) {
|
|
31
|
+
process.stderr.write(`[aker-mcp] ${msg}\n`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getTarget() {
|
|
35
|
+
const { platform, arch } = process;
|
|
36
|
+
// The release publishes x64 builds only: Apple Silicon runs osx-x64 under Rosetta, Windows on Arm under emulation.
|
|
37
|
+
if (platform === "win32" && (arch === "x64" || arch === "arm64")) {
|
|
38
|
+
return { rid: "win-x64", exe: "AkerMcp.Server.exe" };
|
|
39
|
+
}
|
|
40
|
+
if (platform === "darwin" && (arch === "x64" || arch === "arm64")) {
|
|
41
|
+
return { rid: "osx-x64", exe: "AkerMcp.Server" };
|
|
42
|
+
}
|
|
43
|
+
if (platform === "linux" && arch === "x64") {
|
|
44
|
+
return { rid: "linux-x64", exe: "AkerMcp.Server" };
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`No AkerMcp.Server build for ${platform}/${arch}. Build it from source with the .NET 8 SDK: https://github.com/${REPO}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function installRoot() {
|
|
50
|
+
if (process.env.AKER_MCP_HOME) return path.resolve(process.env.AKER_MCP_HOME);
|
|
51
|
+
const home = os.homedir();
|
|
52
|
+
if (process.platform === "win32") {
|
|
53
|
+
return path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "AkerMcp", "server");
|
|
54
|
+
}
|
|
55
|
+
if (process.platform === "darwin") {
|
|
56
|
+
return path.join(home, "Library", "Application Support", "AkerMcp", "server");
|
|
57
|
+
}
|
|
58
|
+
return path.join(process.env.XDG_DATA_HOME || path.join(home, ".local", "share"), "AkerMcp", "server");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function binaryPath(version, target) {
|
|
62
|
+
return path.join(installRoot(), `v${version}`, target.rid, target.exe);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function compareVersions(a, b) {
|
|
66
|
+
const pa = a.split(".").map(Number);
|
|
67
|
+
const pb = b.split(".").map(Number);
|
|
68
|
+
for (let i = 0; i < 3; i++) {
|
|
69
|
+
if ((pa[i] || 0) !== (pb[i] || 0)) return (pa[i] || 0) - (pb[i] || 0);
|
|
70
|
+
}
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** The newest server already on disk, whatever its version, or null. */
|
|
75
|
+
function newestInstalled(target) {
|
|
76
|
+
let names;
|
|
77
|
+
try {
|
|
78
|
+
names = fs.readdirSync(installRoot());
|
|
79
|
+
} catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const versions = names
|
|
83
|
+
.map((n) => /^v(\d+\.\d+\.\d+)$/.exec(n))
|
|
84
|
+
.filter(Boolean)
|
|
85
|
+
.map((m) => m[1])
|
|
86
|
+
.filter((v) => fs.existsSync(binaryPath(v, target)))
|
|
87
|
+
.sort(compareVersions);
|
|
88
|
+
return versions.length ? { version: versions[versions.length - 1], path: binaryPath(versions[versions.length - 1], target) } : null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function download(url, destPath, showProgress) {
|
|
92
|
+
const response = await fetch(url, { redirect: "follow", headers: { "User-Agent": `aker-mcp-npm/${pkg.version}` } });
|
|
93
|
+
if (!response.ok) throw new Error(`GitHub answered HTTP ${response.status} for ${url}`);
|
|
94
|
+
const total = Number(response.headers.get("content-length")) || 0;
|
|
95
|
+
const out = fs.createWriteStream(destPath);
|
|
96
|
+
let done = 0;
|
|
97
|
+
let shown = -10;
|
|
98
|
+
try {
|
|
99
|
+
for await (const chunk of response.body) {
|
|
100
|
+
if (!out.write(chunk)) await new Promise((r) => out.once("drain", r));
|
|
101
|
+
done += chunk.length;
|
|
102
|
+
const pct = total ? Math.floor((done / total) * 100) : 0;
|
|
103
|
+
if (showProgress && total && pct >= shown + 10) {
|
|
104
|
+
shown = pct - (pct % 10);
|
|
105
|
+
log(` ${shown}% of ${(total / 1048576).toFixed(0)} MB`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} finally {
|
|
109
|
+
await new Promise((r) => out.end(r));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function extractZip(zipPath, targetDir) {
|
|
114
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
115
|
+
if (process.platform === "win32") {
|
|
116
|
+
// System32's bsdtar reads zip; a GNU tar earlier on PATH (Git for Windows) does not, and reads "C:" as a host name.
|
|
117
|
+
const systemTar = path.join(process.env.SystemRoot || "C:\\Windows", "System32", "tar.exe");
|
|
118
|
+
try {
|
|
119
|
+
execFileSync(fs.existsSync(systemTar) ? systemTar : "tar", ["-xf", zipPath, "-C", targetDir], { stdio: "ignore" });
|
|
120
|
+
return;
|
|
121
|
+
} catch {
|
|
122
|
+
execFileSync(
|
|
123
|
+
"powershell",
|
|
124
|
+
["-NoProfile", "-NonInteractive", "-Command",
|
|
125
|
+
`Expand-Archive -LiteralPath '${zipPath.replace(/'/g, "''")}' -DestinationPath '${targetDir.replace(/'/g, "''")}' -Force`],
|
|
126
|
+
{ stdio: "ignore" }
|
|
127
|
+
);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
execFileSync("unzip", ["-qo", zipPath, "-d", targetDir], { stdio: "ignore" });
|
|
133
|
+
} catch {
|
|
134
|
+
execFileSync("tar", ["-xf", zipPath, "-C", targetDir], { stdio: "ignore" });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Leftovers of a start that ended mid-download (the server exited, the client killed it): older than an hour. */
|
|
139
|
+
function sweepLeftovers(root) {
|
|
140
|
+
const hourAgo = Date.now() - 3600_000;
|
|
141
|
+
for (const name of fs.readdirSync(root)) {
|
|
142
|
+
if (!name.startsWith(".download-") && !name.startsWith(".staging-")) continue;
|
|
143
|
+
const full = path.join(root, name);
|
|
144
|
+
try {
|
|
145
|
+
if (fs.statSync(full).mtimeMs < hourAgo) fs.rmSync(full, { recursive: true, force: true });
|
|
146
|
+
} catch {
|
|
147
|
+
// in use by another start, or already gone
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Downloads and unpacks the server of `version`; returns its path. Concurrent callers are fine: the folder moves in whole. */
|
|
153
|
+
async function install(version, target, showProgress) {
|
|
154
|
+
const finalPath = binaryPath(version, target);
|
|
155
|
+
if (fs.existsSync(finalPath)) return finalPath;
|
|
156
|
+
|
|
157
|
+
const root = installRoot();
|
|
158
|
+
fs.mkdirSync(root, { recursive: true });
|
|
159
|
+
sweepLeftovers(root);
|
|
160
|
+
const asset = `AkerMcp.Server-${target.rid}.zip`;
|
|
161
|
+
const url = `https://github.com/${REPO}/releases/download/v${version}/${asset}`;
|
|
162
|
+
const stamp = `${process.pid}-${Date.now()}`;
|
|
163
|
+
const zipPath = path.join(root, `.download-${stamp}.zip`);
|
|
164
|
+
const stageDir = path.join(root, `.staging-${stamp}`);
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
if (showProgress) log(`Downloading AkerMcp.Server ${version} (${target.rid})...`);
|
|
168
|
+
await download(url, zipPath, showProgress);
|
|
169
|
+
extractZip(zipPath, stageDir);
|
|
170
|
+
|
|
171
|
+
const staged = path.join(stageDir, target.exe);
|
|
172
|
+
if (!fs.existsSync(staged)) throw new Error(`${asset} has no ${target.exe}.`);
|
|
173
|
+
for (const f of fs.readdirSync(stageDir)) {
|
|
174
|
+
if (f !== target.exe && !f.endsWith(".pdb")) fs.rmSync(path.join(stageDir, f), { recursive: true, force: true });
|
|
175
|
+
}
|
|
176
|
+
if (process.platform !== "win32") fs.chmodSync(staged, 0o755);
|
|
177
|
+
|
|
178
|
+
const versionDir = path.dirname(path.dirname(finalPath));
|
|
179
|
+
fs.mkdirSync(versionDir, { recursive: true });
|
|
180
|
+
try {
|
|
181
|
+
fs.renameSync(stageDir, path.dirname(finalPath));
|
|
182
|
+
} catch (err) {
|
|
183
|
+
if (!fs.existsSync(finalPath)) throw err; // otherwise another start got there first
|
|
184
|
+
}
|
|
185
|
+
if (showProgress) log(`Installed at ${finalPath}`);
|
|
186
|
+
return finalPath;
|
|
187
|
+
} finally {
|
|
188
|
+
fs.rmSync(zipPath, { force: true });
|
|
189
|
+
fs.rmSync(stageDir, { recursive: true, force: true });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** The binary to run now, and the download to finish in the background, if any. */
|
|
194
|
+
async function resolveBinary(interactive) {
|
|
195
|
+
if (process.env.AKER_MCP_BINARY) return { binary: process.env.AKER_MCP_BINARY };
|
|
196
|
+
|
|
197
|
+
const target = getTarget();
|
|
198
|
+
const wanted = pkg.version;
|
|
199
|
+
const exact = binaryPath(wanted, target);
|
|
200
|
+
if (fs.existsSync(exact)) return { binary: exact };
|
|
201
|
+
|
|
202
|
+
if (!interactive) {
|
|
203
|
+
const fallback = newestInstalled(target);
|
|
204
|
+
if (fallback) {
|
|
205
|
+
log(`Server ${wanted} is not installed yet: starting ${fallback.version} now, downloading ${wanted} for the next start.`);
|
|
206
|
+
const background = install(wanted, target, false).then(
|
|
207
|
+
() => log(`Server ${wanted} is ready; it starts the next time your AI client starts AkerMCP.`),
|
|
208
|
+
(err) => log(`Background download of ${wanted} failed (${err.message}); still using ${fallback.version}.`)
|
|
209
|
+
);
|
|
210
|
+
return { binary: fallback.path, background };
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return { binary: await install(wanted, target, true) };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async function main() {
|
|
217
|
+
const cliArgs = process.argv.slice(2);
|
|
218
|
+
const interactive = cliArgs.length > 0 && CLI_COMMANDS.has(cliArgs[0]);
|
|
219
|
+
|
|
220
|
+
if (cliArgs[0] === "update") {
|
|
221
|
+
// `npx -y aker-mcp@latest update`: npx has already fetched the newest launcher; this fetches its server now,
|
|
222
|
+
// so the next client start does not have to.
|
|
223
|
+
const { binary } = await resolveBinary(true);
|
|
224
|
+
log(`AkerMCP ${pkg.version} is installed: ${binary}`);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const { binary, background } = await resolveBinary(interactive);
|
|
229
|
+
const child = spawn(binary, cliArgs, {
|
|
230
|
+
stdio: "inherit",
|
|
231
|
+
windowsHide: true,
|
|
232
|
+
env: { ...process.env, AKER_MCP_LAUNCHER: process.env.AKER_MCP_LAUNCHER || "npx" }
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const forward = (signal) => {
|
|
236
|
+
if (!child.killed) child.kill(signal);
|
|
237
|
+
};
|
|
238
|
+
process.on("SIGINT", () => forward("SIGINT"));
|
|
239
|
+
process.on("SIGTERM", () => forward("SIGTERM"));
|
|
240
|
+
|
|
241
|
+
child.on("error", (err) => {
|
|
242
|
+
log(`Could not start ${binary}: ${err.message}`);
|
|
243
|
+
process.exit(1);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
child.on("exit", (code, signal) => {
|
|
247
|
+
// A background download still running when the server ends is simply abandoned: the next start begins again.
|
|
248
|
+
void background;
|
|
249
|
+
if (signal) process.kill(process.pid, signal);
|
|
250
|
+
else process.exit(code ?? 0);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
main().catch((err) => {
|
|
255
|
+
log(`Error: ${err.message}`);
|
|
256
|
+
process.exit(1);
|
|
257
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aker-mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"description": "MCP server for Unity, Godot 4 & Stride Game Studio — live inspection, Roslyn C# execution, screenshots, automated playtesting & asset generation.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"aker-mcp": "./bin/aker-mcp.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mcp",
|
|
19
|
+
"model-context-protocol",
|
|
20
|
+
"unity",
|
|
21
|
+
"godot",
|
|
22
|
+
"stride",
|
|
23
|
+
"gamedev",
|
|
24
|
+
"claude",
|
|
25
|
+
"cursor",
|
|
26
|
+
"roslyn"
|
|
27
|
+
],
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/lorenzo-cambiaghi/AkerMCP.git",
|
|
31
|
+
"directory": "packages/npm"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/lorenzo-cambiaghi/AkerMCP",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/lorenzo-cambiaghi/AkerMCP/issues"
|
|
36
|
+
}
|
|
37
|
+
}
|