@codeconductorai/harmony-mcp 1.0.7 → 1.0.8

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.
Files changed (3) hide show
  1. package/README.md +105 -21
  2. package/package.json +1 -1
  3. package/src/index.js +80 -4
package/README.md CHANGED
@@ -1,19 +1,95 @@
1
1
  # harmony-mcp
2
2
 
3
- An MCP server that integrates your local workspace with the Harmony backend for codebase indexing and context retrieval. It exposes specialized tools to MCP clients (e.g. Claude Code, Claude Desktop, IntelliJ AI Assistant) over stdio.
3
+ An MCP (Model Context Protocol) server that connects your local workspace to the Harmony backend for codebase indexing and context retrieval. It exposes tools over stdio that let an MCP-compatible coding agent authenticate, index your project, and pull back precise, ranked code context instead of blindly reading or grepping the whole repo.
4
4
 
5
- ## Quick Start
5
+ ## Requirements
6
6
 
7
- Get started in seconds without configuring secrets manually.
7
+ - Node.js >= 18 (ships with `npx`, which is how the server is run below)
8
8
 
9
- **1. Add the server to your MCP client config:**
9
+ **Check whether you have it:**
10
+
11
+ ```bash
12
+ node -v
13
+ ```
14
+
15
+ If this prints `v18.x.x` or higher, you're set. If you see `command not found` or a lower version, install/upgrade Node first:
16
+
17
+ - **macOS**: `brew install node` (or `brew upgrade node` if already installed)
18
+ - **Windows/macOS**: download the LTS installer from [nodejs.org](https://nodejs.org/)
19
+ - **Linux**: use your distro's package manager (e.g. `sudo apt install nodejs npm` on Debian/Ubuntu), or [NodeSource](https://github.com/nodesource/distributions) for a newer version
20
+ - **Any OS (recommended for managing multiple versions)**: install [nvm](https://github.com/nvm-sh/nvm), then run:
21
+ ```bash
22
+ nvm install --lts
23
+ nvm use --lts
24
+ ```
25
+
26
+ Re-run `node -v` afterwards to confirm before continuing.
27
+
28
+ ## Installation
29
+
30
+ The server is published as `@codeconductorai/harmony-mcp` and run via `npx`, so no local build step is required.
31
+
32
+ ### Claude Code
10
33
 
11
- For Claude Code, run:
12
34
  ```bash
13
35
  claude mcp add harmony -- npx -y @codeconductorai/harmony-mcp
14
36
  ```
15
37
 
16
- Or add it directly to your client's config file (e.g., `~/.claude/claude_desktop_config.json`):
38
+ ### Antigravity
39
+
40
+ Open **MCP Servers → Manage MCP Servers → View raw config** from the agent panel, or edit the config file directly:
41
+
42
+ - Global: `~/.gemini/config/mcp_config.json`
43
+ - Workspace-local: `.agents/mcp_config.json`
44
+
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "harmony": {
49
+ "command": "npx",
50
+ "args": ["-y", "@codeconductorai/harmony-mcp"]
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ Restart Antigravity (or reload MCP servers) after saving.
57
+
58
+ ### Codex CLI
59
+
60
+ ```bash
61
+ codex mcp add harmony -- npx -y @codeconductorai/harmony-mcp
62
+ ```
63
+
64
+ This writes the entry to `~/.codex/config.toml`. To add it by hand instead:
65
+
66
+ ```toml
67
+ [mcp_servers.harmony]
68
+ command = "npx"
69
+ args = ["-y", "@codeconductorai/harmony-mcp"]
70
+ ```
71
+
72
+ ### Aria
73
+
74
+ In the Aria Code panel, click the settings icon → **MCP Servers**, then scroll down and click **Edit Global MCP** (applies everywhere, via `mcp_settings.json`) or **Edit Project MCP** (this project only, writes `.Aria/mcp.json`). Add:
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "harmony": {
80
+ "command": "npx",
81
+ "args": ["-y", "@codeconductorai/harmony-mcp"]
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ Save the file — Aria Code picks up the new server automatically, no restart needed.
88
+
89
+ ### Other MCP clients
90
+
91
+ Any client that reads a `command`/`args` style config (e.g. Claude Desktop's `claude_desktop_config.json`) can use the same shape:
92
+
17
93
  ```json
18
94
  {
19
95
  "mcpServers": {
@@ -25,38 +101,46 @@ Or add it directly to your client's config file (e.g., `~/.claude/claude_desktop
25
101
  }
26
102
  ```
27
103
 
28
- **2. Restart your MCP client**, then call the `login` tool. It returns a `loginUrl` — open it in your browser and complete the login.
104
+ ## Getting started
29
105
 
30
- **3. Call `confirm_login`** once you've finished logging in.
106
+ After adding the server and restarting your client:
31
107
 
32
- **4. Call `setup_workspace`** (providing `language` and `buildTool`) and then `upload_workspace` to index your project. You're now ready to use `get_context_bundle`.
108
+ 1. **`login`** — starts a device-flow login and returns a URL to open in your browser.
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
+ 3. **`setup_workspace`** — registers the current project (`language` and `buildTool` required).
111
+ 4. **`upload_workspace`** — zips and uploads the project for indexing. Runs `setup_workspace` automatically if it hasn't been done yet. Once indexing succeeds, a background file watcher pushes incremental updates to the backend as you edit files.
112
+ 5. Use **`get_context_bundle`** or **`locate`** to pull relevant code context for a prompt.
33
113
 
34
- ---
114
+ Workspace state (workspace ID, language, build tool, setup/upload status) is cached in a `.harmony_workspace.json` marker file in the project Ariat.
35
115
 
36
116
  ## Tools
37
117
 
38
118
  ### `login`
39
- Starts a secure authentication session. Returns a `loginUrl` to open in your browser and a `userCode`.
119
+ Starts a device-flow login session and returns a `loginUrl` to open in the browser plus a `userCode`.
40
120
 
41
121
  ### `confirm_login`
42
- Verifies and completes the authentication process after browser login.
43
- - `timeout` (optional): Max seconds to wait for login (default: 300).
122
+ Completes authentication after the browser login. Requires `userConfirmed: true`, which must only be set after the user has explicitly confirmed (in chat) that they finished logging in.
123
+ - `timeout` (optional): max seconds to wait (default 300).
44
124
 
45
125
  ### `setup_workspace`
46
- Registers your current project as a workspace on the backend.
47
- - `language` (required): Codebase language (e.g., `JAVA`, `JAVASCRIPT`, `TYPESCRIPT`, `PYTHON`).
48
- - `buildTool` (required): Build tool used (e.g., `MAVEN`, `GRADLE`, `NPM`).
126
+ Registers the current project as a workspace on the backend. No-op if already set up.
127
+ - `language` (required): e.g. `JAVA`, `JAVASCRIPT`, `TYPESCRIPT`, `PYTHON`.
128
+ - `buildTool` (required): e.g. `MAVEN`, `GRADLE`, `NPM`.
49
129
 
50
130
  ### `upload_workspace`
51
- Zips the current working directory (excluding common folders like `node_modules` and `.git`) and indexes it on the cloud. Automatically runs `setup_workspace` if not already initialized.
131
+ Zips the working directory (excluding `node_modules`, `.git`, `.next`, `dist`, `build`, and the workspace marker) and uploads it for indexing. Starts the file watcher for incremental re-indexing once done.
52
132
 
53
133
  ### `get_context_bundle`
54
- Retrieves a ranked XML context bundle containing the most relevant code snippets from your indexed workspace based on your prompt.
55
- - `prompt` (required): The natural-language question or instruction.
134
+ Retrieves a ranked XML context bundle of the most relevant code for a prompt.
135
+ - `prompt` (required): natural-language question or instruction.
56
136
 
57
- ---
137
+ ### `locate`
138
+ Given a natural-language query, returns an XML response with ranked file paths, relevant symbols, call-graph-aware line anchors, and real line-numbered source excerpts around each anchor — enough to make targeted edits without a separate full-file read.
139
+ - `prompt` (required): what to find, e.g. `"winner email"`.
140
+ - `limit` (optional): max ranked results (default 10, max 25).
141
+ - `scope` (optional): path prefix/substring to restrict the search to a subdirectory or module.
58
142
 
59
- ## Local Development
143
+ ## Local development
60
144
 
61
145
  ```bash
62
146
  npm install
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeconductorai/harmony-mcp",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -449,6 +449,36 @@ function buildMcpServer() {
449
449
  required: ["prompt"],
450
450
  },
451
451
  },
452
+ {
453
+ name: "locate",
454
+ description:
455
+ "Given a natural language query, returns an XML response designed to let you make small, targeted " +
456
+ "edits WITHOUT a separate full-file Read: ranked file paths (each with its architectural role, tags, " +
457
+ "relevant symbol names, and call-graph-aware line anchors with a reason), plus a top-level 'summary' " +
458
+ "element — real, line-numbered source excerpts (not just snippets) sliced directly out of each file " +
459
+ "around its returned anchors, merged where anchors are close together. This is the ONLY part of the " +
460
+ "file/codebase you should read for the query — do not Read() the whole file or grep the wider codebase " +
461
+ "on top of this. Only fall back to Read() if the edit you need falls outside every line range shown in " +
462
+ "the summary (the line numbers in the summary are exact — use them directly for the edit).",
463
+ inputSchema: {
464
+ type: "object",
465
+ properties: {
466
+ prompt: {
467
+ type: "string",
468
+ description: "Natural language query describing what to find (e.g. \"winner email\").",
469
+ },
470
+ limit: {
471
+ type: "number",
472
+ description: "Maximum number of ranked results to return (default 10, max 25).",
473
+ },
474
+ scope: {
475
+ type: "string",
476
+ description: "Optional path prefix/substring to restrict the search to a subdirectory or module.",
477
+ },
478
+ },
479
+ required: ["prompt"],
480
+ },
481
+ },
452
482
  ],
453
483
  }));
