@gethmy/mcp 1.0.0 → 2.1.0

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 (65) hide show
  1. package/README.md +201 -36
  2. package/dist/cli.js +20938 -20249
  3. package/dist/http.js +1957 -0
  4. package/dist/index.js +17833 -17888
  5. package/dist/lib/__tests__/active-learning.test.js +386 -0
  6. package/dist/lib/__tests__/agent-performance-profiles.test.js +325 -0
  7. package/dist/lib/__tests__/auto-session.test.js +661 -0
  8. package/dist/lib/__tests__/context-assembly.test.js +362 -0
  9. package/dist/lib/__tests__/graph-expansion.test.js +150 -0
  10. package/dist/lib/__tests__/integration-memory-crud.test.js +797 -0
  11. package/dist/lib/__tests__/integration-memory-system.test.js +281 -0
  12. package/dist/lib/__tests__/lifecycle-maintenance.test.js +207 -0
  13. package/dist/lib/__tests__/pattern-detection.test.js +295 -0
  14. package/dist/lib/__tests__/prompt-builder.test.js +418 -0
  15. package/dist/lib/active-learning.js +878 -0
  16. package/dist/lib/api-client.js +548 -0
  17. package/dist/lib/auto-session.js +173 -0
  18. package/dist/lib/cli.js +127 -0
  19. package/dist/lib/config.js +205 -0
  20. package/dist/lib/consolidation.js +243 -0
  21. package/dist/lib/context-assembly.js +606 -0
  22. package/dist/lib/graph-expansion.js +163 -0
  23. package/dist/lib/http.js +174 -0
  24. package/dist/lib/index.js +7 -0
  25. package/dist/lib/lifecycle-maintenance.js +88 -0
  26. package/dist/lib/prompt-builder.js +483 -0
  27. package/dist/lib/remote.js +166 -0
  28. package/dist/lib/server.js +3132 -0
  29. package/dist/lib/tui/agents.js +116 -0
  30. package/dist/lib/tui/docs.js +558 -0
  31. package/dist/lib/tui/setup.js +1068 -0
  32. package/dist/lib/tui/theme.js +95 -0
  33. package/dist/lib/tui/writer.js +200 -0
  34. package/dist/remote.js +34534 -0
  35. package/dist/server.js +31967 -0
  36. package/package.json +20 -7
  37. package/src/__tests__/active-learning.test.ts +483 -0
  38. package/src/__tests__/agent-performance-profiles.test.ts +468 -0
  39. package/src/__tests__/auto-session.test.ts +912 -0
  40. package/src/__tests__/context-assembly.test.ts +506 -0
  41. package/src/__tests__/graph-expansion.test.ts +285 -0
  42. package/src/__tests__/integration-memory-crud.test.ts +948 -0
  43. package/src/__tests__/integration-memory-system.test.ts +321 -0
  44. package/src/__tests__/lifecycle-maintenance.test.ts +238 -0
  45. package/src/__tests__/pattern-detection.test.ts +438 -0
  46. package/src/__tests__/prompt-builder.test.ts +505 -0
  47. package/src/active-learning.ts +1227 -0
  48. package/src/api-client.ts +963 -0
  49. package/src/auto-session.ts +218 -0
  50. package/src/cli.ts +166 -0
  51. package/src/config.ts +285 -0
  52. package/src/consolidation.ts +314 -0
  53. package/src/context-assembly.ts +842 -0
  54. package/src/graph-expansion.ts +234 -0
  55. package/src/http.ts +265 -0
  56. package/src/index.ts +8 -0
  57. package/src/lifecycle-maintenance.ts +120 -0
  58. package/src/prompt-builder.ts +681 -0
  59. package/src/remote.ts +227 -0
  60. package/src/server.ts +3858 -0
  61. package/src/tui/agents.ts +154 -0
  62. package/src/tui/docs.ts +650 -0
  63. package/src/tui/setup.ts +1281 -0
  64. package/src/tui/theme.ts +114 -0
  65. package/src/tui/writer.ts +260 -0
package/README.md CHANGED
@@ -1,18 +1,23 @@
1
- # harmony-mcp
1
+ # @gethmy/mcp
2
2
 
