Add quick start: config generator script and onboarding docs
This commit is contained in:
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Print a ready-to-paste MCP server config with absolute paths filled in.
|
||||
*
|
||||
* Usage:
|
||||
* node scripts/print-mcp-config.mjs /path/to/binary
|
||||
* node scripts/print-mcp-config.mjs /path/to/binary --kind database
|
||||
* node scripts/print-mcp-config.mjs /path/to/binary --loader-args '["-l","Mach-O","--aarch64"]'
|
||||
*/
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const targetPath = process.argv[2];
|
||||
if (!targetPath) {
|
||||
process.stderr.write(
|
||||
"Usage: node scripts/print-mcp-config.mjs <target-path> [--kind executable|database] [--loader-args JSON]\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const flags = process.argv.slice(3);
|
||||
const kind = readFlag(flags, "--kind") ?? "executable";
|
||||
const loaderArgs = readFlag(flags, "--loader-args");
|
||||
|
||||
const serverPath = resolve(
|
||||
fileURLToPath(new URL("..", import.meta.url)),
|
||||
"dist/main.js",
|
||||
);
|
||||
|
||||
const env = {
|
||||
HOPPER_TARGET_PATH: resolve(targetPath),
|
||||
HOPPER_TARGET_KIND: kind,
|
||||
};
|
||||
if (loaderArgs) env.HOPPER_LOADER_ARGS_JSON = loaderArgs;
|
||||
|
||||
const config = {
|
||||
mcpServers: {
|
||||
betterBinaryMCP: {
|
||||
command: "node",
|
||||
args: [serverPath],
|
||||
env,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
process.stdout.write(`${JSON.stringify(config, null, 2)}\n`);
|
||||
|
||||
function readFlag(args, name) {
|
||||
const i = args.indexOf(name);
|
||||
return i !== -1 ? args[i + 1] : undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user