454
484
 
@@ -665,10 +695,56 @@ function buildMcpServer() {
665
695
  return {
666
696
  content: [{
667
697
  type: "text",
668
- text: JSON.stringify({
669
- response: `Context bundle retrieved successfully for prompt: "${prompt}".`,
670
- toolResponse: body,
671
- }),
698
+ text: body,
699
+ }],
700
+ };
701
+
702
+ } else if (name === "locate") {
703
+ if (!process.env.AUTH_ACCESS_TOKEN && !isLoggedIn()) return NOT_AUTHENTICATED;
704
+ const marker = readMarker();
705
+ if (!marker?.workspaceId) {
706
+ throw new Error("Workspace not set up yet. Call setup_workspace first.");
707
+ }
708
+
709
+ const prompt = args.prompt || args.query;
710
+ if (!prompt) throw new Error("prompt is required.");
711
+
712
+ const requestBody = {
713
+ prompt,
714
+ limit: args.limit,
715
+ scope: args.scope,
716
+ workspaceMetadata: {
717
+ workspaceId: marker.workspaceId,
718
+ productId: PRODUCT_ID,
719
+ appId: APP_ID,
720
+ repoId: getGitRepoId(),
721
+ branchName: BRANCH_NAME,
722
+ workspaceAlias: getWorkspaceAlias(getProjectName()),
723
+ workspacePath: process.cwd(),
724
+ projectName: getProjectName(),
725
+ },
726
+ };
727
+
728
+ log("[locate] Request body:", JSON.stringify(requestBody, null, 2));
729
+
730
+ const token = await getAccessToken();
731
+ const response = await fetch(`${API_URL}/api/code-workspace/${marker.workspaceId}/locate`, {
732
+ method: "POST",
733
+ headers: {
734
+ "Content-Type": "application/json",
735
+ Accept: "application/xml",
736
+ Authorization: `Bearer ${token}`,
737
+ },
738
+ body: JSON.stringify(requestBody),
739
+ });
740
+ const body = await response.text();
741
+ if (!response.ok) {
742
+ throw new Error(`Locate request failed: ${response.status} ${body}`);
743
+ }
744
+ return {
745
+ content: [{
746
+ type: "text",
747
+ text: body,
672
748
  }],
673
749
  };
674
750