3
3
  MCP (Model Context Protocol) server for [Harmony](https://gethmy.com).
4
4
  Enables AI coding agents (Claude Code, OpenAI Codex, Cursor, Windsurf) to interact with your Harmony boards.
5
5
 
6
6
  ## Features
7
7
 
8
- - **29 MCP Tools** for full board control (cards, columns, labels, subtasks, links)
8
+ - **61+ MCP Tools** for full board control, knowledge graph, and workflow plans
9
+ - **Knowledge Graph Memory** - persistent memory with entity types, tiers, scopes, and typed relations
10
+ - **Active Learning** - auto-extracts lessons, solutions, and error patterns from completed work sessions
11
+ - **Context Assembly** - token-budget-aware memory injection into AI prompts
12
+ - **GSD Workflow Plans** - plan/execute/verify/done lifecycle with auto card creation
9
13
  - **Card Linking** - create relationships between cards (blocks, relates_to, duplicates, is_part_of)
10
14
  - **Prompt Builder** - generate AI-ready prompts from cards with context
11
15
  - **Agent Session Tracking** - track work progress with timer badges
16
+ - **Auto-Session Detection** - automatically starts/ends sessions when agents interact with cards
12
17
  - **Auto-Assignment** - automatically assign cards to you when starting agent sessions
18
+ - **Memory Sync** - bidirectional sync between local markdown files and remote database
13
19
  - **Multi-Agent Support** - works with Claude Code, Codex, Cursor, Windsurf
14
20
  - **Smart Setup** - one command configures everything
15
- - **Natural Language Processing** via voice-nlu edge function
16
21
  - **API Key Authentication** - no database credentials required
17
22
 
18
23
  ## Quick Start
@@ -27,7 +32,7 @@ Enables AI coding agents (Claude Code, OpenAI Codex, Cursor, Windsurf) to intera
27
32
  ### 2. Run Setup
28
33
 
29
34
  ```bash
30
- npx harmony-mcp setup
35
+ npx @gethmy/mcp setup
31
36
  ```
32
37
 
33
38
  The smart setup wizard will:
@@ -39,13 +44,65 @@ The smart setup wizard will:
39
44
 
40
45
  That's it! You're ready to use Harmony with your AI agent.
41
46
 
47
+ ## Remote MCP (Hosted)
48
+
49
+ Connect any MCP-compatible agent to Harmony's hosted endpoint - no local server required.
50
+
51
+ **Endpoint:** `https://mcp.gethmy.com/mcp`
52
+
53
+ **Transport:** Streamable HTTP (MCP SDK standard)
54
+
55
+ **Authentication:** Bearer token using your `hmy_` API key
56
+
57
+ ### Universal Setup with `add-mcp`
58
+
59
+ The fastest way to connect any agent to the remote endpoint. One command configures Claude Code, Cursor, VS Code, Windsurf, Codex, and more:
60
+
61
+ ```bash
62
+ npx add-mcp https://mcp.gethmy.com/mcp -- --header "Authorization: Bearer hmy_your_key_here"
63
+ ```
64
+
65
+ **Useful flags:**
66
+
67
+ | Flag | Description |
68
+ | ---- | ----------- |
69
+ | `-g` | Install globally (not scoped to a project) |
70
+ | `-a <agent>` | Target specific agents (e.g., `-a cursor -a claude-code`) |
71
+ | `-y` | Skip interactive prompts |
72
+
73
+ **Examples:**
74
+
75
+ ```bash
76
+ # Install for all detected agents
77
+ npx add-mcp https://mcp.gethmy.com/mcp -- --header "Authorization: Bearer hmy_your_key_here"
78
+
79
+ # Install globally for Cursor and Claude Code only
80
+ npx add-mcp https://mcp.gethmy.com/mcp -g -a cursor -a claude-code -- --header "Authorization: Bearer hmy_your_key_here"
81
+
82
+ # Non-interactive (CI-friendly)
83
+ npx add-mcp https://mcp.gethmy.com/mcp -y -- --header "Authorization: Bearer hmy_your_key_here"
84
+ ```
85
+
86
+ ### Manual Setup (Claude.ai)
87
+
88
+ If you prefer to configure manually (e.g., in Claude.ai's UI):
89
+
90
+ 1. Get an API key from [Harmony](https://gethmy.com/user/keys)
91
+ 2. In Claude.ai, add a remote MCP server with URL `https://mcp.gethmy.com/mcp`
92
+ 3. Set the Authorization header to `Bearer hmy_your_key_here`
93
+ 4. All 61+ Harmony tools become available in your conversation
94
+
95
+ **Session management** is automatic - sessions have a 1-hour TTL and are created/renewed transparently.
96
+
97
+ > **When to use remote vs local:** The remote endpoint (via `add-mcp` or manual config) works with any MCP-compatible agent and requires no local server. Use the local server (`npx @gethmy/mcp setup`) when you need skills, local project context, or memory sync to local markdown files.
98
+
42
99
  ### Adding to a New Project
43
100
 
44
101
  Just run setup again in the new project directory:
45
102
 
46
103
  ```bash
47
104
  cd my-new-project
48
- npx harmony-mcp setup
105
+ npx @gethmy/mcp setup
49
106
  ```
50
107
 
51
108
  It detects your existing configuration and only asks for the project context.
@@ -54,17 +111,17 @@ It detects your existing configuration and only asks for the project context.
54
111
 
55
112
  ```bash
56
113
  # Setup (recommended)
57
- npx harmony-mcp setup # Smart setup wizard
114
+ npx @gethmy/mcp setup # Smart setup wizard
58
115
 
59
116
  # Setup with flags (non-interactive)
60
- npx harmony-mcp setup --api-key KEY --global --workspace ID --project ID
117
+ npx @gethmy/mcp setup --api-key KEY --global --workspace ID --project ID
61
118
 
62
119
  # Status and management
63
- npx harmony-mcp status # Show current configuration
64
- npx harmony-mcp reset # Clear all configuration
120
+ npx @gethmy/mcp status # Show current configuration
121
+ npx @gethmy/mcp reset # Clear all configuration
65
122
 
66
123
  # Server (called by agents automatically)
67
- npx harmony-mcp serve # Start MCP server
124
+ npx @gethmy/mcp serve # Start MCP server
68
125
  ```
69
126
 
70
127
  ### Setup Options
@@ -83,14 +140,18 @@ npx harmony-mcp serve # Start MCP server
83
140
 
84
141
  ## Supported AI Agents
85
142
 
86
- | Agent | Workflow Command | Config Location |
87
- | ---------------- | ------------------------ | ------------------------------------- |
88
- | **Claude Code** | `/hmy #42` | `~/.claude/settings.json` |
89
- | **OpenAI Codex** | `/prompts:hmy #42` | `~/.codex/config.toml` |
90
- | **Cursor** | MCP tools auto-available | `.cursor/mcp.json` |
91
- | **Windsurf** | MCP tools auto-available | `~/.codeium/windsurf/mcp_config.json` |
143
+ | Agent | Workflow Command | Config Location | Transport |
144
+ | ---------------- | ------------------------ | ------------------------------------- | --------------------- |
145
+ | **Claude Code** | `/hmy #42`, `/hmy-plan` | `~/.claude/settings.json` | Local (stdio) |
146
+ | **OpenAI Codex** | `/prompts:hmy #42` | `~/.codex/config.toml` | Local (stdio) |
147
+ | **Cursor** | MCP tools auto-available | `.cursor/mcp.json` | Local (stdio) |
148
+ | **Windsurf** | MCP tools auto-available | `~/.codeium/windsurf/mcp_config.json` | Local (stdio) |
149
+ | **Claude.ai** | MCP tools auto-available | Remote MCP settings in Claude.ai | Remote (HTTP) |
150
+ | **Any agent** | MCP tools auto-available | Auto-configured via `npx add-mcp` | Remote (HTTP) |
151
+
152
+ ## Skills
92
153
 
93
- ## Card Workflow
154
+ ### `/hmy` — Card Workflow
94
155
 
95
156
  When you start working on a card (e.g., `/hmy #42`):
96
157
 
@@ -102,13 +163,39 @@ When you start working on a card (e.g., `/hmy #42`):
102
163
  6. **Implement** - Work on the task with progress updates
103
164
  7. **Complete** - Move to "Review" when done
104
165
 
166
+ ### `/hmy-plan` — Plan Workflow
167
+
168
+ A single command for both creating and executing plans. It auto-detects intent based on the argument:
169
+
170
+ | Argument | Action |
171
+ |----------|--------|
172
+ | `UUID` | Fetch and work on existing plan |
173
+ | `#42` | Look up card, then its linked plan |
174
+ | `mobile auth` | Search existing plans; if found, work on it; if not, offer to create one |
175
+ | *(empty)* | Start the new plan creation interview |
176
+
177
+ **Creating a plan** (`/hmy-plan mobile auth`):
178
+ 1. Gathers board context and related memories
179
+ 2. Interviews you with 3-5 focused questions
180
+ 3. Synthesizes a structured plan document
181
+ 4. Saves to Harmony via `harmony_create_plan`
182
+ 5. Optionally advances to execute phase, creating board cards from tasks
183
+
184
+ **Executing a plan** (`/hmy-plan <existing plan>`):
185
+ 1. Displays plan summary (status, phase, task counts)
186
+ 2. Recalls related context from memory
187
+ 3. Offers options: create single card, create multiple cards, analyze only, or skip
188
+ 4. Creates cards and advances the plan phase
189
+
105
190
  ## Available Tools
106
191
 
107
192
  ### Card Operations
108
193
 
109
194
  - `harmony_create_card` - Create a new card
110
195
  - `harmony_update_card` - Update card properties
111
- - `harmony_move_card` - Move card to different column
196
+ - `harmony_move_card` - Move card to different column (auto-ends agent session on move to done/review)
197
+ - `harmony_archive_card` - Archive a card (soft-delete, can be restored)
198
+ - `harmony_unarchive_card` - Restore an archived card back to the board
112
199
  - `harmony_delete_card` - Delete a card
113
200
  - `harmony_assign_card` - Assign to team member
114
201
  - `harmony_search_cards` - Search by title/description
@@ -151,7 +238,7 @@ When you start working on a card (e.g., `/hmy #42`):
151
238
 
152
239
  - `harmony_list_workspaces` - List workspaces
153
240
  - `harmony_list_projects` - List projects
154
- - `harmony_get_board` - Get full board state
241
+ - `harmony_get_board` - Get board state (supports pagination via `limit`/`offset`, `summary` mode, `columnId` filter, `includeArchived`)
155
242
  - `harmony_get_workspace_members` - Get team members
156
243
  - `harmony_set_workspace_context` - Set active workspace
157
244
  - `harmony_set_project_context` - Set active project
@@ -163,14 +250,28 @@ When you start working on a card (e.g., `/hmy #42`):
163
250
 
164
251
  ### Agent Session Tracking
165
252
 
166
- - `harmony_start_agent_session` - Start tracking work on a card
253
+ - `harmony_start_agent_session` - Start tracking work on a card (with `moveToColumn` and `addLabels` side effects)
167
254
  - `harmony_update_agent_progress` - Update progress, status, blockers
168
- - `harmony_end_agent_session` - End session (completed/paused)
255
+ - `harmony_end_agent_session` - End session (completed/paused); triggers active learning extraction
169
256
  - `harmony_get_agent_session` - Get current session state
257
+ - `harmony_get_agent_profile` - Get aggregate performance profile for an agent
258
+
259
+ ### Auto-Session Detection
260
+
261
+ Sessions are automatically started when agents call card-mutating tools without an explicit `harmony_start_agent_session`. This ensures work is always tracked, even when agents don't explicitly manage sessions.
262
+
263
+ **Trigger tools:** `harmony_generate_prompt`, `harmony_update_card`, `harmony_move_card`, `harmony_create_subtask`, `harmony_toggle_subtask`, `harmony_add_label_to_card`, `harmony_remove_label_from_card`
264
+
265
+ **Behavior:**
266
+ - Auto-starts a session when any trigger tool is called on a card without an active session
267
+ - Auto-ends after 10 minutes of inactivity
268
+ - Switching to a different card auto-ends the previous auto-session
269
+ - Explicitly started sessions (via `harmony_start_agent_session`) are never auto-ended
270
+ - Auto-ended sessions trigger the full active learning pipeline
170
271
 
171
272
  ### Prompt Generation
172
273
 
173
- - `harmony_generate_prompt` - Generate an AI-ready prompt from a card
274
+ - `harmony_generate_prompt` - Generate an AI-ready prompt from a card with assembled memory context
174
275
 
175
276
  **Parameters:**
176
277
  | Parameter | Description |
@@ -183,13 +284,70 @@ When you start working on a card (e.g., `/hmy #42`):
183
284
  | `includeLinks` | Include linked cards in prompt (default: true) |
184
285
  | `customConstraints` | Additional instructions to append |
185
286
 
186
- **Variants:**
287
+ The prompt builder automatically infers the agent role based on card labels (bug, feature, design, etc.) and injects relevant memory context using the context assembly engine.
288
+
289
+ ### Memory / Knowledge Graph
290
+
291
+ Store and retrieve persistent knowledge across sessions. Memories have types, tiers, scopes, confidence scores, and can be linked via typed relations.
292
+
293
+ **CRUD:**
294
+
295
+ - `harmony_remember` - Store a memory entity (markdown with YAML frontmatter)
296
+ - `harmony_recall` - Retrieve memories by type, tags, scope, or text query
297
+ - `harmony_update_memory` - Update an existing memory entity
298
+ - `harmony_forget` - Archive or delete a memory entity
299
+ - `harmony_memory_search` - Full-text search across the knowledge base
300
+ - `harmony_relate` - Create a typed relationship between two memory entities
301
+
302
+ **Entity Types:** `agent`, `task`, `decision`, `context`, `pattern`, `error`, `solution`, `preference`, `relationship`, `commitment`, `lesson`, `project`, `handoff`, `procedure`
303
+
304
+ **Memory Tiers:** `draft` (working notes) → `episode` (session summaries) → `reference` (durable knowledge)
305
+
306
+ **Scopes:** `private`, `project`, `workspace`, `global`
307
+
308
+ **Relation Types:** `learned_from`, `resolved_by`, `contradicts`, `supports`, `depends_on`, `part_of`, `caused_by`, `relates_to`
309
+
310
+ ### Memory Vault & Sync
311
+
312
+ - `harmony_vault_index` - Compact index of all memory entities (markdown table)
313
+ - `harmony_resolve_links` - Batch-scan for `[[wiki-links]]` and auto-create relations
314
+ - `harmony_sync` - Bidirectional sync between local markdown files (`~/.harmony/memory/`) and remote database (directions: `pull`, `push`, `full`)
315
+
316
+ ### Memory Lifecycle
317
+
318
+ - `harmony_promote_memory` - Promote entity tier: `draft` → `episode` or `episode` → `reference`
319
+ - `harmony_prune_draft` - Remove stale draft memories (dry-run mode by default)
320
+ - `harmony_consolidate_memories` - Cluster similar draft/episode memories and merge into reference entities (dry-run by default)
321
+ - `harmony_backfill_embeddings` - Generate vector embeddings for entities missing them
322
+ - `harmony_backfill_relations` - Retroactively create semantic relations across existing entities
323
+
324
+ ### Context Debugging
187
325
 
188
- - `analysis` - Understand the problem and create a plan
189
- - `draft` - Design a solution approach
190
- - `execute` - Full implementation (default)
326
+ - `harmony_get_context_manifest` - Debug what memories were loaded/excluded in a prompt assembly
327
+ - `harmony_debug_context` - Explain why a specific memory was or wasn't included (relevance score breakdown)
328
+ - `harmony_export_memory_graph` - Export knowledge graph as DOT format for Graphviz visualization
191
329
 
192
- The prompt builder automatically infers the agent role based on card labels (bug, feature, design, etc.) and includes relevant context from linked cards.
330
+ ### GSD Workflow Plans
331
+
332
+ Create and manage project plans with a phased workflow: **plan** → **execute** → **verify** → **done**.
333
+
334
+ - `harmony_list_plans` - List plans in a project (filter by status or workflow phase)
335
+ - `harmony_create_plan` - Create a new plan with embedded tasks
336
+ - `harmony_get_plan` - Get plan by ID or card ID
337
+ - `harmony_update_plan` - Update plan title, content, status, or phase
338
+ - `harmony_advance_plan` - Advance to next phase with side effects:
339
+ - **plan → execute:** auto-creates Kanban cards from plan tasks, sets plan active
340
+ - **execute → verify:** checks card completion status
341
+ - **verify → done:** archives plan, creates memory entities
342
+
343
+ ### Onboarding & Account
344
+
345
+ - `harmony_onboard` - Complete end-to-end onboarding: signup → workspace → project → API key
346
+ - `harmony_signup` - Create a new user account
347
+ - `harmony_create_workspace` - Create a new workspace
348
+ - `harmony_create_project` - Create a new project with template columns (kanban, scrum, or simple)
349
+ - `harmony_send_invitations` - Send workspace invitations to team members
350
+ - `harmony_generate_api_key` - Generate an API key for the authenticated user
193
351
 
194
352
  ## Direct API Access
195
353
 
@@ -213,20 +371,20 @@ curl -X GET "https://gethmy.com/api/v1/workspaces" \
213
371
  | `/v1/cards/:id` | PATCH | Update card |
214
372
  | `/v1/cards/:id` | DELETE | Delete card |
215
373
  | `/v1/cards/:id/move` | POST | Move card |
374
+ | `/v1/cards/:id/prompt` | GET | Generate prompt from card |
375
+ | `/v1/cards/:id/links` | GET | Get card links |
376
+ | `/v1/cards/:id/links` | POST | Create card link |
377
+ | `/v1/cards/:id/labels` | POST | Add label to card |
378
+ | `/v1/cards/:id/labels/:labelId` | DELETE | Remove label |
216
379
  | `/v1/search?q=query` | GET | Search cards |
217
380
  | `/v1/columns` | POST | Create column |
218
381
  | `/v1/columns/:id` | PATCH | Update column |
219
382
  | `/v1/columns/:id` | DELETE | Delete column |
220
383
  | `/v1/labels` | POST | Create label |
221
- | `/v1/cards/:id/labels` | POST | Add label to card |
222
- | `/v1/cards/:id/labels/:labelId` | DELETE | Remove label |
223
384
  | `/v1/subtasks` | POST | Create subtask |
224
385
  | `/v1/subtasks/:id/toggle` | POST | Toggle subtask |
225
386
  | `/v1/subtasks/:id` | DELETE | Delete subtask |
226
- | `/v1/cards/:id/links` | GET | Get card links |
227
- | `/v1/cards/:id/links` | POST | Create card link |
228
387
  | `/v1/links/:id` | DELETE | Delete card link |
229
- | `/v1/cards/:id/prompt` | GET | Generate prompt from card |
230
388
  | `/v1/nlu` | POST | Process natural language |
231
389
 
232
390
  ## Configuration
@@ -267,7 +425,7 @@ When your email is configured during setup, cards are automatically assigned to
267
425
  To update your email:
268
426
 
269
427
  ```bash
270
- npx harmony-mcp setup --email you@example.com
428
+ npx @gethmy/mcp setup --email you@example.com
271
429
  ```
272
430
 
273
431
  The email must match your Harmony account email to work correctly.
@@ -275,7 +433,7 @@ The email must match your Harmony account email to work correctly.
275
433
  ### Viewing Configuration
276
434
 
277
435
  ```bash
278
- npx harmony-mcp status
436
+ npx @gethmy/mcp status
279
437
  ```
280
438
 
281
439
  Example output:
@@ -317,12 +475,19 @@ Add this to prevent accidentally committing local config:
317
475
 
318
476
  ```
319
477
  ┌─────────────────┐ MCP Protocol ┌──────────────────┐
320
- │ Claude Code │ ───────────────────────▶│ harmony-mcp │
321
- │ Cursor │ │ (local server) │
478
+ │ Claude Code │ ───────────────────────▶│ @gethmy/mcp │
479
+ │ Cursor │ (local stdio) │ (local server) │
322
480
  │ Windsurf │ └────────┬─────────┘
323
481
  │ Codex │ │
324
482
  └─────────────────┘ │ API Key Auth
325
483
 
484
+ ┌─────────────────┐ Streamable HTTP ┌──────────────────┐
485
+ │ Claude.ai │ ───────────────────────▶│ Remote MCP │
486
+ │ Any MCP client │ (Bearer: hmy_xxx) │ mcp.gethmy.com │──┐
487
+ └─────────────────┘ └──────────────────┘ │
488
+
489
+ ┌─────────────┘
490
+
326
491
  ┌──────────────────┐
327
492
  │ Harmony API │
328
493
  │ (Edge Function) │