@lovinka/deployik-mcp 0.3.2 → 0.5.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 +30 -1
- package/dist/daemon.js +119 -0
- package/dist/daemon.js.map +1 -0
- package/dist/index.js +104 -1
- package/dist/index.js.map +1 -1
- package/dist/install-daemon.js +364 -0
- package/dist/install-daemon.js.map +1 -0
- package/dist/server.js +16 -2
- package/dist/server.js.map +1 -1
- package/dist/tools/_helpers.js.map +1 -1
- package/dist/tools/apps.js +256 -0
- package/dist/tools/apps.js.map +1 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/projects.js +12 -0
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/workflows.js +62 -54
- package/dist/tools/workflows.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
// Install a long-lived deployik-mcp daemon via macOS launchd.
|
|
2
|
+
//
|
|
3
|
+
// The daemon (src/daemon.ts) is one HTTP process on 127.0.0.1, shared by
|
|
4
|
+
// every Claude Code window. This module owns the install/uninstall side:
|
|
5
|
+
//
|
|
6
|
+
// 1. Write a launchd plist (~/Library/LaunchAgents/com.lovinka.deployik-mcp.plist)
|
|
7
|
+
// that runs `node <absolute path>/dist/daemon.js` with KeepAlive=true,
|
|
8
|
+
// RunAtLoad=true, and DEPLOYIK_* in EnvironmentVariables.
|
|
9
|
+
// 2. Bootstrap it via `launchctl bootout` (clear any old version) +
|
|
10
|
+
// `launchctl bootstrap gui/$UID <plist>`.
|
|
11
|
+
// 3. Rewrite Claude configs: replace the old stdio entry
|
|
12
|
+
// ({ command: "npx", args: [...], env: {...} }) with
|
|
13
|
+
// ({ type: "http", url: "http://127.0.0.1:8788/mcp" }).
|
|
14
|
+
// 4. Uninstall reverses all three.
|
|
15
|
+
//
|
|
16
|
+
// Token lives only in the plist's <EnvironmentVariables>. Plist file is
|
|
17
|
+
// chmod 0600 — readable by the current user only. Other users on the box
|
|
18
|
+
// would need root to read it.
|
|
19
|
+
import { execFileSync } from "node:child_process";
|
|
20
|
+
import { chmodSync, copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, rmSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
21
|
+
import { homedir, platform } from "node:os";
|
|
22
|
+
import { dirname, join, resolve } from "node:path";
|
|
23
|
+
export const DAEMON_LABEL = "com.lovinka.deployik-mcp";
|
|
24
|
+
export const DEFAULT_DAEMON_PORT = 8788;
|
|
25
|
+
export const DEFAULT_URL = "https://deployik.lovinka.com";
|
|
26
|
+
const MCP_NAME = "deployik";
|
|
27
|
+
/** Where the staged daemon runtime lives — outside any TCC-protected folder. */
|
|
28
|
+
function runtimeDir() {
|
|
29
|
+
return join(homedir(), ".deployik-mcp", "runtime");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Locate the `node_modules` directory that contains our dependencies.
|
|
33
|
+
*
|
|
34
|
+
* Two real layouts to support:
|
|
35
|
+
*
|
|
36
|
+
* Local dev: sourceDir = .../mcp → node_modules in sourceDir
|
|
37
|
+
* npx cache: sourceDir = ~/.npm/_npx/<hash>/node_modules/@lovinka/deployik-mcp
|
|
38
|
+
* → node_modules is the grandparent (two levels up)
|
|
39
|
+
*
|
|
40
|
+
* We probe for `@modelcontextprotocol/sdk` as the existence sentinel — it's a
|
|
41
|
+
* required dep, so wherever it lives is where Node will resolve our imports.
|
|
42
|
+
*/
|
|
43
|
+
function findNodeModulesRoot(sourceDir) {
|
|
44
|
+
const sentinel = join("node_modules", "@modelcontextprotocol", "sdk");
|
|
45
|
+
const candidates = [
|
|
46
|
+
sourceDir, // local dev: mcp/
|
|
47
|
+
resolve(sourceDir, "..", ".."), // npx: node_modules/@lovinka/deployik-mcp → up to npx root
|
|
48
|
+
resolve(sourceDir, "..", "..", ".."), // scoped install under another package's node_modules
|
|
49
|
+
];
|
|
50
|
+
for (const dir of candidates) {
|
|
51
|
+
if (existsSync(join(dir, sentinel)))
|
|
52
|
+
return dir;
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`Cannot locate node_modules containing @modelcontextprotocol/sdk relative to ${sourceDir}. Tried: ${candidates.join(", ")}`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Stage the runtime into ~/.deployik-mcp/runtime/ — outside any TCC-protected
|
|
58
|
+
* folder so launchd-spawned processes can read it on every macOS. Idempotent:
|
|
59
|
+
* each call wipes the previous runtime and writes fresh. Returns the absolute
|
|
60
|
+
* path to the staged daemon entry script.
|
|
61
|
+
*
|
|
62
|
+
* Layout written: runtime/{dist, node_modules, package.json}. Both layouts
|
|
63
|
+
* (local dev and published-via-npx) end up identical after staging, so the
|
|
64
|
+
* plist always points at runtime/dist/daemon.js.
|
|
65
|
+
*/
|
|
66
|
+
function stageRuntime(sourceDir) {
|
|
67
|
+
const requiredInSource = ["dist/daemon.js", "package.json"];
|
|
68
|
+
for (const r of requiredInSource) {
|
|
69
|
+
if (!existsSync(join(sourceDir, r))) {
|
|
70
|
+
throw new Error(`source missing ${r} (run 'npm run build' in ${sourceDir} first)`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const depsRoot = findNodeModulesRoot(sourceDir);
|
|
74
|
+
const target = runtimeDir();
|
|
75
|
+
for (const sub of ["dist", "node_modules", "package.json"]) {
|
|
76
|
+
rmSync(join(target, sub), { recursive: true, force: true });
|
|
77
|
+
}
|
|
78
|
+
mkdirSync(target, { recursive: true });
|
|
79
|
+
cpSync(join(sourceDir, "dist"), join(target, "dist"), { recursive: true, dereference: true });
|
|
80
|
+
cpSync(join(depsRoot, "node_modules"), join(target, "node_modules"), { recursive: true, dereference: true });
|
|
81
|
+
copyFileSync(join(sourceDir, "package.json"), join(target, "package.json"));
|
|
82
|
+
return join(target, "dist", "daemon.js");
|
|
83
|
+
}
|
|
84
|
+
/** Returns the plist path even when the file doesn't exist yet. */
|
|
85
|
+
export function daemonPlistPath() {
|
|
86
|
+
return join(homedir(), "Library", "LaunchAgents", `${DAEMON_LABEL}.plist`);
|
|
87
|
+
}
|
|
88
|
+
/** Where launchd's stdout/stderr land for the daemon. */
|
|
89
|
+
export function daemonLogPaths() {
|
|
90
|
+
const dir = join(homedir(), "Library", "Logs");
|
|
91
|
+
return {
|
|
92
|
+
out: join(dir, "deployik-mcp.out.log"),
|
|
93
|
+
err: join(dir, "deployik-mcp.err.log"),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export function installDaemon(opts) {
|
|
97
|
+
if (platform() !== "darwin") {
|
|
98
|
+
throw new Error("--daemon install currently supports macOS only (launchd). For Linux, write a systemd --user unit pointing at `node dist/daemon.js`.");
|
|
99
|
+
}
|
|
100
|
+
const port = opts.port ?? DEFAULT_DAEMON_PORT;
|
|
101
|
+
const nodePath = opts.nodePath ?? resolveNodePath();
|
|
102
|
+
// Stage the runtime into ~/.deployik-mcp/runtime/ — launchd-spawned
|
|
103
|
+
// processes hit macOS TCC denials when reading from ~/Documents/ etc.,
|
|
104
|
+
// and the user's source repo lives there. Staging outside TCC-protected
|
|
105
|
+
// folders is the only reliable fix without asking the user to grant
|
|
106
|
+
// Full Disk Access in System Settings.
|
|
107
|
+
const daemonScript = stageRuntime(resolve(opts.sourceDir));
|
|
108
|
+
const logs = daemonLogPaths();
|
|
109
|
+
mkdirSync(dirname(logs.out), { recursive: true });
|
|
110
|
+
const plistPath = daemonPlistPath();
|
|
111
|
+
mkdirSync(dirname(plistPath), { recursive: true });
|
|
112
|
+
const plist = renderPlist({
|
|
113
|
+
label: DAEMON_LABEL,
|
|
114
|
+
nodePath,
|
|
115
|
+
daemonScript,
|
|
116
|
+
env: {
|
|
117
|
+
DEPLOYIK_URL: opts.url,
|
|
118
|
+
DEPLOYIK_TOKEN: opts.token,
|
|
119
|
+
DEPLOYIK_DAEMON_PORT: String(port),
|
|
120
|
+
},
|
|
121
|
+
stdoutPath: logs.out,
|
|
122
|
+
stderrPath: logs.err,
|
|
123
|
+
});
|
|
124
|
+
writeFileSync(plistPath, plist, "utf8");
|
|
125
|
+
// 0600: token lives plaintext inside this file — only the current user reads it.
|
|
126
|
+
chmodSync(plistPath, 0o600);
|
|
127
|
+
// Re-bootstrap so a re-run picks up env/script changes. Two races to
|
|
128
|
+
// navigate:
|
|
129
|
+
// 1. `bootout` returns before launchd has fully released the label —
|
|
130
|
+
// `print` reports the service as unloaded (exit 113) almost
|
|
131
|
+
// immediately, but the underlying process can still be in cleanup.
|
|
132
|
+
// 2. A bootstrap fired before the old process is fully reaped fails
|
|
133
|
+
// with the famously vague "Bootstrap failed: 5: Input/output error".
|
|
134
|
+
//
|
|
135
|
+
// So we bootout (best-effort), then retry the bootstrap with backoff
|
|
136
|
+
// until it sticks or we run out of attempts. Six tries × ~700ms gives
|
|
137
|
+
// launchd ~4s of room — plenty in practice; the manual fix during dev
|
|
138
|
+
// worked after ~2s.
|
|
139
|
+
const uid = process.getuid?.() ?? 501;
|
|
140
|
+
const domain = `gui/${uid}`;
|
|
141
|
+
if (isServiceLoaded(domain, DAEMON_LABEL)) {
|
|
142
|
+
try {
|
|
143
|
+
execFileSync("launchctl", ["bootout", `${domain}/${DAEMON_LABEL}`], { stdio: "ignore" });
|
|
144
|
+
}
|
|
145
|
+
catch { /* ignore */ }
|
|
146
|
+
}
|
|
147
|
+
let loaded = false;
|
|
148
|
+
let loadError;
|
|
149
|
+
const attempts = 6;
|
|
150
|
+
const backoffMs = 700;
|
|
151
|
+
for (let i = 0; i < attempts; i++) {
|
|
152
|
+
try {
|
|
153
|
+
execFileSync("launchctl", ["bootstrap", domain, plistPath], { stdio: ["ignore", "pipe", "pipe"] });
|
|
154
|
+
loaded = true;
|
|
155
|
+
loadError = undefined;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
loadError = err.stderr?.toString("utf8").trim() || err.message;
|
|
160
|
+
// Only retry on the specific race error; anything else (bad plist,
|
|
161
|
+
// permission denied) will keep failing — return fast for those.
|
|
162
|
+
if (!loadError.toLowerCase().includes("input/output error"))
|
|
163
|
+
break;
|
|
164
|
+
if (i < attempts - 1)
|
|
165
|
+
sleepSync(backoffMs);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const configsResult = rewriteClaudeConfigsForDaemon(port);
|
|
169
|
+
return {
|
|
170
|
+
plistPath,
|
|
171
|
+
port,
|
|
172
|
+
url: `http://127.0.0.1:${port}/mcp`,
|
|
173
|
+
loaded,
|
|
174
|
+
...(loadError !== undefined ? { loadError } : {}),
|
|
175
|
+
configsWritten: configsResult.written,
|
|
176
|
+
configsSkipped: configsResult.skipped,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export function uninstallDaemon(opts = {}) {
|
|
180
|
+
const result = {
|
|
181
|
+
plistRemoved: false,
|
|
182
|
+
bootoutOk: false,
|
|
183
|
+
configsCleaned: [],
|
|
184
|
+
};
|
|
185
|
+
const uid = process.getuid?.() ?? 501;
|
|
186
|
+
const domain = `gui/${uid}`;
|
|
187
|
+
try {
|
|
188
|
+
execFileSync("launchctl", ["bootout", `${domain}/${DAEMON_LABEL}`], { stdio: ["ignore", "pipe", "pipe"] });
|
|
189
|
+
result.bootoutOk = true;
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
result.bootoutError = err.stderr?.toString("utf8").trim() || err.message;
|
|
193
|
+
}
|
|
194
|
+
const plistPath = daemonPlistPath();
|
|
195
|
+
if (existsSync(plistPath)) {
|
|
196
|
+
try {
|
|
197
|
+
unlinkSync(plistPath);
|
|
198
|
+
result.plistRemoved = true;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
result.plistRemoved = false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Clear the daemon entries from Claude configs. If restoreStdio is set with
|
|
205
|
+
// url+token, swap back to the original stdio shape so the user doesn't lose
|
|
206
|
+
// the integration entirely; otherwise just remove.
|
|
207
|
+
const targets = claudeConfigTargets();
|
|
208
|
+
for (const target of targets) {
|
|
209
|
+
if (!existsSync(target.path)) {
|
|
210
|
+
result.configsCleaned.push({ path: target.path, removed: false });
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const cfg = readConfig(target.path);
|
|
214
|
+
if (!cfg?.mcpServers || !(MCP_NAME in cfg.mcpServers)) {
|
|
215
|
+
result.configsCleaned.push({ path: target.path, removed: false });
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
backupFile(target.path);
|
|
219
|
+
const next = { ...cfg.mcpServers };
|
|
220
|
+
if (opts.restoreStdio && opts.url && opts.token) {
|
|
221
|
+
next[MCP_NAME] = makeStdioEntry(opts.url, opts.token);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
delete next[MCP_NAME];
|
|
225
|
+
}
|
|
226
|
+
cfg.mcpServers = next;
|
|
227
|
+
writeFileSync(target.path, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
228
|
+
result.configsCleaned.push({ path: target.path, removed: true });
|
|
229
|
+
}
|
|
230
|
+
// Wipe the staged runtime — but leave .deployik/ state dir alone so audit
|
|
231
|
+
// history survives uninstall/reinstall cycles.
|
|
232
|
+
try {
|
|
233
|
+
rmSync(runtimeDir(), { recursive: true, force: true });
|
|
234
|
+
}
|
|
235
|
+
catch { /* ignore */ }
|
|
236
|
+
return result;
|
|
237
|
+
}
|
|
238
|
+
function renderPlist(opts) {
|
|
239
|
+
const envEntries = Object.entries(opts.env)
|
|
240
|
+
.map(([k, v]) => ` <key>${xmlEscape(k)}</key>\n <string>${xmlEscape(v)}</string>`)
|
|
241
|
+
.join("\n");
|
|
242
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
243
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
244
|
+
<plist version="1.0">
|
|
245
|
+
<dict>
|
|
246
|
+
<key>Label</key>
|
|
247
|
+
<string>${xmlEscape(opts.label)}</string>
|
|
248
|
+
<key>ProgramArguments</key>
|
|
249
|
+
<array>
|
|
250
|
+
<string>${xmlEscape(opts.nodePath)}</string>
|
|
251
|
+
<string>${xmlEscape(opts.daemonScript)}</string>
|
|
252
|
+
</array>
|
|
253
|
+
<key>EnvironmentVariables</key>
|
|
254
|
+
<dict>
|
|
255
|
+
${envEntries}
|
|
256
|
+
</dict>
|
|
257
|
+
<key>RunAtLoad</key>
|
|
258
|
+
<true/>
|
|
259
|
+
<key>KeepAlive</key>
|
|
260
|
+
<true/>
|
|
261
|
+
<key>ProcessType</key>
|
|
262
|
+
<string>Background</string>
|
|
263
|
+
<key>StandardOutPath</key>
|
|
264
|
+
<string>${xmlEscape(opts.stdoutPath)}</string>
|
|
265
|
+
<key>StandardErrorPath</key>
|
|
266
|
+
<string>${xmlEscape(opts.stderrPath)}</string>
|
|
267
|
+
</dict>
|
|
268
|
+
</plist>
|
|
269
|
+
`;
|
|
270
|
+
}
|
|
271
|
+
function xmlEscape(s) {
|
|
272
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
273
|
+
}
|
|
274
|
+
function resolveNodePath() {
|
|
275
|
+
// process.execPath is the absolute path to the currently-running node binary.
|
|
276
|
+
// launchd has a sparse PATH so we can't rely on "node" alone.
|
|
277
|
+
return process.execPath;
|
|
278
|
+
}
|
|
279
|
+
function isServiceLoaded(domain, label) {
|
|
280
|
+
// `launchctl print` exits non-zero when the service isn't in the domain.
|
|
281
|
+
try {
|
|
282
|
+
execFileSync("launchctl", ["print", `${domain}/${label}`], { stdio: "ignore" });
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function sleepSync(ms) {
|
|
290
|
+
// Block the event loop without burning CPU. Cleaner than an empty `while`
|
|
291
|
+
// spin loop, lighter than spawning `sleep`. SharedArrayBuffer + Atomics.wait
|
|
292
|
+
// is the canonical Node way to do this synchronously.
|
|
293
|
+
const i32 = new Int32Array(new SharedArrayBuffer(4));
|
|
294
|
+
Atomics.wait(i32, 0, 0, ms);
|
|
295
|
+
}
|
|
296
|
+
function makeStdioEntry(url, token) {
|
|
297
|
+
return {
|
|
298
|
+
type: "stdio",
|
|
299
|
+
command: "npx",
|
|
300
|
+
args: ["-y", "@lovinka/deployik-mcp"],
|
|
301
|
+
env: { DEPLOYIK_URL: url, DEPLOYIK_TOKEN: token },
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function makeHttpEntry(port) {
|
|
305
|
+
return {
|
|
306
|
+
type: "http",
|
|
307
|
+
url: `http://127.0.0.1:${port}/mcp`,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function claudeConfigTargets() {
|
|
311
|
+
const home = homedir();
|
|
312
|
+
const out = [
|
|
313
|
+
{ path: join(home, ".claude.json"), mustExistDir: false },
|
|
314
|
+
];
|
|
315
|
+
if (platform() === "darwin") {
|
|
316
|
+
out.push({
|
|
317
|
+
path: join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json"),
|
|
318
|
+
mustExistDir: true,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return out;
|
|
322
|
+
}
|
|
323
|
+
function readConfig(path) {
|
|
324
|
+
if (!existsSync(path))
|
|
325
|
+
return undefined;
|
|
326
|
+
try {
|
|
327
|
+
const raw = readFileSync(path, "utf8").trim();
|
|
328
|
+
if (!raw)
|
|
329
|
+
return {};
|
|
330
|
+
return JSON.parse(raw);
|
|
331
|
+
}
|
|
332
|
+
catch (err) {
|
|
333
|
+
throw new Error(`Failed to parse ${path}: ${err.message}`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function backupFile(path) {
|
|
337
|
+
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
338
|
+
const bak = `${path}.bak.${ts}`;
|
|
339
|
+
copyFileSync(path, bak);
|
|
340
|
+
return bak;
|
|
341
|
+
}
|
|
342
|
+
function rewriteClaudeConfigsForDaemon(port) {
|
|
343
|
+
const written = [];
|
|
344
|
+
const skipped = [];
|
|
345
|
+
for (const target of claudeConfigTargets()) {
|
|
346
|
+
if (target.mustExistDir && !existsSync(dirname(target.path))) {
|
|
347
|
+
skipped.push({ path: target.path, reason: "parent dir not found (Claude Desktop not installed?)" });
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
const existing = readConfig(target.path);
|
|
351
|
+
const created = !existsSync(target.path);
|
|
352
|
+
let backupPath;
|
|
353
|
+
if (existing && existsSync(target.path)) {
|
|
354
|
+
backupPath = backupFile(target.path);
|
|
355
|
+
}
|
|
356
|
+
const cfg = existing ?? {};
|
|
357
|
+
cfg.mcpServers = { ...(cfg.mcpServers ?? {}), [MCP_NAME]: makeHttpEntry(port) };
|
|
358
|
+
mkdirSync(dirname(target.path), { recursive: true });
|
|
359
|
+
writeFileSync(target.path, JSON.stringify(cfg, null, 2) + "\n", "utf8");
|
|
360
|
+
written.push({ path: target.path, created, ...(backupPath !== undefined ? { backupPath } : {}) });
|
|
361
|
+
}
|
|
362
|
+
return { written, skipped };
|
|
363
|
+
}
|
|
364
|
+
//# sourceMappingURL=install-daemon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-daemon.js","sourceRoot":"","sources":["../src/install-daemon.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,EAAE;AACF,qFAAqF;AACrF,4EAA4E;AAC5E,+DAA+D;AAC/D,sEAAsE;AACtE,+CAA+C;AAC/C,2DAA2D;AAC3D,0DAA0D;AAC1D,6DAA6D;AAC7D,qCAAqC;AACrC,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,8BAA8B;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,SAAS,EACT,YAAY,EACZ,MAAM,EACN,UAAU,EACV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AI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACpG,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { mkdirSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
2
5
|
import { DeployikClient } from "./client/http.js";
|
|
3
6
|
import { loadEnv } from "./config/env.js";
|
|
4
7
|
import { registerKnowledgePrompts } from "./knowledge/prompts.js";
|
|
5
8
|
import { registerAllTools } from "./tools/index.js";
|
|
6
9
|
import { VERSION } from "./version.js";
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
const DAEMON_HOME = join(homedir(), ".deployik-mcp");
|
|
11
|
+
export function buildServer(env = process.env, cwd = process.cwd(), options = {}) {
|
|
12
|
+
const mode = options.mode ?? "stdio";
|
|
13
|
+
// In http (daemon) mode the server runs detached from any repo. Pointing
|
|
14
|
+
// cwd at a daemon-owned dir keeps the binding/git-remote resolvers from
|
|
15
|
+
// silently misreading whatever directory launchd happened to start us in.
|
|
16
|
+
const effectiveCwd = mode === "http" ? ensureDaemonHome() : cwd;
|
|
17
|
+
const cfg = loadEnv(env, effectiveCwd);
|
|
9
18
|
const client = new DeployikClient({
|
|
10
19
|
baseUrl: cfg.baseUrl,
|
|
11
20
|
token: cfg.token,
|
|
@@ -25,9 +34,14 @@ export function buildServer(env = process.env, cwd = process.cwd()) {
|
|
|
25
34
|
client,
|
|
26
35
|
stateDir: cfg.stateDir,
|
|
27
36
|
cwd: cfg.cwd,
|
|
37
|
+
mode,
|
|
28
38
|
};
|
|
29
39
|
registerKnowledgePrompts(server);
|
|
30
40
|
registerAllTools(server, ctx);
|
|
31
41
|
return { server, ctx };
|
|
32
42
|
}
|
|
43
|
+
function ensureDaemonHome() {
|
|
44
|
+
mkdirSync(DAEMON_HOME, { recursive: true });
|
|
45
|
+
return DAEMON_HOME;
|
|
46
|
+
}
|
|
33
47
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,iBA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G,CAAC,CAAC;IAE9B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACzB,CAAC;AAED,SAAS,gBAAgB;IACvB,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_helpers.js","sourceRoot":"","sources":["../../src/tools/_helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAmB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"_helpers.js","sourceRoot":"","sources":["../../src/tools/_helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAmB,MAAM,oBAAoB,CAAC;AAsC1E,MAAM,UAAU,YAAY,CAC1B,MAAiB,EACjB,GAAgB,EAChB,GAAe;IAGf,MAAM,EAAE,GAAO,KAAK,EAAE,OAAO,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE,CAAmB,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC5C,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBACd,MAAM,KAAK,GAAe;oBACxB,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;oBAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,IAAI,EAAE,MAAM,CAAC,IAA+B,CAAC;oBAC7C,UAAU,EAAE,IAAI,CAAC,GAAG,E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