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