@codeconductorai/harmony-mcp 1.0.25 → 1.0.26

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 CHANGED
@@ -27,12 +27,12 @@ Re-run `node -v` afterwards to confirm before continuing.
27
27
 
28
28
  ## Installation
29
29
 
30
- The server is published as `@codeconductorai/harmony-mcp` and run via `npx`, so no local build step is required. The commands below pin an exact version (`@1.0.25`) rather than a floating tag — this lets `npx` reuse its local cache instead of re-resolving the package from the registry on every agent startup, which otherwise makes MCP initialization noticeably slower (and occasionally hang). Bump the pinned version deliberately when you want to upgrade.
30
+ The server is published as `@codeconductorai/harmony-mcp` and run via `npx`, so no local build step is required. The commands below pin an exact version (`@1.0.26`) rather than a floating tag — this lets `npx` reuse its local cache instead of re-resolving the package from the registry on every agent startup, which otherwise makes MCP initialization noticeably slower (and occasionally hang). Bump the pinned version deliberately when you want to upgrade.
31
31
 
32
32
  ### Claude Code
33
33
 
34
34
  ```bash
35
- claude mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.25
35
+ claude mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.26
36
36
  ```
37
37
 
38
38
  ### Antigravity
@@ -47,7 +47,7 @@ Open **MCP Servers → Manage MCP Servers → View raw config** from the agent p
47
47
  "mcpServers": {
48
48
  "harmony": {
49
49
  "command": "npx",
50
- "args": ["-y", "@codeconductorai/harmony-mcp@1.0.25"]
50
+ "args": ["-y", "@codeconductorai/harmony-mcp@1.0.26"]
51
51
  }
52
52
  }
53
53
  }
@@ -58,7 +58,7 @@ Restart Antigravity (or reload MCP servers) after saving.
58
58
  ### Codex CLI
59
59
 
60
60
  ```bash
61
- codex mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.25
61
+ codex mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.26
62
62
  ```
63
63
 
64
64
  This writes the entry to `~/.codex/config.toml`. To add it by hand instead:
@@ -66,7 +66,7 @@ This writes the entry to `~/.codex/config.toml`. To add it by hand instead:
66
66
  ```toml
67
67
  [mcp_servers.harmony]
68
68
  command = "npx"
69
- args = ["-y", "@codeconductorai/harmony-mcp@1.0.25"]
69
+ args = ["-y", "@codeconductorai/harmony-mcp@1.0.26"]
70
70
  ```
71
71
 
72
72
  ### Aria
@@ -78,7 +78,7 @@ In the Aria Code panel, click the settings icon → **MCP Servers**, then scroll
78
78
  "mcpServers": {
79
79
  "harmony": {
80
80
  "command": "npx",
81
- "args": ["-y", "@codeconductorai/harmony-mcp@1.0.25"]
81
+ "args": ["-y", "@codeconductorai/harmony-mcp@1.0.26"]
82
82
  }
83
83
  }
84
84
  }
