deployboat 0.1.0 → 0.2.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 +26 -0
- package/index.js +95 -59
- package/lib.js +92 -0
- package/mcp.js +116 -0
- package/package.json +27 -6
package/README.md
CHANGED
|
@@ -9,4 +9,30 @@ npx deployboat deploy # in any project folder
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
You get a live HTTPS link, plus a database and file storage your app can use right away.
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
deployboat deploy [folder] publish a folder
|
|
17
|
+
deployboat apps list your apps
|
|
18
|
+
deployboat status this app's status and address
|
|
19
|
+
deployboat logs [--lines 100] this app's recent output
|
|
20
|
+
deployboat env set KEY=value add a secret or setting
|
|
21
|
+
deployboat env unset KEY remove one
|
|
22
|
+
deployboat env list list them (names only)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Add `--json` to any command for machine-readable output.
|
|
26
|
+
|
|
27
|
+
## For AI agents
|
|
28
|
+
|
|
29
|
+
Run Deploy Boat as an MCP server so your agent gets `deploy`, `get_logs`,
|
|
30
|
+
`set_env` and more as tools:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
claude mcp add deployboat -e DEPLOYBOAT_URL=<dashboard-url> -e DEPLOYBOAT_TOKEN=<token> -- npx -y deployboat mcp
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The dashboard (New app → With my AI agent) shows this with your details filled in.
|
|
37
|
+
|
|
12
38
|
Don't have a server yet? See the [install guide](https://github.com/osbulbul/deploy-boat#install).
|
package/index.js
CHANGED
|
@@ -1,76 +1,112 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Deploy Boat CLI. Plain JavaScript, no dependencies, so `npx deployboat` is instant.
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// deployboat deploy [--name my-app]
|
|
6
|
-
//
|
|
7
|
-
// Server and token can also come from DEPLOYBOAT_URL / DEPLOYBOAT_TOKEN or --server / --token.
|
|
3
|
+
// Run `deployboat help` for all commands.
|
|
4
|
+
import { saveLogin, connection, appNameFor, api, resolveApp, deploy } from "./lib.js";
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const argv = process.argv.slice(2);
|
|
7
|
+
const flag = (n) => { const i = argv.indexOf(`--${n}`); return i > -1 ? argv[i + 1] : undefined; };
|
|
8
|
+
const has = (n) => argv.includes(`--${n}`);
|
|
9
|
+
const positional = argv.filter((a, i) => !a.startsWith("--") && !(argv[i - 1]?.startsWith("--") && !["--json"].includes(argv[i - 1])));
|
|
10
|
+
const [cmd, ...args] = positional;
|
|
11
|
+
const json = has("json");
|
|
14
12
|
|
|
15
|
-
const
|
|
16
|
-
|
|
13
|
+
const out = (data, text) => console.log(json ? JSON.stringify(data) : text);
|
|
14
|
+
function fail(msg) {
|
|
15
|
+
if (json) console.log(JSON.stringify({ ok: false, error: msg }));
|
|
16
|
+
else console.error(`✗ ${msg}`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
17
19
|
|
|
18
|
-
const
|
|
19
|
-
const flag = (n) => { const i = process.argv.indexOf(`--${n}`); return i > -1 ? process.argv[i + 1] : undefined; };
|
|
20
|
-
const die = (msg) => { console.error(`✗ ${msg}`); process.exit(1); };
|
|
20
|
+
const HELP = `Deploy Boat — publish any project to your own server.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
deployboat login <server-url> <token> connect this computer (once)
|
|
23
|
+
deployboat deploy [folder] publish a folder (default: this one)
|
|
24
|
+
deployboat apps list your apps
|
|
25
|
+
deployboat status this app's status and address
|
|
26
|
+
deployboat logs [--lines 100] this app's recent output
|
|
27
|
+
deployboat env list this app's variables
|
|
28
|
+
deployboat env set KEY=value … add or change variables (restarts the app)
|
|
29
|
+
deployboat env unset KEY … remove variables (restarts the app)
|
|
30
|
+
deployboat mcp run as an MCP server for AI agents
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
writeFileSync(globalFile, JSON.stringify({ server: server.replace(/\/$/, ""), token }, null, 2), { mode: 0o600 });
|
|
29
|
-
console.log("✓ Logged in. Now run: deployboat deploy");
|
|
30
|
-
} else if (cmd === "deploy") {
|
|
31
|
-
await deploy();
|
|
32
|
-
} else {
|
|
33
|
-
console.log("Usage:\n deployboat login <server-url> <token>\n deployboat deploy [--name my-app]");
|
|
34
|
-
}
|
|
32
|
+
Options:
|
|
33
|
+
--name <app> use this app instead of the one for this folder
|
|
34
|
+
--json print machine-readable JSON (for scripts and AI agents)
|
|
35
|
+
--server, --token connect without logging in (or DEPLOYBOAT_URL / DEPLOYBOAT_TOKEN)`;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const token = flag("token") ?? process.env.DEPLOYBOAT_TOKEN ?? saved.token;
|
|
40
|
-
if (!server || !token) die("Not logged in. Run: deployboat login <server-url> <token>");
|
|
37
|
+
try {
|
|
38
|
+
const conn = () => connection({ server: flag("server"), token: flag("token") });
|
|
39
|
+
const app = async () => resolveApp(conn(), appNameFor(".", flag("name")));
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
switch (cmd) {
|
|
42
|
+
case "login": {
|
|
43
|
+
const [server, token] = args;
|
|
44
|
+
if (!server || !token) fail("Usage: deployboat login <server-url> <token>");
|
|
45
|
+
saveLogin(server, token);
|
|
46
|
+
await api({ server: server.replace(/\/$/, ""), token }, "/api/apps"); // check it works
|
|
47
|
+
out({ ok: true }, "✓ Connected. Now run: deployboat deploy");
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
case "deploy": {
|
|
52
|
+
if (!json) console.log("→ Uploading…");
|
|
53
|
+
const r = await deploy({ dir: args[0] ?? ".", name: flag("name"), conn: conn(), onLine: json ? undefined : (l) => console.log(` ${l}`) });
|
|
54
|
+
if (json) console.log(JSON.stringify({ ...r, log: r.log.slice(-40) }));
|
|
55
|
+
else if (r.ok) console.log(`\n✓ Live: ${r.url}`);
|
|
56
|
+
else console.error(`\n✗ Deploy failed: ${r.error}`);
|
|
57
|
+
process.exit(r.ok ? 0 : 1);
|
|
58
|
+
}
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}).catch((e) => die(`Can't reach ${server} (${e.cause?.code ?? e.message})`));
|
|
60
|
+
case "apps": {
|
|
61
|
+
const list = await api(conn(), "/api/apps");
|
|
62
|
+
out(list, list.length ? list.map((a) => `${a.name.padEnd(24)} ${a.url}`).join("\n") : "No apps yet.");
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
56
65
|
|
|
57
|
-
|
|
66
|
+
case "status": {
|
|
67
|
+
const a = await api(conn(), `/api/apps/${await app()}`);
|
|
68
|
+
const state = a.building ? "building" : a.stopped ? "stopped" : a.state;
|
|
69
|
+
out({ name: a.name, url: a.url, state, lastDeploy: a.deploys[0] ?? null },
|
|
70
|
+
`${a.displayName}\n address: ${a.url}\n state: ${state}\n last deploy: ${a.deploys[0]?.status ?? "none"} (${a.deploys[0]?.created_at ?? "never"} UTC)`);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
58
73
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
case "logs": {
|
|
75
|
+
const text = await api(conn(), `/api/apps/${await app()}/logs?lines=${Number(flag("lines")) || 100}`);
|
|
76
|
+
out({ logs: text }, text || "No output yet.");
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
62
79
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
case "env": {
|
|
81
|
+
const [action, ...pairs] = args;
|
|
82
|
+
const base = `/api/apps/${await app()}/env`;
|
|
83
|
+
if (action === "set") {
|
|
84
|
+
if (!pairs.length) fail("Usage: deployboat env set KEY=value");
|
|
85
|
+
for (const p of pairs) {
|
|
86
|
+
const i = p.indexOf("=");
|
|
87
|
+
if (i < 1) fail(`"${p}" should look like KEY=value`);
|
|
88
|
+
await api(conn(), base, { method: "PUT", body: { key: p.slice(0, i), value: p.slice(i + 1) } });
|
|
89
|
+
}
|
|
90
|
+
out({ ok: true }, `✓ Saved ${pairs.length} variable${pairs.length === 1 ? "" : "s"}. The app restarted.`);
|
|
91
|
+
} else if (action === "unset") {
|
|
92
|
+
for (const k of pairs) await api(conn(), `${base}/${encodeURIComponent(k)}`, { method: "DELETE" });
|
|
93
|
+
out({ ok: true }, `✓ Removed. The app restarted.`);
|
|
94
|
+
} else {
|
|
95
|
+
// Values are hidden unless you ask for them: they're often secrets.
|
|
96
|
+
const vars = await api(conn(), base);
|
|
97
|
+
out(vars.map(({ key, builtin }) => ({ key, builtin })),
|
|
98
|
+
vars.map((v) => `${v.key}${v.builtin ? " (built-in)" : ""}`).join("\n") || "No variables.");
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
73
101
|
}
|
|
102
|
+
|
|
103
|
+
case "mcp":
|
|
104
|
+
await import("./mcp.js");
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
default:
|
|
108
|
+
console.log(HELP);
|
|
74
109
|
}
|
|
75
|
-
|
|
110
|
+
} catch (e) {
|
|
111
|
+
fail(e.message);
|
|
76
112
|
}
|
package/lib.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Shared by the CLI commands and the MCP server: settings, API calls, deploy.
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { basename, join, resolve } from "node:path";
|
|
6
|
+
import { Readable } from "node:stream";
|
|
7
|
+
|
|
8
|
+
const globalDir = join(homedir(), ".deployboat");
|
|
9
|
+
const globalFile = join(globalDir, "config.json");
|
|
10
|
+
|
|
11
|
+
const readJson = (f) => { try { return JSON.parse(readFileSync(f, "utf8")); } catch { return {}; } };
|
|
12
|
+
|
|
13
|
+
export function saveLogin(server, token) {
|
|
14
|
+
mkdirSync(globalDir, { recursive: true });
|
|
15
|
+
writeFileSync(globalFile, JSON.stringify({ server: server.replace(/\/$/, ""), token }, null, 2), { mode: 0o600 });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Server + token from (in order) flags, env vars, or `deployboat login`.
|
|
19
|
+
export function connection(flags = {}) {
|
|
20
|
+
const saved = readJson(globalFile);
|
|
21
|
+
const server = (flags.server ?? process.env.DEPLOYBOAT_URL ?? saved.server)?.replace(/\/$/, "");
|
|
22
|
+
const token = flags.token ?? process.env.DEPLOYBOAT_TOKEN ?? saved.token;
|
|
23
|
+
if (!server || !token) throw new Error("Not connected to a Deploy Boat server. Run: deployboat login <server-url> <token>");
|
|
24
|
+
return { server, token };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Which app a folder belongs to: .deployboat.json, or the folder name.
|
|
28
|
+
export function appNameFor(dir, override) {
|
|
29
|
+
if (override) return override;
|
|
30
|
+
const saved = readJson(join(dir, ".deployboat.json")).name;
|
|
31
|
+
return saved ?? basename(resolve(dir)).toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
32
|
+
}
|
|
33
|
+
const rememberName = (dir, name) => writeFileSync(join(dir, ".deployboat.json"), JSON.stringify({ name }, null, 2) + "\n");
|
|
34
|
+
|
|
35
|
+
// Call the server API. Throws with the server's own message on errors.
|
|
36
|
+
export async function api(conn, path, { method = "GET", body } = {}) {
|
|
37
|
+
const res = await fetch(`${conn.server}${path}`, {
|
|
38
|
+
method,
|
|
39
|
+
headers: { authorization: `Bearer ${conn.token}`, ...(body && { "content-type": "application/json" }) },
|
|
40
|
+
body: body && JSON.stringify(body),
|
|
41
|
+
}).catch((e) => { throw new Error(`Can't reach ${conn.server} (${e.cause?.code ?? e.message})`); });
|
|
42
|
+
const text = await res.text();
|
|
43
|
+
let data; try { data = JSON.parse(text); } catch { data = text; }
|
|
44
|
+
if (!res.ok) throw new Error(data?.error ?? `Server error ${res.status}`);
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Follow renames: an old name from .deployboat.json still finds the app.
|
|
49
|
+
export const resolveApp = async (conn, name) => (await api(conn, `/api/resolve/${encodeURIComponent(name)}`)).name;
|
|
50
|
+
|
|
51
|
+
// Upload a folder and build it. `onLine` gets each build log line.
|
|
52
|
+
// Returns { ok, app, url, error, log } — never throws for build failures.
|
|
53
|
+
export async function deploy({ dir = ".", name, conn, onLine = () => {} }) {
|
|
54
|
+
dir = resolve(dir);
|
|
55
|
+
if (!existsSync(dir)) return { ok: false, error: `Folder not found: ${dir}`, log: [] };
|
|
56
|
+
const app = appNameFor(dir, name);
|
|
57
|
+
rememberName(dir, app);
|
|
58
|
+
|
|
59
|
+
const tar = spawn("tar", ["-cz", "--exclude=node_modules", "--exclude=.git", "--exclude=.env", "-f", "-", "."], { cwd: dir });
|
|
60
|
+
let res;
|
|
61
|
+
try {
|
|
62
|
+
res = await fetch(`${conn.server}/api/deploy/${app}`, {
|
|
63
|
+
method: "POST",
|
|
64
|
+
headers: { authorization: `Bearer ${conn.token}`, "content-type": "application/gzip" },
|
|
65
|
+
body: Readable.toWeb(tar.stdout),
|
|
66
|
+
duplex: "half",
|
|
67
|
+
});
|
|
68
|
+
} catch (e) {
|
|
69
|
+
return { ok: false, app, error: `Can't reach ${conn.server} (${e.cause?.code ?? e.message})`, log: [] };
|
|
70
|
+
}
|
|
71
|
+
if (!res.ok) return { ok: false, app, error: (await res.json().catch(() => ({}))).error ?? `Server error ${res.status}`, log: [] };
|
|
72
|
+
|
|
73
|
+
// The app may have been renamed in the dashboard. Remember the new name.
|
|
74
|
+
const current = res.headers.get("x-app-name") ?? app;
|
|
75
|
+
if (current !== app) rememberName(dir, current);
|
|
76
|
+
|
|
77
|
+
// Stream the build log. The last line is "LIVE <url>" or "FAILED <reason>".
|
|
78
|
+
const log = [];
|
|
79
|
+
let url = null, error = null, buf = "";
|
|
80
|
+
const decoder = new TextDecoder();
|
|
81
|
+
for await (const chunk of res.body) {
|
|
82
|
+
buf += decoder.decode(chunk, { stream: true });
|
|
83
|
+
const lines = buf.split("\n"); buf = lines.pop();
|
|
84
|
+
for (const line of lines) {
|
|
85
|
+
if (line.startsWith("LIVE ")) url = line.slice(5);
|
|
86
|
+
else if (line.startsWith("FAILED ")) error = line.slice(7);
|
|
87
|
+
else { log.push(line); onLine(line); }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (!url && !error) error = "The connection closed before the deploy finished.";
|
|
91
|
+
return { ok: !!url, app: current, url, error, log };
|
|
92
|
+
}
|
package/mcp.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// MCP server: lets AI agents (Claude, Cursor…) use Deploy Boat as tools.
|
|
2
|
+
// Speaks JSON-RPC over stdin/stdout, one message per line. No dependencies.
|
|
3
|
+
// stdout is only for protocol messages; anything else goes to stderr.
|
|
4
|
+
import { createInterface } from "node:readline";
|
|
5
|
+
import { connection, appNameFor, api, resolveApp, deploy } from "./lib.js";
|
|
6
|
+
|
|
7
|
+
const VERSION = "0.2.0";
|
|
8
|
+
|
|
9
|
+
const TOOLS = [
|
|
10
|
+
{
|
|
11
|
+
name: "deploy",
|
|
12
|
+
description: "Publish (or update) a project folder to the user's Deploy Boat server. Builds it automatically and returns the live URL, or the error and the end of the build log.",
|
|
13
|
+
inputSchema: { type: "object", properties: {
|
|
14
|
+
path: { type: "string", description: "Absolute path of the project folder. Defaults to the current folder." },
|
|
15
|
+
name: { type: "string", description: "App name (letters, numbers, dashes). Defaults to the name saved in .deployboat.json or the folder name." },
|
|
16
|
+
} },
|
|
17
|
+
},
|
|
18
|
+
{ name: "list_apps", description: "List the apps on the Deploy Boat server with their URLs and status.", inputSchema: { type: "object", properties: {} } },
|
|
19
|
+
{
|
|
20
|
+
name: "app_status",
|
|
21
|
+
description: "Show an app's address, whether it's running, and its recent deploys.",
|
|
22
|
+
inputSchema: { type: "object", properties: { name: { type: "string" }, path: { type: "string", description: "Project folder, used to find the app name if `name` isn't given." } } },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "get_logs",
|
|
26
|
+
description: "Get an app's recent output (stdout/stderr). Use this to debug an app that crashes or misbehaves after deploying.",
|
|
27
|
+
inputSchema: { type: "object", properties: { name: { type: "string" }, path: { type: "string" }, lines: { type: "number", description: "How many lines (default 100)." } } },
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "set_env",
|
|
31
|
+
description: "Set an environment variable for an app (e.g. an API key the user gave you). The app restarts to pick it up. Never put secrets in code.",
|
|
32
|
+
inputSchema: { type: "object", required: ["key", "value"], properties: { name: { type: "string" }, path: { type: "string" }, key: { type: "string" }, value: { type: "string" } } },
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "unset_env",
|
|
36
|
+
description: "Remove an environment variable from an app. The app restarts.",
|
|
37
|
+
inputSchema: { type: "object", required: ["key"], properties: { name: { type: "string" }, path: { type: "string" }, key: { type: "string" } } },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "setup_guide",
|
|
41
|
+
description: "Read this before building or deploying: how apps must be written for Deploy Boat (port, database, file storage, secrets).",
|
|
42
|
+
inputSchema: { type: "object", properties: {} },
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const text = (t, isError = false) => ({ content: [{ type: "text", text: t }], ...(isError && { isError: true }) });
|
|
47
|
+
const appOf = async (conn, a) => resolveApp(conn, a.name ?? appNameFor(a.path ?? ".", undefined));
|
|
48
|
+
|
|
49
|
+
async function callTool(name, a = {}) {
|
|
50
|
+
const conn = connection();
|
|
51
|
+
switch (name) {
|
|
52
|
+
case "deploy": {
|
|
53
|
+
const r = await deploy({ dir: a.path ?? ".", name: a.name, conn });
|
|
54
|
+
return r.ok
|
|
55
|
+
? text(`Deployed "${r.app}". Live at ${r.url}\nShow this URL to the user.`)
|
|
56
|
+
: text(`Deploy failed: ${r.error}\n\nLast build log lines:\n${r.log.slice(-40).join("\n")}\n\nFix the problem and deploy again.`, true);
|
|
57
|
+
}
|
|
58
|
+
case "list_apps": {
|
|
59
|
+
const list = await api(conn, "/api/apps");
|
|
60
|
+
return text(list.length ? list.map((x) => `${x.name}: ${x.url} (${x.building ? "building" : x.stopped ? "stopped" : x.state})`).join("\n") : "No apps yet.");
|
|
61
|
+
}
|
|
62
|
+
case "app_status": {
|
|
63
|
+
const x = await api(conn, `/api/apps/${await appOf(conn, a)}`);
|
|
64
|
+
const deploys = x.deploys.slice(0, 5).map((d) => `#${d.id} ${d.status} ${d.created_at} UTC${d.current ? " (running)" : ""}`).join("\n");
|
|
65
|
+
return text(`${x.name}\nURL: ${x.url}\nState: ${x.building ? "building" : x.stopped ? "stopped" : x.state}\nRecent deploys:\n${deploys || "none"}`);
|
|
66
|
+
}
|
|
67
|
+
case "get_logs": {
|
|
68
|
+
const logs = await api(conn, `/api/apps/${await appOf(conn, a)}/logs?lines=${Math.min(Number(a.lines) || 100, 1000)}`);
|
|
69
|
+
return text(logs || "No output yet.");
|
|
70
|
+
}
|
|
71
|
+
case "set_env": {
|
|
72
|
+
await api(conn, `/api/apps/${await appOf(conn, a)}/env`, { method: "PUT", body: { key: a.key, value: a.value } });
|
|
73
|
+
return text(`Saved ${a.key}. The app restarted.`);
|
|
74
|
+
}
|
|
75
|
+
case "unset_env": {
|
|
76
|
+
await api(conn, `/api/apps/${await appOf(conn, a)}/env/${encodeURIComponent(a.key)}`, { method: "DELETE" });
|
|
77
|
+
return text(`Removed ${a.key}. The app restarted.`);
|
|
78
|
+
}
|
|
79
|
+
case "setup_guide":
|
|
80
|
+
return text(await api(conn, "/api/agent-guide"));
|
|
81
|
+
default:
|
|
82
|
+
throw Object.assign(new Error(`Unknown tool: ${name}`), { code: -32602 });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function handle(msg) {
|
|
87
|
+
switch (msg.method) {
|
|
88
|
+
case "initialize":
|
|
89
|
+
return {
|
|
90
|
+
protocolVersion: msg.params?.protocolVersion ?? "2025-06-18",
|
|
91
|
+
capabilities: { tools: {} },
|
|
92
|
+
serverInfo: { name: "deployboat", version: VERSION },
|
|
93
|
+
instructions: "Deploy Boat publishes projects to the user's own server. Call setup_guide before building an app, then deploy. Every app already has a PostgreSQL database and S3 file storage.",
|
|
94
|
+
};
|
|
95
|
+
case "ping":
|
|
96
|
+
return {};
|
|
97
|
+
case "tools/list":
|
|
98
|
+
return { tools: TOOLS };
|
|
99
|
+
case "tools/call":
|
|
100
|
+
try { return await callTool(msg.params?.name, msg.params?.arguments); }
|
|
101
|
+
catch (e) { if (e.code) throw e; return text(e.message, true); }
|
|
102
|
+
default:
|
|
103
|
+
throw Object.assign(new Error(`Method not found: ${msg.method}`), { code: -32601 });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const send = (m) => process.stdout.write(JSON.stringify(m) + "\n");
|
|
108
|
+
|
|
109
|
+
createInterface({ input: process.stdin }).on("line", async (line) => {
|
|
110
|
+
if (!line.trim()) return;
|
|
111
|
+
let msg;
|
|
112
|
+
try { msg = JSON.parse(line); } catch { return send({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } }); }
|
|
113
|
+
if (msg.id === undefined) return; // notifications need no answer
|
|
114
|
+
try { send({ jsonrpc: "2.0", id: msg.id, result: await handle(msg) }); }
|
|
115
|
+
catch (e) { send({ jsonrpc: "2.0", id: msg.id, error: { code: e.code ?? -32603, message: e.message } }); }
|
|
116
|
+
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deployboat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Publish any project to your own Deploy Boat server with one command.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
6
|
+
"bin": {
|
|
7
|
+
"deployboat": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js",
|
|
11
|
+
"lib.js",
|
|
12
|
+
"mcp.js",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=20"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"deploy",
|
|
20
|
+
"self-hosted",
|
|
21
|
+
"paas",
|
|
22
|
+
"hosting",
|
|
23
|
+
"cli",
|
|
24
|
+
"ai",
|
|
25
|
+
"mcp"
|
|
26
|
+
],
|
|
10
27
|
"license": "MIT",
|
|
11
|
-
"repository": {
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/osbulbul/deploy-boat.git",
|
|
31
|
+
"directory": "cli"
|
|
32
|
+
},
|
|
12
33
|
"homepage": "https://github.com/osbulbul/deploy-boat#readme",
|
|
13
34
|
"bugs": "https://github.com/osbulbul/deploy-boat/issues"
|
|
14
35
|
}
|