fathom-mcp 0.1.3 → 0.1.4
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/CHANGELOG.md +0 -0
- package/package.json +1 -1
- package/src/cli.js +9 -25
- package/src/config.js +6 -0
- package/src/index.js +8 -0
- package/src/server-client.js +5 -4
package/CHANGELOG.md
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -139,33 +139,16 @@ async function runInit() {
|
|
|
139
139
|
// 2. Vault subdirectory
|
|
140
140
|
const vault = await ask(rl, " Vault subdirectory", "vault");
|
|
141
141
|
|
|
142
|
-
// 3.
|
|
142
|
+
// 3. Description (optional)
|
|
143
|
+
const description = await ask(rl, " Workspace description (optional)", "");
|
|
144
|
+
|
|
145
|
+
// 4. Server URL
|
|
143
146
|
const serverUrl = await ask(rl, " Fathom server URL", "http://localhost:4243");
|
|
144
147
|
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
const tryFetch = await askYesNo(rl, " Fetch API key from server?", true);
|
|
148
|
-
if (tryFetch) {
|
|
149
|
-
console.log(" Connecting to server...");
|
|
150
|
-
const tmpClient = createClient({ server: serverUrl, apiKey: "", workspace });
|
|
151
|
-
const isUp = await tmpClient.healthCheck();
|
|
152
|
-
if (isUp) {
|
|
153
|
-
const keyResp = await tmpClient.getApiKey();
|
|
154
|
-
if (keyResp.api_key) {
|
|
155
|
-
apiKey = keyResp.api_key;
|
|
156
|
-
console.log(` Got API key: ${apiKey.slice(0, 7)}...${apiKey.slice(-4)}`);
|
|
157
|
-
} else {
|
|
158
|
-
console.log(" Could not fetch key (auth may not be configured yet).");
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
console.log(" Server not reachable. You can add the API key to .fathom.json later.");
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
if (!apiKey) {
|
|
165
|
-
apiKey = await ask(rl, " API key (or leave blank)", "");
|
|
166
|
-
}
|
|
148
|
+
// 5. API key — user gets this from the dashboard or server first-run output
|
|
149
|
+
const apiKey = await ask(rl, " API key (from dashboard or server first-run output)", "");
|
|
167
150
|
|
|
168
|
-
//
|
|
151
|
+
// 6. Hooks
|
|
169
152
|
const enableRecallHook = await askYesNo(rl, " Enable vault recall on every message (UserPromptSubmit)?", true);
|
|
170
153
|
const enablePrecompactHook = await askYesNo(rl, " Enable PreCompact vault snapshot hook?", true);
|
|
171
154
|
|
|
@@ -181,6 +164,7 @@ async function runInit() {
|
|
|
181
164
|
vault,
|
|
182
165
|
server: serverUrl,
|
|
183
166
|
apiKey,
|
|
167
|
+
description,
|
|
184
168
|
hooks: {
|
|
185
169
|
"vault-recall": { enabled: enableRecallHook },
|
|
186
170
|
"precompact-snapshot": { enabled: enablePrecompactHook },
|
|
@@ -270,7 +254,7 @@ async function runInit() {
|
|
|
270
254
|
const regClient = createClient({ server: serverUrl, apiKey, workspace });
|
|
271
255
|
const isUp = await regClient.healthCheck();
|
|
272
256
|
if (isUp) {
|
|
273
|
-
const regResult = await regClient.registerWorkspace(workspace, cwd);
|
|
257
|
+
const regResult = await regClient.registerWorkspace(workspace, cwd, { vault, description });
|
|
274
258
|
if (regResult.ok) {
|
|
275
259
|
console.log(` ✓ Registered workspace "${workspace}" with server`);
|
|
276
260
|
} else if (regResult.error) {
|
package/src/config.js
CHANGED
|
@@ -17,6 +17,7 @@ const DEFAULTS = {
|
|
|
17
17
|
vault: "vault",
|
|
18
18
|
server: "http://localhost:4243",
|
|
19
19
|
apiKey: "",
|
|
20
|
+
description: "",
|
|
20
21
|
hooks: {
|
|
21
22
|
"context-inject": { enabled: true },
|
|
22
23
|
"precompact-snapshot": { enabled: true },
|
|
@@ -65,6 +66,7 @@ export function resolveConfig(startDir = process.cwd()) {
|
|
|
65
66
|
if (config.vault) result.vault = config.vault;
|
|
66
67
|
if (config.server) result.server = config.server;
|
|
67
68
|
if (config.apiKey) result.apiKey = config.apiKey;
|
|
69
|
+
if (config.description) result.description = config.description;
|
|
68
70
|
if (config.hooks) {
|
|
69
71
|
result.hooks = { ...result.hooks, ...config.hooks };
|
|
70
72
|
}
|
|
@@ -81,6 +83,9 @@ export function resolveConfig(startDir = process.cwd()) {
|
|
|
81
83
|
result.workspace = path.basename(projectDir);
|
|
82
84
|
}
|
|
83
85
|
|
|
86
|
+
// Preserve raw vault name before resolving to absolute (for registration)
|
|
87
|
+
result._rawVault = result.vault;
|
|
88
|
+
|
|
84
89
|
// Resolve vault to absolute path
|
|
85
90
|
if (!path.isAbsolute(result.vault)) {
|
|
86
91
|
result.vault = path.join(projectDir, result.vault);
|
|
@@ -105,6 +110,7 @@ export function writeConfig(dir, config) {
|
|
|
105
110
|
vault: config.vault || "vault",
|
|
106
111
|
server: config.server || DEFAULTS.server,
|
|
107
112
|
apiKey: config.apiKey || "",
|
|
113
|
+
description: config.description || "",
|
|
108
114
|
hooks: config.hooks || DEFAULTS.hooks,
|
|
109
115
|
};
|
|
110
116
|
fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
package/src/index.js
CHANGED
|
@@ -453,6 +453,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
453
453
|
});
|
|
454
454
|
|
|
455
455
|
async function main() {
|
|
456
|
+
// Auto-register workspace with server (fire-and-forget)
|
|
457
|
+
if (config.server && config.workspace) {
|
|
458
|
+
client.registerWorkspace(config.workspace, config._projectDir, {
|
|
459
|
+
vault: config._rawVault,
|
|
460
|
+
description: config.description,
|
|
461
|
+
}).catch(() => {});
|
|
462
|
+
}
|
|
463
|
+
|
|
456
464
|
const transport = new StdioServerTransport();
|
|
457
465
|
await server.connect(transport);
|
|
458
466
|
}
|
package/src/server-client.js
CHANGED
|
@@ -104,10 +104,11 @@ export function createClient(config) {
|
|
|
104
104
|
return request("GET", "/api/workspaces/profiles");
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
async function registerWorkspace(name, projectPath) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
async function registerWorkspace(name, projectPath, { vault, description } = {}) {
|
|
108
|
+
const body = { name, path: projectPath };
|
|
109
|
+
if (vault) body.vault = vault;
|
|
110
|
+
if (description) body.description = description;
|
|
111
|
+
return request("POST", "/api/workspaces", { body });
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
// --- Access tracking -------------------------------------------------------
|