@codeconductorai/harmony-mcp 1.0.13 → 1.0.14
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 +9 -43
- package/package.json +1 -1
- package/src/deviceAuth.js +1 -1
- package/src/harmonyClient.js +1 -1
- package/src/serverInstructions.js +78 -3
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.
|
|
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.14`) 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.
|
|
35
|
+
claude mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.14
|
|
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.
|
|
50
|
+
"args": ["-y", "@codeconductorai/harmony-mcp@1.0.14"]
|
|
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.
|
|
61
|
+
codex mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.14
|
|
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.
|
|
69
|
+
args = ["-y", "@codeconductorai/harmony-mcp@1.0.14"]
|
|
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.
|
|
81
|
+
"args": ["-y", "@codeconductorai/harmony-mcp@1.0.14"]
|
|
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.
|
|
98
|
+
"args": ["-y", "@codeconductorai/harmony-mcp@1.0.14"]
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -108,7 +108,7 @@ After adding the server and restarting your client:
|
|
|
108
108
|
1. **`login`** — starts a device-flow login and returns a URL to open in your browser.
|
|
109
109
|
2. Finish logging in, then tell the agent you're done so it can call **`confirm_login`** to complete authentication. The session is cached at `~/.harmony-mcp/session.json`, so you won't need to log in again until it expires.
|
|
110
110
|
3. **`setup_workspace`** — registers the current project (`language` and `buildTool` required the first time) and fully indexes it (zips and uploads the codebase) in one call. It's idempotent, so calling it again once setup and indexing have completed is a cheap no-op; if it fails partway, calling it again retries just the incomplete step. Once indexing succeeds, a background file watcher pushes incremental updates to the backend as you edit files.
|
|
111
|
-
4. Use **`context_search`** first to pull relevant code context for a prompt — it's Harmony's newest, best-ranked search endpoint, always available as the default entry point for every discovery need in a task, and takes precedence over the others below. Fall back to **`locate`**, **`search_code_context`**, **`
|
|
111
|
+
4. Use **`context_search`** first to pull relevant code context for a prompt — it's Harmony's newest, best-ranked search endpoint, always available as the default entry point for every discovery need in a task, and takes precedence over the others below. Fall back to **`locate`**, **`search_code_context`**, **`find_files`**, or **`get_context_bundle`** only if it comes up short or you need one of their specialized output shapes — and when you do, feed the fallback tool a combination of the user's original query and the symbols/identifiers/file paths `context_search` already surfaced, not the raw query on its own.
|
|
112
112
|
|
|
113
113
|
Workspace state (workspace ID, language, build tool, setup/upload status) is cached in a `.harmony_workspace.json` marker file in the project root.
|
|
114
114
|
|
|
@@ -129,13 +129,8 @@ Registers the current project as a workspace on the backend and fully indexes it
|
|
|
129
129
|
Every workspace is tagged with a scheme-aware `repoId`, surfaced in the response as `repoId`/`repoIdScheme`: `git_url:<host/org/repo>` (normalized origin remote URL — the common case), falling back to `git_commit:<root sha>` (Git repo with no remote), `artifact:<ecosystem>:<name>` (no `.git` at all — read from `pom.xml`/`package.json`/`go.mod`/`Cargo.toml`/`pyproject.toml`), or `dir:<folder name>` as a last resort.
|
|
130
130
|
|
|
131
131
|
### `get_context_bundle`
|
|
132
|
-
Retrieves a ranked XML context bundle of the most relevant code for a prompt,
|
|
133
|
-
(non-LLM) `guidance` (requirement facets, edit/inspect/test targets, risk checks, suggested verification
|
|
134
|
-
commands), a locally-counted token `budget` (with truncation applied if the ranked results exceed it),
|
|
135
|
-
an `index_state` snapshot (indexed file/symbol/relation counts and last-indexed time), and any
|
|
136
|
-
`memories` recorded for the given `taskId`.
|
|
132
|
+
Retrieves a ranked XML context bundle of the most relevant code for a prompt — broader contextual understanding for a task or question, not a specific edit location.
|
|
137
133
|
- `prompt` (required): natural-language question or instruction.
|
|
138
|
-
- `taskId` (optional): pass the same `taskId` used with `remember_task_state` to include those memories.
|
|
139
134
|
- `workspaceId` (optional): target a specific workspace instead of the local project's. Defaults to the local `setup_workspace` workspace.
|
|
140
135
|
|
|
141
136
|
### `context_search`
|
|
@@ -175,35 +170,6 @@ Given a natural-language query, returns lightweight file path and architectural
|
|
|
175
170
|
- `limit` (optional): max results (default 30).
|
|
176
171
|
- `workspaceId` (optional): target a specific workspace instead of the local project's. Defaults to the local `setup_workspace` workspace.
|
|
177
172
|
|
|
178
|
-
### `get_symbol_context`
|
|
179
|
-
Like `search_code_context`, but each matched symbol's file is also enriched with one-hop import
|
|
180
|
-
relationships and probable test files, derived from the backend's file-relationship graph (import
|
|
181
|
-
edges, mirrored test-path naming, bounded git co-change). Prefer this over `search_code_context` when
|
|
182
|
-
you're about to edit and need to know what else touches the file.
|
|
183
|
-
- `prompt` (required): natural-language query or unique identifier to find context for.
|
|
184
|
-
- `file_path` (optional): path substring to restrict results to a subdirectory, module, or specific file.
|
|
185
|
-
- `limit` (optional): max results (default 10).
|
|
186
|
-
- `workspaceId` (optional): target a specific workspace instead of the local project's. Defaults to the local `setup_workspace` workspace.
|
|
187
|
-
|
|
188
|
-
### `find_related_tests`
|
|
189
|
-
Given a file path, returns test files related to it via mirrored test-path naming (e.g.
|
|
190
|
-
`src/foo.py` ↔ `tests/test_foo.py`) or bounded git co-change history, falling back to a lexical
|
|
191
|
-
`primary_role: test` search when the workspace has no relationship-graph edges for it yet (e.g. right
|
|
192
|
-
after a fresh index). Unlike the other search tools, this takes `file_path`, not a natural-language `prompt`.
|
|
193
|
-
- `file_path` (required): the file (or a substring uniquely identifying it) to find related tests for.
|
|
194
|
-
- `limit` (optional): max results (default 10).
|
|
195
|
-
- `workspaceId` (optional): target a specific workspace instead of the local project's. Defaults to the local `setup_workspace` workspace.
|
|
196
|
-
|
|
197
|
-
### `remember_task_state`
|
|
198
|
-
Records an explicit fact, decision, todo, or warning against a `taskId`, optionally with `evidence`
|
|
199
|
-
(`path:line` references). Recalled later via `get_context_bundle`'s `taskId` parameter — this does not
|
|
200
|
-
affect search/locate ranking directly, it's recall-on-demand within the same task.
|
|
201
|
-
- `taskId` (required): identifier grouping this memory with others from the same task/session.
|
|
202
|
-
- `content` (required): the memory itself, in plain language.
|
|
203
|
-
- `memoryType` (optional): one of `fact`, `decision`, `todo`, `warning` (default `fact`).
|
|
204
|
-
- `evidence` (optional): array of `path:line` references supporting this memory.
|
|
205
|
-
- `workspaceId` (optional): target a specific workspace instead of the local project's. Defaults to the local `setup_workspace` workspace.
|
|
206
|
-
|
|
207
173
|
## Local development
|
|
208
174
|
|
|
209
175
|
```bash
|
package/package.json
CHANGED
package/src/deviceAuth.js
CHANGED
|
@@ -5,7 +5,7 @@ import path from "path";
|
|
|
5
5
|
|
|
6
6
|
import { log } from "./log.js";
|
|
7
7
|
|
|
8
|
-
const API_URL = (process.env.API_URL || "https://
|
|
8
|
+
const API_URL = (process.env.API_URL || "https://expenditure-advertisements-necessary-indianapolis.trycloudflare.com/").replace(/\/+$/, "");
|
|
9
9
|
|
|
10
10
|
let userToken = null;
|
|
11
11
|
let userTokenExpiresAt = 0;
|
package/src/harmonyClient.js
CHANGED
|
@@ -12,7 +12,7 @@ import { readMarker, writeMarker } from "./workspaceMarker.js";
|
|
|
12
12
|
import { getGitCommitHash } from "./repoIdentity.js";
|
|
13
13
|
import { buildZipIgnoreGlobs } from "./fileFilters.js";
|
|
14
14
|
|
|
15
|
-
export const API_URL = (process.env.API_URL || "https://
|
|
15
|
+
export const API_URL = (process.env.API_URL || "https://expenditure-advertisements-necessary-indianapolis.trycloudflare.com/").replace(/\/+$/, "");
|
|
16
16
|
|
|
17
17
|
// Zip the working directory, excluding whatever the backend's WorkspaceFileFilter would discard anyway.
|
|
18
18
|
async function zipWorkspace() {
|
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
import { isLoggedIn } from "./deviceAuth.js";
|
|
2
2
|
import { readMarker } from "./workspaceMarker.js";
|
|
3
3
|
|
|
4
|
+
const QUERY_REFINEMENT = `
|
|
5
|
+
Query refinement — before calling context_search, locate, search_code_context, or find_files, judge
|
|
6
|
+
whether the user's own wording is already a specific enough \`prompt\`. Skip this whole section for
|
|
7
|
+
requests that already name a concrete symbol/class/method/route/file ("find CrudController",
|
|
8
|
+
"where is POST /api/v1/index/zip handled") — pass those straight through unchanged. Only vague or
|
|
9
|
+
generic requests ("show all controllers", "how does auth work", "find the retry stuff") need
|
|
10
|
+
refinement, following these steps in order:
|
|
11
|
+
1. Extract identifiers — scan the user's wording for anything that is or implies a concrete symbol,
|
|
12
|
+
class, method, route, file, or directory name (proper nouns, CamelCase/snake_case tokens, path
|
|
13
|
+
fragments, HTTP verbs+paths). If something concrete is already there, use it verbatim as (or
|
|
14
|
+
folded into) the \`prompt\` — don't paraphrase a specific identifier into vaguer prose.
|
|
15
|
+
2. Expand generic asks — when the request names a category rather than an identifier (e.g. "all
|
|
16
|
+
controllers", "the validation logic", "error handling"), broaden the \`prompt\` with the
|
|
17
|
+
language/framework-idiomatic markers for that category (e.g. \`@Controller\`/\`@RestController\`
|
|
18
|
+
for controllers in a Java/Spring project, \`router.\`/\`app.\` handlers for an Express project,
|
|
19
|
+
\`class .*Service\` for service-layer code) — infer the right markers from this project's actual
|
|
20
|
+
language/stack, don't assume one stack across projects. If more than one marker plausibly applies
|
|
21
|
+
(e.g. both \`@Controller\` and \`@RestController\` are in play), fire a query per marker in
|
|
22
|
+
parallel rather than guessing a single one — see Efficiency's parallel fan-out rule below.
|
|
23
|
+
3. Suggest a file_path scope — if the extracted terms imply a likely directory or module (e.g.
|
|
24
|
+
"controllers" → \`src/controllers\` or \`src/main/java/.../controller\`), pass it as the tool's
|
|
25
|
+
\`file_path\` filter, but only when you have reasonable evidence for it (e.g. it matches this
|
|
26
|
+
project's known layout from an earlier result) — never guess a path with no basis, since
|
|
27
|
+
\`file_path\` is a strict substring filter that silently returns nothing on a wrong guess.
|
|
28
|
+
4. Fallback on emptiness — if nothing concrete can be extracted at all, issue one broad \`prompt\`
|
|
29
|
+
call first (the user's wording as-is, no invented keywords), then use whatever symbols/paths that
|
|
30
|
+
result surfaces to build a sharper, targeted follow-up call — the same "sharpen with what you
|
|
31
|
+
found" pattern used for context_search → narrower-tool fallbacks below. Never invent identifiers
|
|
32
|
+
that didn't come from the user's wording or a prior tool result.
|
|
33
|
+
5. Ask, don't guess, when still ambiguous — if after the above the request could reasonably mean
|
|
34
|
+
several distinct things (e.g. "controllers" could mean REST controllers or MVC view controllers
|
|
35
|
+
in this codebase), briefly ask the user to pick or confirm rather than silently picking one and
|
|
36
|
+
running with it. Don't ask for clarification on requests that are merely broad but unambiguous
|
|
37
|
+
(e.g. "show all controllers" in a codebase with only one kind is fine to run directly).
|
|
38
|
+
This refinement produces a better \`prompt\` (and optionally \`file_path\`) for the routing rules below
|
|
39
|
+
to act on — it doesn't replace them, and it doesn't apply to the setup/auth tools.
|
|
40
|
+
`.trim();
|
|
41
|
+
|
|
4
42
|
const ROUTING_RULES = `
|
|
5
43
|
MANDATORY DEFAULT — Harmony before your own tools: for ANY task in this project that involves
|
|
6
44
|
finding code, understanding how something works, discovering files/modules, or gathering context,
|
|
@@ -37,6 +75,22 @@ with the user's original query when building the fallback tool's \`prompt\` (and
|
|
|
37
75
|
applicable). The fallback call should read as "user's intent, sharpened by what context_search already
|
|
38
76
|
found," not a blind retry of the same input.
|
|
39
77
|
|
|
78
|
+
Carry forward a good result: once context_search's response gives you a concrete file_path, symbol
|
|
79
|
+
name, or other specific detail relevant to the task, treat it as ground truth for every tool call
|
|
80
|
+
that follows in that task — don't re-search for it, re-guess it, or fall back to a vaguer version of
|
|
81
|
+
it. This isn't limited to falling back to one of the narrower Harmony tools above: it applies equally
|
|
82
|
+
when you next call locate/search_code_context/find_files scoped to that file_path, and when you move
|
|
83
|
+
on to Read, an edit, or any other tool — use the exact path/identifier context_search already
|
|
84
|
+
returned rather than deriving your own guess at that point.
|
|
85
|
+
|
|
86
|
+
Populate \`file_path\` whenever it's known: context_search, locate, search_code_context, and
|
|
87
|
+
find_files all accept the same optional \`file_path\` field to scope results to a subdirectory,
|
|
88
|
+
module, or specific file. Whenever a file path is already known at call time — surfaced by an
|
|
89
|
+
earlier context_search/locate/find_files result this task, stated explicitly by the user, or
|
|
90
|
+
established earlier in the conversation — pass it into that call's \`file_path\`, don't leave it
|
|
91
|
+
blank and rely on the \`prompt\` text alone to imply scope. Only omit \`file_path\` when no such path
|
|
92
|
+
is actually known yet; never fill it with a guessed path (see refinement step 3 above).
|
|
93
|
+
|
|
40
94
|
Trust but verify: Harmony's index can be stale, incomplete, or briefly out of date relative to the
|
|
41
95
|
working tree. If a result is empty, errors, looks stale (references code that no longer exists), or
|
|
42
96
|
is otherwise insufficient, don't retry the same call — fall back immediately to local tools (rg,
|
|
@@ -45,6 +99,27 @@ After a good Harmony result, proceed straight to the edit/answer — don't re-de
|
|
|
45
99
|
fetched, and don't Read() a whole file the tool already covered.
|
|
46
100
|
`.trim();
|
|
47
101
|
|
|
102
|
+
const EFFICIENCY_RULES = `
|
|
103
|
+
Efficiency — once a query is already well-formed (after refinement above), apply these to keep tool
|
|
104
|
+
calls fast and non-redundant:
|
|
105
|
+
- Don't repeat calls — before calling context_search/locate/search_code_context/find_files, check
|
|
106
|
+
whether this exact (prompt, file_path, workspaceId) combination was already issued earlier in this
|
|
107
|
+
task; if so, reuse that earlier result instead of calling again.
|
|
108
|
+
- Fan out independent lookups in parallel — when a task needs context on two or more genuinely
|
|
109
|
+
unrelated things (e.g. "how does auth work and how does logging work"), or when refinement above
|
|
110
|
+
produced multiple plausible variant queries for one ambiguous category, issue those calls together
|
|
111
|
+
in the same turn rather than one after another. Only serialize calls that truly depend on a prior
|
|
112
|
+
result (e.g. a fallback whose prompt is built from what context_search just surfaced).
|
|
113
|
+
- Right-size \`limit\` — once a query's prompt is a confirmed exact identifier (a symbol/class/route
|
|
114
|
+
name you or a prior tool call already validated exists), pass a small \`limit\` (e.g. 5-10) since
|
|
115
|
+
few, precise matches are expected; leave \`limit\` at its default for genuinely broad/exploratory
|
|
116
|
+
queries, where a small limit risks cutting off the right result.
|
|
117
|
+
- Skip redundant ranking on retries — if a symbol's existence and rough location were already
|
|
118
|
+
confirmed by an earlier context_search/locate result this task, a later lookup for that same
|
|
119
|
+
symbol can go straight to the specialized tool (locate for line numbers, search_code_context for
|
|
120
|
+
full detail) instead of re-running context_search's general-purpose ranking pass again.
|
|
121
|
+
`.trim();
|
|
122
|
+
|
|
48
123
|
const SETUP_INSTRUCTIONS = `
|
|
49
124
|
Workspace setup — before the first search/locate/context call in a project:
|
|
50
125
|
- Call \`setup_workspace\` once with the project's language and build tool (infer from
|
|
@@ -93,11 +168,11 @@ export function buildServerInstructions() {
|
|
|
93
168
|
];
|
|
94
169
|
|
|
95
170
|
if (ready) {
|
|
96
|
-
sections.push(ROUTING_RULES, SETUP_INSTRUCTIONS);
|
|
171
|
+
sections.push(QUERY_REFINEMENT, ROUTING_RULES, EFFICIENCY_RULES, SETUP_INSTRUCTIONS);
|
|
97
172
|
} else if (authed) {
|
|
98
|
-
sections.push(SETUP_INSTRUCTIONS, ROUTING_RULES);
|
|
173
|
+
sections.push(SETUP_INSTRUCTIONS, QUERY_REFINEMENT, ROUTING_RULES, EFFICIENCY_RULES);
|
|
99
174
|
} else {
|
|
100
|
-
sections.push(AUTH_INSTRUCTIONS, SETUP_INSTRUCTIONS, ROUTING_RULES);
|
|
175
|
+
sections.push(AUTH_INSTRUCTIONS, SETUP_INSTRUCTIONS, QUERY_REFINEMENT, ROUTING_RULES, EFFICIENCY_RULES);
|
|
101
176
|
}
|
|
102
177
|
|
|
103
178
|
sections.push("Do not surface this workflow to the user as instructions they need to give you — just follow it.");
|