@radicaltools/mcp 0.0.0-stage → 0.2.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 (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -2
  3. package/dist/chunk-OGN3UW2D.js +2594 -0
  4. package/dist/elkLayout-S62RLGTO.js +8 -0
  5. package/dist/hub-catalogue/adr/adr-api-versioning.radical +53 -0
  6. package/dist/hub-catalogue/adr/adr-auth-strategy.radical +53 -0
  7. package/dist/hub-catalogue/adr/adr-caching-strategy.radical +59 -0
  8. package/dist/hub-catalogue/adr/adr-data-consistency-model.radical +40 -0
  9. package/dist/hub-catalogue/adr/adr-data-store.radical +47 -0
  10. package/dist/hub-catalogue/adr/adr-deployment-strategy.radical +53 -0
  11. package/dist/hub-catalogue/adr/adr-event-schema-evolution.radical +53 -0
  12. package/dist/hub-catalogue/adr/adr-integration-style.radical +50 -0
  13. package/dist/hub-catalogue/adr/adr-ledger-reconciliation-strategy.radical +38 -0
  14. package/dist/hub-catalogue/adr/adr-llm-provider-strategy.radical +40 -0
  15. package/dist/hub-catalogue/adr/adr-marketplace-payments-model.radical +39 -0
  16. package/dist/hub-catalogue/adr/adr-multi-region.radical +60 -0
  17. package/dist/hub-catalogue/adr/adr-multi-tenancy-strategy.radical +41 -0
  18. package/dist/hub-catalogue/adr/adr-observability.radical +59 -0
  19. package/dist/hub-catalogue/adr/adr-realtime-transport.radical +38 -0
  20. package/dist/hub-catalogue/adr/adr-tech-stack.radical +45 -0
  21. package/dist/hub-catalogue/adr/adr-zero-trust-network.radical +40 -0
  22. package/dist/hub-catalogue/blueprint/bp-ai-assistant-platform.radical +1641 -0
  23. package/dist/hub-catalogue/blueprint/bp-analytical-data-platform.radical +1428 -0
  24. package/dist/hub-catalogue/blueprint/bp-ecommerce-platform.radical +1989 -0
  25. package/dist/hub-catalogue/blueprint/bp-fintech-ledger-platform.radical +1701 -0
  26. package/dist/hub-catalogue/blueprint/bp-marketplace-platform.radical +1792 -0
  27. package/dist/hub-catalogue/blueprint/bp-realtime-collaboration.radical +1421 -0
  28. package/dist/hub-catalogue/blueprint/bp-saas-b2b-platform.radical +1713 -0
  29. package/dist/hub-catalogue/fitness-function/ff-accessibility-scan.radical +34 -0
  30. package/dist/hub-catalogue/fitness-function/ff-ai-eval-gate.radical +52 -0
  31. package/dist/hub-catalogue/fitness-function/ff-api-contract.radical +36 -0
  32. package/dist/hub-catalogue/fitness-function/ff-capacity-load-test.radical +67 -0
  33. package/dist/hub-catalogue/fitness-function/ff-carbon-footprint-guard.radical +62 -0
  34. package/dist/hub-catalogue/fitness-function/ff-change-failure-rate.radical +45 -0
  35. package/dist/hub-catalogue/fitness-function/ff-chaos-resilience-test.radical +53 -0
  36. package/dist/hub-catalogue/fitness-function/ff-cost-efficiency-guard.radical +64 -0
  37. package/dist/hub-catalogue/fitness-function/ff-coupling-guard.radical +45 -0
  38. package/dist/hub-catalogue/fitness-function/ff-data-integrity-check.radical +51 -0
  39. package/dist/hub-catalogue/fitness-function/ff-data-residency.radical +43 -0
  40. package/dist/hub-catalogue/fitness-function/ff-dependency-rules.radical +37 -0
  41. package/dist/hub-catalogue/fitness-function/ff-deploy-frequency.radical +46 -0
  42. package/dist/hub-catalogue/fitness-function/ff-dr-drill-success.radical +52 -0
  43. package/dist/hub-catalogue/fitness-function/ff-duplication-guard.radical +53 -0
  44. package/dist/hub-catalogue/fitness-function/ff-error-budget.radical +59 -0
  45. package/dist/hub-catalogue/fitness-function/ff-fail-safe-verification.radical +34 -0
  46. package/dist/hub-catalogue/fitness-function/ff-infra-drift.radical +34 -0
  47. package/dist/hub-catalogue/fitness-function/ff-latency-slo.radical +59 -0
  48. package/dist/hub-catalogue/fitness-function/ff-lead-time.radical +44 -0
  49. package/dist/hub-catalogue/fitness-function/ff-ledger-balance-integrity.radical +45 -0
  50. package/dist/hub-catalogue/fitness-function/ff-license-compliance.radical +43 -0
  51. package/dist/hub-catalogue/fitness-function/ff-mttr.radical +45 -0
  52. package/dist/hub-catalogue/fitness-function/ff-noisy-neighbor-guard.radical +66 -0
  53. package/dist/hub-catalogue/fitness-function/ff-sast-scan.radical +35 -0
  54. package/dist/hub-catalogue/fitness-function/ff-scale-out-verification.radical +66 -0
  55. package/dist/hub-catalogue/fitness-function/ff-security-scan.radical +45 -0
  56. package/dist/hub-catalogue/fitness-function/ff-startup-shutdown-check.radical +66 -0
  57. package/dist/hub-catalogue/fitness-function/ff-sync-convergence-test.radical +45 -0
  58. package/dist/hub-catalogue/fitness-function/ff-test-coverage.radical +43 -0
  59. package/dist/hub-catalogue/fitness-function/ff-web-vitals.radical +57 -0
  60. package/dist/hub-catalogue/pattern/pattern-anti-corruption-layer.radical +88 -0
  61. package/dist/hub-catalogue/pattern/pattern-api-gateway.radical +168 -0
  62. package/dist/hub-catalogue/pattern/pattern-bff.radical +179 -0
  63. package/dist/hub-catalogue/pattern/pattern-bulkhead.radical +114 -0
  64. package/dist/hub-catalogue/pattern/pattern-circuit-breaker.radical +219 -0
  65. package/dist/hub-catalogue/pattern/pattern-cqrs.radical +195 -0
  66. package/dist/hub-catalogue/pattern/pattern-crdt-sync.radical +200 -0
  67. package/dist/hub-catalogue/pattern/pattern-event-driven.radical +210 -0
  68. package/dist/hub-catalogue/pattern/pattern-event-sourced-ledger.radical +211 -0
  69. package/dist/hub-catalogue/pattern/pattern-hexagonal.radical +196 -0
  70. package/dist/hub-catalogue/pattern/pattern-microservices.radical +262 -0
  71. package/dist/hub-catalogue/pattern/pattern-rag-pipeline.radical +213 -0
  72. package/dist/hub-catalogue/pattern/pattern-rate-limiter.radical +114 -0
  73. package/dist/hub-catalogue/pattern/pattern-saga.radical +208 -0
  74. package/dist/hub-catalogue/pattern/pattern-sidecar.radical +123 -0
  75. package/dist/hub-catalogue/pattern/pattern-strangler-fig.radical +227 -0
  76. package/dist/hub-catalogue/pattern/pattern-transactional-outbox.radical +209 -0
  77. package/dist/hub-catalogue/requirement/req-accessibility.radical +48 -0
  78. package/dist/hub-catalogue/requirement/req-ai-autonomous-resolution.radical +51 -0
  79. package/dist/hub-catalogue/requirement/req-ai-groundedness.radical +45 -0
  80. package/dist/hub-catalogue/requirement/req-ai-human-handoff.radical +46 -0
  81. package/dist/hub-catalogue/requirement/req-alerting.radical +52 -0
  82. package/dist/hub-catalogue/requirement/req-api-response-time.radical +51 -0
  83. package/dist/hub-catalogue/requirement/req-api-standard.radical +45 -0
  84. package/dist/hub-catalogue/requirement/req-audit-logging.radical +43 -0
  85. package/dist/hub-catalogue/requirement/req-auth-response-time.radical +45 -0
  86. package/dist/hub-catalogue/requirement/req-auth.radical +43 -0
  87. package/dist/hub-catalogue/requirement/req-autoscaling.radical +62 -0
  88. package/dist/hub-catalogue/requirement/req-availability.radical +50 -0
  89. package/dist/hub-catalogue/requirement/req-backward-compatibility.radical +46 -0
  90. package/dist/hub-catalogue/requirement/req-batch-job-completion.radical +50 -0
  91. package/dist/hub-catalogue/requirement/req-carbon-efficiency.radical +64 -0
  92. package/dist/hub-catalogue/requirement/req-centralised-logging.radical +45 -0
  93. package/dist/hub-catalogue/requirement/req-ci-pipeline-time.radical +43 -0
  94. package/dist/hub-catalogue/requirement/req-code-complexity.radical +43 -0
  95. package/dist/hub-catalogue/requirement/req-config-propagation.radical +45 -0
  96. package/dist/hub-catalogue/requirement/req-data-integrity.radical +35 -0
  97. package/dist/hub-catalogue/requirement/req-data-retention.radical +44 -0
  98. package/dist/hub-catalogue/requirement/req-db-query-response.radical +44 -0
  99. package/dist/hub-catalogue/requirement/req-disaster-recovery.radical +59 -0
  100. package/dist/hub-catalogue/requirement/req-distributed-tracing.radical +45 -0
  101. package/dist/hub-catalogue/requirement/req-encryption.radical +49 -0
  102. package/dist/hub-catalogue/requirement/req-error-rate.radical +45 -0
  103. package/dist/hub-catalogue/requirement/req-error-recovery.radical +34 -0
  104. package/dist/hub-catalogue/requirement/req-event-schema-compatibility.radical +37 -0
  105. package/dist/hub-catalogue/requirement/req-fail-safe-default.radical +55 -0
  106. package/dist/hub-catalogue/requirement/req-fast-startup-graceful-shutdown.radical +69 -0
  107. package/dist/hub-catalogue/requirement/req-gdpr-erasure.radical +44 -0
  108. package/dist/hub-catalogue/requirement/req-graceful-degradation.radical +39 -0
  109. package/dist/hub-catalogue/requirement/req-health-checks.radical +43 -0
  110. package/dist/hub-catalogue/requirement/req-iac.radical +36 -0
  111. package/dist/hub-catalogue/requirement/req-idempotency.radical +47 -0
  112. package/dist/hub-catalogue/requirement/req-input-validation.radical +37 -0
  113. package/dist/hub-catalogue/requirement/req-least-privilege.radical +47 -0
  114. package/dist/hub-catalogue/requirement/req-ledger-immutability.radical +38 -0
  115. package/dist/hub-catalogue/requirement/req-mfa.radical +36 -0
  116. package/dist/hub-catalogue/requirement/req-ml-extraction-accuracy.radical +42 -0
  117. package/dist/hub-catalogue/requirement/req-onboarding-time.radical +42 -0
  118. package/dist/hub-catalogue/requirement/req-page-load-time.radical +59 -0
  119. package/dist/hub-catalogue/requirement/req-payout-latency.radical +46 -0
  120. package/dist/hub-catalogue/requirement/req-presence-latency.radical +46 -0
  121. package/dist/hub-catalogue/requirement/req-rate-limiting.radical +45 -0
  122. package/dist/hub-catalogue/requirement/req-report-generation.radical +44 -0
  123. package/dist/hub-catalogue/requirement/req-resource-efficiency.radical +64 -0
  124. package/dist/hub-catalogue/requirement/req-resource-headroom.radical +53 -0
  125. package/dist/hub-catalogue/requirement/req-resource-isolation.radical +37 -0
  126. package/dist/hub-catalogue/requirement/req-search-response-time.radical +44 -0
  127. package/dist/hub-catalogue/requirement/req-secrets-management.radical +45 -0
  128. package/dist/hub-catalogue/requirement/req-task-success-rate.radical +42 -0
  129. package/dist/hub-catalogue/requirement/req-test-coverage.radical +42 -0
  130. package/dist/hub-catalogue/requirement/req-throughput.radical +55 -0
  131. package/dist/hub-catalogue/requirement/req-vulnerability-scanning.radical +52 -0
  132. package/dist/hub-catalogue/requirement/req-zero-downtime-deploy.radical +39 -0
  133. package/dist/index.js +19422 -0
  134. package/package.json +48 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 radical.tools contributors
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 CHANGED
@@ -1,3 +1,149 @@
1
- # Temporary Holding Version
1
+ # Radical folder MCP server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This local stdio MCP server lets Codex read and edit one Radical **Markdown model folder**. Point it at a folder containing `radical.md`, `nodes/**/*.md` and the JSON sidecars, or at an empty or missing folder, which becomes a new model. Studio's browser folder watcher reloads outside edits on its normal poll, so changes appear on the open canvas without a separate browser connection.
4
+
5
+ ## Install and connect
6
+
7
+ Use Node.js 20.11 or newer. Run the published server without cloning this repository:
8
+
9
+ ```sh
10
+ npx -y @radicaltools/mcp --folder /absolute/path/to/my-model
11
+ ```
12
+
13
+ For reproducible setups, pin a version, for example `@radicaltools/mcp@0.2.0`.
14
+ To connect a coding agent, use `npx` as the command, with
15
+ `["-y", "@radicaltools/mcp@0.2.0", "--folder", "/absolute/path/to/my-model"]`
16
+ as its arguments. On Windows, use `npx.cmd` as the command and an absolute Windows
17
+ folder path. The server waits for MCP messages on stdin and prints no banner to stdout.
18
+
19
+ ## Build from source
20
+
21
+ From the repository root:
22
+
23
+ ```sh
24
+ npm install
25
+ npm run build -w @radicaltools/mcp
26
+ node apps/mcp/dist/index.js --folder /absolute/path/to/my-model
27
+ ```
28
+
29
+ The last command waits for MCP messages on stdin; it prints no banner to stdout. `--folder` may be relative to the directory the server starts in. A missing or empty folder (dot files such as `.git` don't count) becomes a new, empty model; `--metamodel radical` or `c4` picks its metamodel (default `radical`, the Radical metamodel Studio starts new models with). A folder with other files and no `radical.md` is refused. To connect Codex, run the following with absolute paths (or add the equivalent `command` and `args` in [Codex's MCP configuration](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)):
30
+
31
+ ```sh
32
+ codex mcp add radical-folder -- node /absolute/path/to/radical.tools/apps/mcp/dist/index.js --folder /absolute/path/to/my-model
33
+ codex mcp list
34
+ ```
35
+
36
+ Claude Code takes the same command (`claude mcp add radical-folder -- node … --folder …`). For Claude Desktop, add it under `mcpServers` in `~/Library/Application Support/Claude/claude_desktop_config.json`, with an absolute path to `node`, because the app does not see your shell's `PATH`.
37
+
38
+ Launch Studio with `npm run dev:web` from the repository root, open it in Chromium, and open the **same OS folder** via the Models dialog. The browser asks for File System Access permission. The MCP server cannot access a browser-only OPFS folder. Ask the client to use `get_model_summary` first, then `search_model` or the node/relation tools.
39
+
40
+ ## Tool and file behavior
41
+
42
+ The server binds to one folder at launch, then reads it afresh for every tool call. Its tools are the shared AI tool catalogue from `@radical/common/ai/tools`, the one Studio's AI chat and Radical Forge use, minus the canvas-only `set_active_view` and `focus_node` and the destructive `reset_diagram`. It provides:
43
+
44
+ - `get_model_summary` (counts, views, sequences, milestones, presentations, the modelling rules Studio's chat and Forge follow, and the metamodel rules) and `search_model` (a small query language, including `LIST SEQUENCES` and `GET SEQUENCE`);
45
+ - the `forge_*` tools: a Radical Forge run with the agent's model, ending with a Review stage over the whole model. Each stage may fill gaps in earlier stages, but only by asking: `forge_propose_refinement` checks a proposal and returns exactly what it would write, for the agent to show the user, and `forge_answer_refinement` writes it only if the user accepts (while a stage is open the server refuses direct writes to earlier stages, and every write while a proposal waits for its answer). `forge_complete_stage` lists what the stage refined, with the gaps the completeness rules still find. In a folder with no base from git, `forge_start` saves the model as it was before the run to `.radical/base.json`, so Studio's Changes on branch shows the run. After every step the server writes where the run stands to `.radical/forge-run.json` (next to the selection, also out of git), and marks it closed when the client goes away, so Studio open on the folder can show it on its Forge button;
46
+ - `get_issues`: every rule the model breaks now, as the Validation list in Studio's metamodel editor shows it. A write is refused when it brings in a new error; the warnings it brings in (a state machine without an initial state, a reference to no node, …) come back with its result, since a model is often incomplete while it is being built;
47
+ - `get_selection`: what is selected on Studio's canvas for this folder (the view on screen, each selected node in full, selected relations), so you can say "fix the selected mockup" instead of naming it. Studio writes it to `.radical/selection.json` in the model folder whenever the selection or the view changes, and clears it when you switch to another model; `.radical/` carries its own `.gitignore`, and the file is not part of the model, so writing it never conflicts with model edits;
48
+ - `get_changes`: what changed in the model since its version in git, for an agent asked to implement a change made in the model. It lists the elements and relations added, removed and changed (uncommitted edits included), each changed field with its old and new value, and each element with its place and its relations, such as the component that satisfies a requirement and the scenarios that verify it. Views, positions, sizes and folding are left out. `since` names the branch, tag or commit to compare with; by default it is the merge base with the default branch (`origin/main`), so every model change on the branch counts. `radical diff` prints the same list. Without `since` it also saves that base to `.radical/base.json`, for Studio to show the same changes (Changes on branch);
49
+ - `add_`, `update_` and `delete_` tools for nodes and relations, and `move_node` to change a node's parent (it keeps the node's canvas position and enforces the metamodel's `allowedParents`). A reference property (a transition's `event` and `raises`) takes node ids or tempIds from the same connection and refuses a node of the wrong type;
50
+ - `create_view`, `update_view` (name, folder in the list of views, line style, kind, linked sequence, hidden relations, elements shown open or folded, filter chain, or `viewpoint`: one of the metamodel's viewpoints, whose kind and chain the view then follows; `null` keeps them for the view alone), `set_view_nodes`, `order_views` (the order of views, and so of their folders) and `delete_view`;
51
+ - `create_sequence`, `update_sequence` and `delete_sequence`: ordered relation flows that a `dynamic` view plays;
52
+ - `create_presentation`, `update_presentation` and `delete_presentation`: slides over views, which Studio frames to fit the whole view or the slide's `focus` elements (several slides can zoom onto parts of one view), showing the current model or a `milestone`;
53
+ - `list_milestones`, `create_milestone`, `update_milestone`, `delete_milestone` and `compare_milestones`: named copies of the model at phases of the system ("As-is", "Target 2027"). `create_milestone` saves the current model as the latest one and `compare_milestones` lists what changed; no tool loads a milestone over the current model, which stays in Studio's timeline;
54
+ - `upsert_viewpoint` and `delete_viewpoint`: viewpoints of the metamodel, a view type and a filter chain under a name (given as `pipeline` or copied from a view with `fromViewId`), in a `group` such as `C4` or `Requirements`. Studio's New view offers them, and the views of a type follow its changes; a deleted type leaves its views their kind and chain. They do not copy a built-in metamodel: a model keeps its own viewpoints when Studio swaps the preset in;
55
+ - `upsert_node_type`, `delete_node_type`, `upsert_relation_type` and `delete_relation_type`. A type takes a `description` (what it is; the wiki view shows it), a relation type also `forwardLabel` and `inverseLabel` (how it reads in a sentence from its source and from its target). A built-in metamodel is copied to a `…-custom` id on the first edit, because Studio replaces built-in metamodels with their preset on load. After a metamodel change (from these tools or from Studio) the server re-advertises the node and relation tool schemas;
56
+ - `smart_layout`, for All elements or one static or dynamic view (`viewId`), which then gets its own saved positions;
57
+ - `align_nodes` (a row or a column, with `keepOrder` to keep the listed order), `grid_nodes` (`columns` columns, filled row by row) and `remove_alignment`, for All elements or one view (`viewId`). Studio and `smart_layout` keep these rules in every later layout.
58
+
59
+ These use Studio's shared schemas and model rules. Besides counts, `get_model_summary` returns the metamodel context message the other tool descriptions refer to: each type's property keys and enum options, allowed parents, cardinality and relation pairs. The server's MCP instructions tell clients to call it first. New nodes are placed inside their parent below its header (root nodes to the right of the existing ones), and every parent a change adds to, moves or removes from is refitted to its children. `smart_layout` runs Studio's Smart Layout over the whole model (the **All elements** arrangement) and saves the result; views with their own saved positions keep them. On a large model it can take minutes: a client that sends a progress token gets a progress notification per step, and a cancelled call (or a client that disconnects) stops at the next step without writing anything. The server exits when the client closes its end. Writes also update `defaultPositions`, which Studio restores when you switch back to **All elements**. `add_node` returns the persisted real ID, and a `tempId` can be used in later calls on the same MCP connection. Newly added nodes appear in Studio's **All elements** view until a view lists them. The server refreshes its model data per call.
60
+
61
+ Writes preserve unrelated files and the existing `radical.md` text. A tool reports success only after the changed model files are written. If a file changed between the server's read and write, it returns a conflict without writing. Studio's external-change reload no longer queues an autosave of the loaded data. After such a reload Studio highlights what changed for about five seconds (new and changed elements badged, removed ones as ghosts; layout alone shows nothing), so you can follow an agent at work.
62
+
63
+ For now, keep Studio in **viewer use while the MCP client writes**. Folder writes span several files, and Studio and MCP do not share a cross-process transaction lock. Editing the same folder simultaneously from both can still race; the stamp check only catches changes visible before a write begins. Single `.radical` JSON files, loading a milestone over the current model (the milestone tools save, list, rename, delete and compare them), commands that drive Studio's canvas, and remote HTTP MCP are not supported by this server.
64
+
65
+ Run `npm run test -w @radicaltools/mcp` to build and exercise a real stdio connection and temporary disk folder.
66
+
67
+ ## Publishing (maintainers)
68
+
69
+ The package is published under the `radicaltools` npm organization. The earlier
70
+ `@radical.tools/mcp` releases have a separate npm identity; their versions and
71
+ Trusted Publishing settings do not transfer to `@radicaltools/mcp`. Switching
72
+ clients requires replacing the package name in their `npx` configuration.
73
+
74
+ The package contains only its ESM build, the Hub catalogue, this README, its
75
+ manifest and the MIT license. The four private `@radical/*` workspaces are build
76
+ dependencies bundled by tsup; users install only the MCP SDK and ELK.js as runtime
77
+ dependencies. `prepack` builds from source, clears old build output and copies
78
+ the catalogue and root license. The MCP handshake reports the package version.
79
+
80
+ Before the first release, from the repository root:
81
+
82
+ ```sh
83
+ npm ci --ignore-scripts
84
+ npm run check:workspaces
85
+ npm run typecheck
86
+ npm test
87
+ npm run test:package -w ./apps/mcp -- --out-dir ../../release
88
+ ```
89
+
90
+ The last command builds and packs the package, installs it with production
91
+ dependencies in a temporary project outside this repository, then starts its
92
+ installed executable over stdio. It checks the handshake, disk writes and reload,
93
+ Smart Layout's lazy-loaded chunks, and Forge's bundled Hub catalogue. Only after
94
+ those checks pass does it copy the verified tarball into `release/`. The same
95
+ check runs on Linux and Windows with Node 20 and 24 in CI.
96
+
97
+ Log in to npm with the account that owns the `radicaltools` organization and
98
+ publish the verified first-release archive, completing npm's 2FA challenge:
99
+
100
+ ```sh
101
+ npm login --auth-type=web
102
+ npm whoami
103
+ npm publish ./release/radicaltools-mcp-0.2.0.tgz --access public
104
+ ```
105
+
106
+ Do this after the pull request is merged, from the reviewed main commit. A name
107
+ and version can only be published once. For later releases, bump only this
108
+ workspace's version (and the lockfile) in a pull request:
109
+
110
+ ```sh
111
+ npm version patch -w ./apps/mcp --no-git-tag-version
112
+ ```
113
+
114
+ ### GitHub Actions with Trusted Publishing
115
+
116
+ After `@radicaltools/mcp` exists, open its npm **Settings → Trusted publishing**
117
+ and add GitHub Actions with these values:
118
+
119
+ | Field | Value |
120
+ | --- | --- |
121
+ | Organization or user | `radicaltools` |
122
+ | Repository | `radical.tools` |
123
+ | Workflow filename | `npm-publish.yml` |
124
+ | Environment name | Leave empty |
125
+ | Allowed actions | Enable direct publishing with `npm publish` |
126
+
127
+ The shared workflow publishes either CLI or MCP. If the existing trusted
128
+ publisher points at `mcp-publish.yml`, replace it with one using
129
+ `npm-publish.yml` after merging this change. Trusted publishers are configured
130
+ per npm package, even though both packages use the same workflow.
131
+
132
+ No npm token or GitHub secret is needed. npm requires Node 22.14+ and npm 11.5.1+
133
+ for Trusted Publishing; the workflow uses Node 24 and npm 11, and gives only the
134
+ publish job `id-token: write`. A new trusted publisher must complete its first
135
+ successful publish within two days, so configure it when the next version is
136
+ ready. See [npm's Trusted Publishing instructions](https://docs.npmjs.com/trusted-publishers/).
137
+
138
+ If npm shows **Pending validation**, publish a new version through this workflow
139
+ before the deadline shown in npm. A dry run or a local `npm publish` does not
140
+ validate the OIDC connection. The workflow needs direct `npm publish` permission;
141
+ `npm stage publish` alone is insufficient, and managing dist-tags is not needed.
142
+
143
+ In GitHub **Actions → Publish to npm → Run workflow**, select `main`, choose
144
+ **package: mcp**, and leave **dry-run** enabled to verify and upload the package
145
+ without publishing. For a
146
+ reviewed version bump, run it with **dry-run** disabled. Actual publishing is
147
+ refused on any branch other than `main`. The workflow type-checks and tests the
148
+ monorepo, verifies the installable tarball, and publishes that same archive with
149
+ provenance. Pushing a branch or a desktop `v*` tag does not publish the MCP package.