@@ -95,7 +95,7 @@ Any client that reads a `command`/`args` style config (e.g. Claude Desktop's `cl
95
95
  "mcpServers": {
96
96
  "harmony": {
97
97
  "command": "npx",
98
- "args": ["-y", "@codeconductorai/harmony-mcp@1.0.25"]
98
+ "args": ["-y", "@codeconductorai/harmony-mcp@1.0.26"]
99
99
  }
100
100
  }
101
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeconductorai/harmony-mcp",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -5,7 +5,7 @@ import archiver from "archiver";
5
5
  import FormData from "form-data";
6
6
 
7
7
  import { log } from "./log.js";
8
- import { tracedFetch as fetch } from "./telemetry.js";
8
+ import { tracedFetch as fetch, getActiveTraceId } from "./telemetry.js";
9
9
  import {
10
10
  getSessionToken,
11
11
  getWorkspaceToken,
@@ -27,7 +27,7 @@ async function refreshWorkspaceToken(workspaceId, refreshToken) {
27
27
  });
28
28
  const body = await response.text();
29
29
  if (!response.ok) {
30
- throw new Error(`Workspace token refresh failed: ${response.status} ${body}`);
30
+ throw new Error(`Workspace token refresh failed: ${response.status} ${body}${traceSuffix()}`);
31
31
  }
32
32
  const newAccessToken = response.headers.get("x-workspace-token");
33
33
  if (!newAccessToken) {
@@ -60,6 +60,11 @@ async function authHeader(workspaceId) {
60
60
  return token ? { Authorization: `Bearer ${token}` } : {};
61
61
  }
62
62
 
63
+ function traceSuffix() {
64
+ const traceId = getActiveTraceId();
65
+ return traceId ? ` [traceId=${traceId}]` : "";
66
+ }
67
+
63
68
  // Zip the working directory, excluding whatever the backend's WorkspaceFileFilter would discard anyway.
64
69
  async function zipWorkspace() {
65
70
  const workspacePath = process.cwd();
@@ -103,7 +108,7 @@ export async function setupWorkspace(workspaceId, language, buildTool) {
103
108
  ? ` (${wwwAuthenticate})`
104
109
  : " (this deployment requires login — call the login tool first)"
105
110
  : "";
106
- throw new Error(`Setup failed: ${response.status} ${body}${hint}`);
111
+ throw new Error(`Setup failed: ${response.status} ${body}${hint}${traceSuffix()}`);
107
112
  }
108
113
  return {
109
114
  status: response.status,
@@ -119,7 +124,7 @@ export async function setupWorkspace(workspaceId, language, buildTool) {
119
124
  }
120
125
 
121
126
  // POST /api/v1/index/zip — upload a zipped snapshot of the workspace for full indexing.
122
- export async function uploadWorkspace(zipPath, workspaceId, language, buildTool, phase = "HEURISTICGRAPH") {
127
+ export async function uploadWorkspace(zipPath, workspaceId, language, buildTool, phase = "LEXICAL") {
123
128
  try {
124
129
  const form = new FormData();
125
130
 
@@ -149,7 +154,7 @@ export async function uploadWorkspace(zipPath, workspaceId, language, buildTool,
149
154
  log("Upload status:", response.status);
150
155
  log("Upload response:", body);
151
156
  if (!response.ok) {
152
- throw new Error(`Upload failed: ${response.status} ${body}`);
157
+ throw new Error(`Upload failed: ${response.status} ${body}${traceSuffix()}`);
153
158
  }
154
159
 
155
160
  return {
@@ -207,8 +212,8 @@ export async function ensureWorkspaceUploaded(language, buildTool) {
207
212
  }
208
213
 
209
214
  if (!marker.upload?.done || staleSnapshot) {
210
- // First-ever upload is LEXICAL; HEURISTICGRAPH follows via advanceToHeuristicGraphPhase.
211
- const phase = marker.upload?.done ? "HEURISTICGRAPH" : "LEXICAL";
215
+ // Indexing is lexical-only — no embedding/semantic pass on the backend.
216
+ const phase = "LEXICAL";
212
217
  const zipFile = await zipWorkspace();
213
218
  const result = await uploadWorkspace(zipFile, workspaceId, lang, tool, phase);
214
219
  marker.upload = { done: true, phase, status: result.status, response: result.response };
@@ -219,21 +224,6 @@ export async function ensureWorkspaceUploaded(language, buildTool) {
219
224
  return { resynced: staleSnapshot };
220
225
  }
221
226
 
222
- // Second pass, sent once LEXICAL reaches a terminal status. Callers fire this without awaiting it
223
- // so the initial request can complete as soon as LEXICAL is done — the phase flag flips
224
- // synchronously (before any await below) so a concurrent call can't re-trigger it in the meantime.
225
- export async function advanceToHeuristicGraphPhase(marker) {
226
- marker.upload = { ...marker.upload, phase: "HEURISTICGRAPH" };
227
- writeMarker(marker);
228
-
229
- const { workspaceId, language, buildTool } = marker;
230
- const zipFile = await zipWorkspace();
231
- const result = await uploadWorkspace(zipFile, workspaceId, language, buildTool, "HEURISTICGRAPH");
232
- marker.upload = { done: true, phase: "HEURISTICGRAPH", status: result.status, response: result.response };
233
- writeMarker(marker);
234
- return marker;
235
- }
236
-
237
227
  // Statuses that won't change on their own without a new upload — safe to stop polling at.
238
228
  const TERMINAL_STATUSES = new Set([
239
229
  "TEXT_AND_SYMBOLS_COMPLETE",
@@ -253,7 +243,7 @@ async function fetchWorkspaceStatus(workspaceId) {
253
243
  if (response.status === 404) return null;
254
244
  const body = await response.text();
255
245
  if (!response.ok) {
256
- throw new Error(`Workspace status request failed: ${response.status} ${body}`);
246
+ throw new Error(`Workspace status request failed: ${response.status} ${body}${traceSuffix()}`);
257
247
  }
258
248
  const match = body.match(/<status>([^<]+)<\/status>/i);
259
249
  return match ? match[1].trim() : null;
@@ -294,7 +284,7 @@ export async function pollWorkspaceStatus(workspaceId, { maxWaitMs = 120_000, in
294
284
  return lastStatus;
295
285
  }
296
286
 
297
- // Shared POST caller for the locate-symbol/search/find-files endpoints — same request/response shape.
287
+ // Shared POST caller for the context-search/locate-symbol/explain-symbol/explain-subsystem endpoints — same request/response shape.
298
288
  export async function callHarmonySearchEndpoint(endpointPath, args, workspaceId) {
299
289
  const prompt = args.prompt || args.query;
300
290
  if (!prompt) throw new Error("prompt is required.");
@@ -319,7 +309,7 @@ export async function callHarmonySearchEndpoint(endpointPath, args, workspaceId)
319
309
  });
320
310
  const body = await response.text();
321
311
  if (!response.ok) {
322
- throw new Error(`${endpointPath} request failed: ${response.status} ${body}`);
312
+ throw new Error(`${endpointPath} request failed: ${response.status} ${body}${traceSuffix()}`);
323
313
  }
324
314
  return body;
325
315
  }
@@ -352,33 +342,7 @@ export async function callHarmonyPathBetween(args, workspaceId) {
352
342
  });
353
343
  const body = await response.text();
354
344
  if (!response.ok) {
355
- throw new Error(`path-between request failed: ${response.status} ${body}`);
356
- }
357
- return body;
358
- }
359
-
360
- // POST /api/code-workspace/{workspaceId}/bundle — ranked XML context bundle for a prompt.
361
- export async function fetchContextBundle(workspaceId, prompt) {
362
- const requestBody = {
363
- workspaceId,
364
- prompt,
365
- workspaceMetadata: buildWorkspaceMetadata(workspaceId),
366
- };
367
-
368
- log("[bundle] Request body:", JSON.stringify(requestBody, null, 2));
369
-
370
- const response = await fetch(`${API_URL}/api/code-workspace/${workspaceId}/bundle`, {
371
- method: "POST",
372
- headers: {
373
- "Content-Type": "application/json",
374
- Accept: "application/xml",
375
- ...(await authHeader(workspaceId)),
376
- },
377
- body: JSON.stringify(requestBody),
378
- });
379
- const body = await response.text();
380
- if (!response.ok) {
381
- throw new Error(`Bundle request failed: ${response.status} ${body}`);
345
+ throw new Error(`path-between request failed: ${response.status} ${body}${traceSuffix()}`);
382
346
  }
383
347
  return body;
384
348
  }
@@ -395,15 +359,6 @@ export function annotateIfEmptyList(toolName, body) {
395
359
  `verify with local search (rg/grep) rather than concluding nothing exists.]`;
396
360
  }
397
361
 
398
- // FALLBACK_NATIVE_RECALL means the backend fell back to broad recall — flag it as approximate.
399
- export function annotateIfFallbackBundle(body) {
400
- if (!body.includes("FALLBACK_NATIVE_RECALL")) return body;
401
- return `${body}\n\n` +
402
- `[harmony-mcp note: this bundle used FALLBACK_NATIVE_RECALL — the backend did not resolve a ` +
403
- `high-signal call graph for this prompt, so the content above is broad/generic recall rather ` +
404
- `than a precisely targeted answer. Consider locate or context_search for a sharper result.]`;
405
- }
406
-
407
362
  // POST /api/v1/index/files — used by the file watcher for incremental updates.
408
363
  export async function sendFileUpdate(filePath, workspaceId, language, buildTool) {
409
364
  try {
@@ -420,7 +375,7 @@ export async function sendFileUpdate(filePath, workspaceId, language, buildTool)
420
375
  if (buildTool) {
421
376
  form.append("buildTool", buildTool);
422
377
  }
423
- form.append("phase", "HEURISTICGRAPH");
378
+ form.append("phase", "LEXICAL");
424
379
 
425
380
  // Field names must match @RequestPart("files") and @RequestParam("paths")
426
381
  form.append("files", fs.createReadStream(filePath), { filename: path.basename(filePath) });
@@ -434,7 +389,7 @@ export async function sendFileUpdate(filePath, workspaceId, language, buildTool)
434
389
  const body = await response.text();
435
390
  log(`[fileWatcher] ${path.relative(process.cwd(), filePath)} -> ${response.status}`);
436
391
  if (!response.ok) {
437
- log(`[fileWatcher] Index failed: ${body}`);
392
+ log(`[fileWatcher] Index failed: ${body}${traceSuffix()}`);
438
393
  }
439
394
  } catch (error) {
440
395
  log(`[fileWatcher] Error sending file update:`, error.message);
package/src/server.js CHANGED
@@ -22,15 +22,10 @@ import { readMarker, writeMarker } from "./workspaceMarker.js";
22
22
  import { startFileWatcher, isFileWatcherActive } from "./fileWatcher.js";
23
23
  import {
24
24
  ensureWorkspaceUploaded,
25
- advanceToHeuristicGraphPhase,
26
- isTerminalIndexStatus,
27
- isFailedIndexStatus,
28
25
  pollWorkspaceStatus,
29
26
  callHarmonySearchEndpoint,
30
27
  callHarmonyPathBetween,
31
- fetchContextBundle,
32
28
  annotateIfEmptyList,
33
- annotateIfFallbackBundle,
34
29
  } from "./harmonyClient.js";
35
30
  import { buildServerInstructions } from "./serverInstructions.js";
36
31
  import { TOOLS } from "./toolSchemas.js";
@@ -186,21 +181,6 @@ function describeIndexOutcome(indexStatus, workspaceId) {
186
181
  };
187
182
  }
188
183
 
189
- // Once LEXICAL reaches a terminal status, kick off HEURISTICGRAPH in the background — the current
190
- // call returns on the LEXICAL result rather than waiting on it. Gated on marker.upload.phase, so
191
- // this fires only once per workspace.
192
- async function maybeAdvanceToHeuristicPhase(marker, indexStatus, { extra }) {
193
- if (!marker || marker.upload?.phase !== "LEXICAL") return indexStatus;
194
- if (!isTerminalIndexStatus(indexStatus) || isFailedIndexStatus(indexStatus)) return indexStatus;
195
-
196
- // TEMP: HEURISTICGRAPH follow-up disabled — uncomment to restore the parallel background pass.
197
- // await sendProgress(extra, `Lexical indexing complete for "${getProjectName()}" — heuristic graph indexing started in the background.`);
198
- // advanceToHeuristicGraphPhase(marker).catch((error) =>
199
- // log(`[setup_workspace] Heuristic graph phase failed: ${error.message}`)
200
- // );
201
- return indexStatus;
202
- }
203
-
204
184
  async function handleSetupWorkspace(args, extra) {
205
185
  const { language, buildTool } = args;
206
186
  const startedAt = Date.now();
@@ -223,7 +203,6 @@ async function handleSetupWorkspace(args, extra) {
223
203
  maxWaitMs: Math.min(15_000, remainingBudgetMs()),
224
204
  onTick: onPollTick,
225
205
  });
226
- indexStatus = await maybeAdvanceToHeuristicPhase(existingMarker, indexStatus, { extra });
227
206
  persistIndexStatus(existingMarker, indexStatus);
228
207
  const outcome = describeIndexOutcome(indexStatus, existingMarker.workspaceId);
229
208
  return jsonContent({
@@ -264,7 +243,6 @@ async function handleSetupWorkspace(args, extra) {
264
243
  maxWaitMs: remainingBudgetMs(),
265
244
  onTick: onPollTick,
266
245
  });
267
- indexStatus = await maybeAdvanceToHeuristicPhase(marker, indexStatus, { extra });
268
246
  persistIndexStatus(marker, indexStatus);
269
247
  const outcome = describeIndexOutcome(indexStatus, marker?.workspaceId);
270
248
 
@@ -288,15 +266,6 @@ async function handleSetupWorkspace(args, extra) {
288
266
  });
289
267
  }
290
268
 
291
- async function handleGetContextBundle(args) {
292
- const workspaceId = resolveWorkspaceId(args);
293
- const prompt = args.prompt || args.query;
294
- if (!prompt) throw new Error("prompt is required.");
295
-
296
- const body = await fetchContextBundle(workspaceId, prompt);
297
- return textContent(annotateIfFallbackBundle(body));
298
- }
299
-
300
269
  function makeSearchHandler(endpointPath, toolName) {
301
270
  return async (args) => {
302
271
  const workspaceId = resolveWorkspaceId(args);
@@ -315,11 +284,8 @@ const TOOL_HANDLERS = {
315
284
  login: handleLogin,
316
285
  confirm_login: handleConfirmLogin,
317
286
  setup_workspace: handleSetupWorkspace,
318
- get_context_bundle: handleGetContextBundle,
319
287
  context_search: makeSearchHandler("context-search", "context_search"),
320
288
  locate: makeSearchHandler("locate-symbol", "locate"),
321
- search_code_context: makeSearchHandler("search", "search_code_context"),
322
- find_files: makeSearchHandler("find-files", "find_files"),
323
289
  explain_symbol: makeSearchHandler("explain-symbol", "explain_symbol"),
324
290
  path_between: handlePathBetween,
325
291
  explain_subsystem: makeSearchHandler("explain-subsystem", "explain_subsystem"),
package/src/telemetry.js CHANGED
@@ -119,13 +119,17 @@ export async function tracedFetch(url, options = {}) {
119
119
  return url;
120
120
  }
121
121
  })();
122
- span.setAttribute("http.request.method", options.method || "GET");
122
+ const method = options.method || "GET";
123
+ const traceId = getActiveTraceId();
124
+ span.setAttribute("http.request.method", method);
123
125
  span.setAttribute("url.full", url);
124
- log(`[telemetry] trace id ${getActiveTraceId()} for ${options.method || "GET"} ${path}`);
126
+ log(`[telemetry] trace id ${traceId} for ${method} ${path}`);
125
127
  const startedAt = Date.now();
126
128
  try {
127
129
  const response = await fetch(url, { ...options, headers: injectTraceHeaders(options.headers || {}) });
128
130
  span.setAttribute("http.response.status_code", response.status);
131
+ log(`[telemetry] trace id ${traceId} for ${method} ${path} -> ${response.status}` +
132
+ (response.ok ? "" : " (backend X-Trace-Id: " + (response.headers.get("x-trace-id") || "none") + ")"));
129
133
  if (!response.ok) {
130
134
  span.setStatus({ code: SpanStatusCode.ERROR, message: `HTTP ${response.status}` });
131
135
  backendRequestErrors.add(1, { "url.path": path, "http.response.status_code": response.status });
@@ -135,6 +139,7 @@ export async function tracedFetch(url, options = {}) {
135
139
  span.recordException(error);
136
140
  span.setStatus({ code: SpanStatusCode.ERROR, message: error?.message });
137
141
  backendRequestErrors.add(1, { "url.path": path });
142
+ log(`[telemetry] trace id ${traceId} for ${method} ${path} -> request error: ${error?.message}`);
138
143
  throw error;
139
144
  } finally {
140
145
  backendRequestDuration.record(Date.now() - startedAt, { "url.path": path });
@@ -8,8 +8,6 @@ const WORKSPACE_ID_PROPERTY = {
8
8
  };
9
9
 
10
10
  export const TOOLS = [
11
- // TEMP: get_context_bundle, search_code_context, and find_files are disabled below — uncomment
12
- // those blocks to restore the full tool set.
13
11
  {
14
12
  name: "login",
15
13
  description:
@@ -122,27 +120,6 @@ export const TOOLS = [
122
120
  required: ["prompt"],
123
121
  },
124
122
  },
125
- /*
126
- {
127
- name: "get_context_bundle",
128
- description:
129
- "Retrieve a coding context bundle for a prompt from the backend. Returns XML context. If reached " +
130
- "as a fallback after context_search came up short, build this prompt from the user's original " +
131
- "query plus the symbols/identifiers/file paths context_search's response already surfaced, rather " +
132
- "than resending the raw query unchanged.",
133
- inputSchema: {
134
- type: "object",
135
- properties: {
136
- prompt: {
137
- type: "string",
138
- description: "The natural language instruction or question to retrieve context for.",
139
- },
140
- workspaceId: WORKSPACE_ID_PROPERTY,
141
- },
142
- required: ["prompt"],
143
- },
144
- },
145
- */
146
123
  {
147
124
  name: "locate",
148
125
  description:
@@ -187,35 +164,6 @@ export const TOOLS = [
187
164
  required: ["prompt"],
188
165
  },
189
166
  },
190
- /* {
191
- name: "search_code_context",
192
- description:
193
- "Given a natural language query, returns rich Q&A context: matching symbols along with their code " +
194
- "snippets, documentation, and decorators. Use this when you need to understand or explain how " +
195
- "something works, not when you're about to make a targeted edit (use locate for that). If reached " +
196
- "as a fallback after context_search came up short, fold the symbols/identifiers/file paths from " +
197
- "context_search's response together with the user's original query into this prompt.",
198
- inputSchema: {
199
- type: "object",
200
- properties: {
201
- prompt: {
202
- type: "string",
203
- description: "Natural language query describing what to find context for or unique identifier describing what to search (e.g. CrudController).",
204
- },
205
- file_path: {
206
- type: "string",
207
- description: "Optional path substring to restrict results to a subdirectory, module, or specific file.",
208
- },
209
- limit: {
210
- type: "number",
211
- description: "Maximum number of results to return (default 15).",
212
- },
213
- workspaceId: WORKSPACE_ID_PROPERTY,
214
- },
215
- required: ["prompt"],
216
- },
217
- },
218
- */
219
167
  {
220
168
  name: "explain_symbol",
221
169
  description:
@@ -306,34 +254,4 @@ export const TOOLS = [
306
254
  required: ["prompt"],
307
255
  },
308
256
  },
309
- /*
310
- {
311
- name: "find_files",
312
- description:
313
- "Given a natural language query, returns lightweight file path and architectural role/tag matches — " +
314
- "no symbols or code content. Use this for broad file/module discovery (e.g. \"find all the " +
315
- "controllers\") rather than pinpointing a specific edit location. If reached as a fallback after " +
316
- "context_search came up short, incorporate any relevant file paths/modules context_search already " +
317
- "surfaced along with the user's original query when composing this prompt.",
318
- inputSchema: {
319
- type: "object",
320
- properties: {
321
- prompt: {
322
- type: "string",
323
- description: "Natural language query describing the kind of file to find.",
324
- },
325
- file_path: {
326
- type: "string",
327
- description: "Optional path substring to restrict results to a subdirectory, module, or specific file.",
328
- },
329
- limit: {
330
- type: "number",
331
- description: "Maximum number of results to return (default 30).",
332
- },
333
- workspaceId: WORKSPACE_ID_PROPERTY,
334
- },
335
- required: ["prompt"],
336
- },
337
- },
338
- */
339
257
  ];