fathom-mcp 0.5.17 → 0.5.18
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/package.json +1 -1
- package/src/cli.js +25 -6
- package/src/server-client.js +12 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -576,17 +576,36 @@ async function runInit(flags = {}) {
|
|
|
576
576
|
appendToGitignore(cwd, [".fathom.json"]);
|
|
577
577
|
console.log(" ✓ .gitignore");
|
|
578
578
|
|
|
579
|
-
// Register with server
|
|
579
|
+
// Register with server — use provision endpoint to get API key + create settings.json entry
|
|
580
580
|
if (serverReachable) {
|
|
581
|
-
const
|
|
581
|
+
const provResult = await regClient.provisionWorkspace(workspace, cwd, {
|
|
582
582
|
vault,
|
|
583
583
|
agents: selectedAgents,
|
|
584
|
-
type:
|
|
584
|
+
type: vaultMode,
|
|
585
|
+
execution: "local",
|
|
585
586
|
});
|
|
586
|
-
if (
|
|
587
|
+
if (provResult.ok) {
|
|
587
588
|
console.log(` ✓ Registered workspace "${workspace}" with server`);
|
|
588
|
-
|
|
589
|
-
|
|
589
|
+
// Use the server-provisioned API key (overwrites any manually entered one)
|
|
590
|
+
if (provResult.api_key) {
|
|
591
|
+
apiKey = provResult.api_key;
|
|
592
|
+
configData.apiKey = apiKey;
|
|
593
|
+
writeConfig(cwd, configData);
|
|
594
|
+
console.log(` ✓ API key provisioned by server`);
|
|
595
|
+
}
|
|
596
|
+
} else if (provResult.error) {
|
|
597
|
+
console.log(` · Server registration: ${provResult.error}`);
|
|
598
|
+
// Fall back to old registration endpoint (server may be older version)
|
|
599
|
+
const regResult = await regClient.registerWorkspace(workspace, cwd, {
|
|
600
|
+
vault,
|
|
601
|
+
agents: selectedAgents,
|
|
602
|
+
type: vaultMode,
|
|
603
|
+
});
|
|
604
|
+
if (regResult.ok) {
|
|
605
|
+
console.log(` ✓ Registered workspace "${workspace}" with server (legacy)`);
|
|
606
|
+
} else if (regResult.error) {
|
|
607
|
+
console.log(` · Server registration: ${regResult.error}`);
|
|
608
|
+
}
|
|
590
609
|
}
|
|
591
610
|
}
|
|
592
611
|
|
package/src/server-client.js
CHANGED
|
@@ -129,6 +129,17 @@ export function createClient(config) {
|
|
|
129
129
|
return request("POST", "/api/workspaces", { body });
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
async function provisionWorkspace(name, projectPath, { vault, description, agents, type, execution, ssh } = {}) {
|
|
133
|
+
const body = { name, path: projectPath };
|
|
134
|
+
if (vault) body.vault = vault;
|
|
135
|
+
if (description) body.description = description;
|
|
136
|
+
if (agents && agents.length > 0) body.agents = agents;
|
|
137
|
+
if (type) body.type = type;
|
|
138
|
+
if (execution) body.execution = execution;
|
|
139
|
+
if (ssh) body.ssh = ssh;
|
|
140
|
+
return request("POST", "/api/workspaces/provision", { body });
|
|
141
|
+
}
|
|
142
|
+
|
|
132
143
|
// --- Access tracking -------------------------------------------------------
|
|
133
144
|
|
|
134
145
|
async function notifyAccess(filePath, ws) {
|
|
@@ -345,6 +356,7 @@ export function createClient(config) {
|
|
|
345
356
|
sendToWorkspace,
|
|
346
357
|
listWorkspaces,
|
|
347
358
|
registerWorkspace,
|
|
359
|
+
provisionWorkspace,
|
|
348
360
|
notifyAccess,
|
|
349
361
|
vaultList,
|
|
350
362
|
vaultFolder,
|