@unified-product-graph/mcp-server 0.6.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 (63) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/LICENSE +21 -0
  3. package/README.md +166 -0
  4. package/TOOLS.md +2574 -0
  5. package/dist/index.d.ts +17 -0
  6. package/dist/index.js +50284 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/preflight.d.ts +2 -0
  9. package/dist/preflight.js +35 -0
  10. package/dist/preflight.js.map +1 -0
  11. package/dist/tools-manifest.json +3849 -0
  12. package/package.json +76 -0
  13. package/scripts/claudemd-snippet.md +19 -0
  14. package/scripts/install-skills.sh +259 -0
  15. package/skills/upg/SKILL.md +245 -0
  16. package/skills/upg-analytics/SKILL.md +135 -0
  17. package/skills/upg-capture/SKILL.md +274 -0
  18. package/skills/upg-connect/SKILL.md +167 -0
  19. package/skills/upg-context/SKILL.md +506 -0
  20. package/skills/upg-context-intelligence/SKILL.md +227 -0
  21. package/skills/upg-design-system/SKILL.md +265 -0
  22. package/skills/upg-diff/SKILL.md +150 -0
  23. package/skills/upg-discover/SKILL.md +290 -0
  24. package/skills/upg-explore/SKILL-DETAIL.md +481 -0
  25. package/skills/upg-explore/SKILL.md +297 -0
  26. package/skills/upg-export/SKILL.md +385 -0
  27. package/skills/upg-feedback/SKILL.md +141 -0
  28. package/skills/upg-gaps/SKILL.md +376 -0
  29. package/skills/upg-hypothesis/SKILL.md +190 -0
  30. package/skills/upg-impact/SKILL.md +229 -0
  31. package/skills/upg-import/SKILL.md +189 -0
  32. package/skills/upg-init/SKILL.md +410 -0
  33. package/skills/upg-inspect/SKILL.md +167 -0
  34. package/skills/upg-journey/SKILL.md +207 -0
  35. package/skills/upg-launch/SKILL-DETAIL.md +392 -0
  36. package/skills/upg-launch/SKILL.md +141 -0
  37. package/skills/upg-migrate/SKILL.md +146 -0
  38. package/skills/upg-okr/SKILL-DETAIL.md +351 -0
  39. package/skills/upg-okr/SKILL.md +88 -0
  40. package/skills/upg-persona/SKILL.md +230 -0
  41. package/skills/upg-prioritise/SKILL.md +195 -0
  42. package/skills/upg-pull/SKILL-DETAIL.md +398 -0
  43. package/skills/upg-pull/SKILL.md +57 -0
  44. package/skills/upg-push/SKILL-DETAIL.md +385 -0
  45. package/skills/upg-push/SKILL.md +113 -0
  46. package/skills/upg-reflect/SKILL.md +201 -0
  47. package/skills/upg-research/SKILL.md +336 -0
  48. package/skills/upg-rollback/SKILL.md +163 -0
  49. package/skills/upg-run/SKILL.md +126 -0
  50. package/skills/upg-schema-changelog/SKILL.md +231 -0
  51. package/skills/upg-schema-consolidate/SKILL.md +243 -0
  52. package/skills/upg-schema-edges/SKILL.md +287 -0
  53. package/skills/upg-schema-evolve/SKILL.md +313 -0
  54. package/skills/upg-schema-health/SKILL.md +279 -0
  55. package/skills/upg-schema-update/SKILL.md +206 -0
  56. package/skills/upg-snapshot/SKILL.md +108 -0
  57. package/skills/upg-status/SKILL.md +340 -0
  58. package/skills/upg-strategy/SKILL.md +334 -0
  59. package/skills/upg-template/SKILL.md +145 -0
  60. package/skills/upg-trace/SKILL.md +197 -0
  61. package/skills/upg-tree/SKILL.md +233 -0
  62. package/skills/upg-verify/SKILL.md +223 -0
  63. package/skills/upg-workspace/SKILL.md +103 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,57 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@unified-product-graph/mcp-server` are documented in this file. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4
+
5
+ ## [0.6.0] - 2026-05-22
6
+
7
+ Aligned with `@unified-product-graph/core@0.6.0` launch train.
8
+
9
+ ### Changed
10
+
11
+ - Bumped peer/dependency on `@unified-product-graph/core` to `^0.6.0`.
12
+ - Internal `UPG_FRAMEWORKS` consumer surface now reflects the 34 canonical frameworks (was 216). Affects any tool that enumerates frameworks for label resolution or slot lookup.
13
+
14
+ ## [0.5.0] - 2026-05-19
15
+
16
+ Inaugural public release on the `@unified-product-graph/` npm scope. Co-versioned with `@unified-product-graph/core@0.5.0`.
17
+
18
+ ### Added
19
+
20
+ - **90 tools** across 9 domains: read, write, walk, schema, playbooks, approaches, validation, migration, workspace. See [TOOLS.md](./TOOLS.md) for the full reference.
21
+ - **5 canonical approaches** as bare-verb tools: `plan`, `inspect`, `prioritise`, `trace`, `reflect`.
22
+ - **23 region-anchored playbooks** across 10 regions (one canonical playbook per region plus 13 specialised entry paths).
23
+ - **Spec introspection** wired through to `@unified-product-graph/core`: entity types, edge types, lifecycles, migrations, anti-patterns, frameworks, lenses, type labels, valid children, regions, benchmarks, product stages, scales, domain rings.
24
+ - **Migration tooling**: `migrate_type`, `migrate_properties`, `rename_edge_type`, `repair_dangling_edges`.
25
+ - **Batch operations**: `batch_create_nodes`, `batch_create_edges`, `batch_update_nodes`, `batch_delete_nodes`, `batch_move_nodes`.
26
+ - **Cloud sync**: `get_sync_state`, `apply_pull_changeset`, `push_to_cloud`. Auto-discovers credentials from a `upg-cloud` entry in `.mcp.json`.
27
+ - **40+ skill files** for Claude Code, Cursor, Codex CLI, Gemini CLI, OpenCode, and Kiro, installable via `bash scripts/install-skills.sh`.
28
+
29
+ ### Install
30
+
31
+ ```bash
32
+ # In Claude Code
33
+ claude mcp add upg -- npx @unified-product-graph/mcp-server
34
+
35
+ # In any other MCP client (JSON config)
36
+ {
37
+ "mcpServers": {
38
+ "upg": { "command": "npx", "args": ["@unified-product-graph/mcp-server"] }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ### Dependencies
44
+
45
+ - `@modelcontextprotocol/sdk ^1.27.0`
46
+ - `@unified-product-graph/core ^0.5.0`
47
+ - `@unified-product-graph/frameworks ^0.5.0`
48
+ - `chokidar ^4.0.0`
49
+ - `nanoid ^5.1.0`
50
+
51
+ ### Requires
52
+
53
+ - Node.js 20 or later
54
+
55
+ ---
56
+
57
+ Earlier pre-release development history is not maintained in this changelog. Subsequent releases will track core's version line unless a server-specific change demands otherwise.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arkheiev UG
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # UPG MCP Server
2
+
3
+ A local [Model Context Protocol](https://modelcontextprotocol.io) server that reads and writes `.upg` files. The `.upg` file is a portable JSON document holding your product graph: entities (personas, features, hypotheses, OKRs) and the relationships between them.
4
+
5
+ The server exposes 90 tools. They cover graph reads and writes plus introspection of everything `@unified-product-graph/core` ships — entity types, edges, frameworks, regions, playbooks, lenses, anti-patterns, benchmarks.
6
+
7
+ See [CHANGELOG.md](./CHANGELOG.md) for the release history.
8
+
9
+ ## Quick Start
10
+
11
+ ### 1. Install
12
+
13
+ ```bash
14
+ npm install @unified-product-graph/mcp-server
15
+ ```
16
+
17
+ ### 2. Configure your MCP client
18
+
19
+ For Claude Code, add to `.mcp.json`:
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "upg": {
25
+ "command": "npx",
26
+ "args": ["upg-mcp-server"]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ The server auto-discovers `.upg` files in the current directory. To point at a specific file:
33
+
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "upg": {
38
+ "command": "npx",
39
+ "args": ["upg-mcp-server", "--file", "path/to/product.upg"]
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ The config key (`"upg"`) sets the tool prefix your client sees (`mcp__upg__create_node`, etc.). The server identifies itself to the MCP registry as `unified-product-graph`.
46
+
47
+ ### 3. Start using it
48
+
49
+ If no `.upg` file exists, the server creates a blank `product.upg`. Use `create_node` to start building, or invoke one of the five approach verbs (`plan`, `inspect`, `prioritise`, `trace`, `reflect`) to engage the graph cognitively.
50
+
51
+ ## File Discovery
52
+
53
+ The server picks the `.upg` file to load in this order:
54
+
55
+ 1. `--file` flag — use that file directly
56
+ 2. `.upg/workspace.json` — load the default product from a workspace
57
+ 3. `*.upg` files in cwd — first alphabetically
58
+ 4. Otherwise — create a blank `product.upg`
59
+
60
+ ## Conceptual Surface
61
+
62
+ UPG ships five collaborating primitives. The MCP server exposes all five.
63
+
64
+ | Primitive | What it answers |
65
+ |---|---|
66
+ | **Region** | "Where in the graph does this thinking live?" (10 super-domain rollups) |
67
+ | **Framework** | "What does this thinking tool look like?" (large catalog with `approach_ids` tagged where applicable) |
68
+ | **Canonical playbook** | "How do I populate this region from scratch?" (one per region) |
69
+ | **Specialised playbook** | "How do I populate this region using framework X?" |
70
+ | **Approach** | "What's the path of arrival to engaging this region cognitively?" (5: Plan, Inspect, Prioritise, Trace, Reflect) |
71
+
72
+ > An approach is the path of arrival to a region (final approach to an airport, coastline approach), not a strategy choice.
73
+
74
+ ## MCP Tools
75
+
76
+ 90 tools across nine domains. Full reference: [TOOLS.md](./TOOLS.md) — generated from `src/tools/*.ts` and shipped on npm.
77
+
78
+ | Domain | Count | What it covers |
79
+ |---|---|---|
80
+ | Context & Session | 4 | Product overview, graph digest (~500 tokens), lens-aware session state |
81
+ | Nodes | 14 | Read, write, batch, search, migrate, deduplicate entities |
82
+ | Edges | 9 | Create, delete, batch, rename, repair, export edges |
83
+ | Areas & Change Log | 5 | Sub-graph scoping, mutation audit log |
84
+ | Workspace & Portfolios | 9 | Multi-product workspace, portfolio cross-edges |
85
+ | Schema | 1 | Per-type expected properties + valid edges |
86
+ | **Spec Introspection** | **43** | Regions, playbooks, approaches, frameworks, edge catalogue, lenses, type labels, anti-patterns, benchmarks, product stages, entity meta, spec version, migrations, lifecycles, scales, framework categories/patterns, domain rings |
87
+ | Cloud Sync | 3 | Push / pull / sync state (cloud server is a separate package) |
88
+ | Validation | 2 | Whole-graph correctness pass, per-anti-pattern violation report |
89
+
90
+ ### Approaches (5 verb-led tools)
91
+
92
+ Each approach handler returns a family-resemblance envelope `{ approach_id, scope, generated_at, approach, params, execution_mode }`. Handlers provide definition lookup today. The LLM is the executor: read the `signature_hint` and synthesise the structured projection.
93
+
94
+ | Verb | Question | Required args |
95
+ |---|---|---|
96
+ | `plan({ region? })` | "What should I build next?" | none |
97
+ | `inspect({ region?, entities? })` | "What's broken?" | none |
98
+ | `prioritise({ candidates, framework_id })` | "What's most important?" | both |
99
+ | `trace({ anchor, path, edges_override? })` | "Walk a meaningful path through existing graph" | `anchor` + type-shorthand `path` |
100
+ | `reflect({ scope?, mode? })` | "What should I be questioning?" | none (`mode` is one of `assumptions`, `alternatives`, `blind-spots`, `load-bearing`) |
101
+
102
+ `list_approaches({ framework_id? })` and `get_approach({ id })` give the catalog view; the verb tools are the operational surface.
103
+
104
+ ### Spec Introspection (43 tools)
105
+
106
+ Every canonical export from `@unified-product-graph/core` is reachable from the server. Highlights:
107
+
108
+ - **Regions:** `list_regions`, `get_region`, `get_region_for_entity_type`
109
+ - **Playbooks:** `list_playbooks({ region?, canonical_only?, framework_id? })`, `get_playbook`
110
+ - **Approaches:** `list_approaches`, `get_approach` (catalog view of the 5 verbs)
111
+ - **Frameworks:** `list_frameworks`, `get_framework` (large catalog, paginated)
112
+ - **Edges:** `list_edge_types`, `get_edge_type`, `resolve_edge_for_pair`, `list_cross_edge_types`
113
+ - **Lenses:** `list_lenses`, `get_lens` (resolves `visible_types` in one call)
114
+ - **Type labels:** `list_type_labels`, `get_type_label` (framework-aware label resolution)
115
+ - **Hierarchy:** `get_valid_children` ("what can I create under this?")
116
+ - **Entity meta:** `list_entity_types`, `get_entity_meta` (immutable type_id, maturity tier, since-version, replacements)
117
+ - **Domains:** `list_domains` (with `with_guide_only` toggle), `get_domain_guide`
118
+ - **Anti-patterns:** `list_anti_patterns`, `get_anti_pattern` (machine-evaluable conditions, remediation, severity, applicable stages)
119
+ - **Benchmarks:** `list_benchmarks({ kind })` — count / relationship / ratio / domain-activation catalogs (data behind `get_graph_digest` health logic)
120
+ - **Product stages:** `list_product_stages` (canonical 9-stage journey)
121
+ - **Spec version:** `get_spec_version` (UPG version + counts)
122
+
123
+ All spec-introspection handlers are read-only and snapshot from the spec package at server boot. Restart the server to pick up a new spec version.
124
+
125
+ ## Behaviour Notes
126
+
127
+ **Two-tier entity-type validation.** `create_node`, `batch_create_nodes`, and `update_node` (when changing `type`) apply the same validation: deprecated synonyms alias to canonical with a warning (`jtbd → job`, `pain_point → need`, `kpi → metric`, `research_insight → insight`); unknown types throw `UnknownEntityTypeError` with up to 5 Levenshtein-1 suggestions.
128
+
129
+ **Edge inference fails closed.** `inferEdgeType` returns a discriminated union: a miss produces a structured failure with catalog-resolvable suggestions. Alias resolution applies first, so a deprecated source/target like `jtbd → need` resolves through `getReplacementType` before catalog lookup.
130
+
131
+ **Atomic write surfaces.** Every multi-step mutation (`move_node`, `batch_move_nodes`, `update_node` with `type`, `batch_create_nodes` with `edges`) validates against the catalog up front and rolls back fully on any apply-step failure. The graph is bit-for-bit identical to the pre-call state on rejection.
132
+
133
+ **Digest canonical types.** `get_graph_digest` chain coverage sources entity types from the canonical set via `getReplacementType`. Output keys are canonical (`persona_with_job`, `job_with_need`, `job_total`); legacy-typed nodes count toward canonical totals so post-`migrate_type` graphs report correctly.
134
+
135
+ ## Installing Skills (Claude Code)
136
+
137
+ The server provides the raw MCP tools. For a guided experience with slash commands (`/upg`, `/upg-init`, `/upg-journey`), install the skill files:
138
+
139
+ ```bash
140
+ bash scripts/install-skills.sh
141
+ ```
142
+
143
+ The install script supports six AI coding tools: Claude Code, Cursor, Codex CLI, Gemini CLI, OpenCode, and Kiro. Skills are markdown files that layer structured prompts on top of the MCP tools.
144
+
145
+ ## How It Works
146
+
147
+ - The server loads a `.upg` file into memory on startup
148
+ - Reads are served from in-memory indexes (O(1) node/edge lookups)
149
+ - Writes are debounced and auto-saved back to the file (300ms delay)
150
+ - External file changes are detected via filesystem watcher and hot-reloaded
151
+ - Saves use atomic write (write to `.tmp`, then rename) to prevent corruption
152
+ - Spec introspection handlers snapshot from `@unified-product-graph/core` at boot
153
+
154
+ ## Companion Docs
155
+
156
+ - **[TOOLS.md](./TOOLS.md)** — source-of-truth tool reference (auto-generated)
157
+ - **[CHANGELOG.md](./CHANGELOG.md)** — release history
158
+ - **[unifiedproductgraph.org](https://unifiedproductgraph.org)** — the UPG specification and conceptual model
159
+
160
+ ## Spec
161
+
162
+ The Unified Product Graph format is documented at [unifiedproductgraph.org](https://unifiedproductgraph.org).
163
+
164
+ ## License
165
+
166
+ MIT — see [LICENSE](./LICENSE).