@@ -89,3 +89,75 @@ generated config and `.forge/` artifacts are ignored correctly for your setup.
8989``` bash
9090forge tools
9191```
92+
93+ ## ` forge integrations `
94+
95+ Opt-in third-party MCP servers (for example ` context7 ` ), managed non-destructively across
96+ every tool Forge emits config for — Claude Code, Codex, Cursor, Gemini, Continue, and the
97+ rest.
98+
99+ Third-party MCP servers are ** not** installed by default. Nothing lands on disk until you
100+ run ` forge integrations add <name> --yes ` .
101+
102+ ``` bash
103+ forge integrations # list opt-in servers with package + purpose
104+ forge integrations add < name> # dry-run: prints package, network, files it would touch
105+ forge integrations add < name> --yes # apply — write MCP config for every tool
106+ forge integrations add < name> --yes --adopt # also claim a same-name entry you already configured
107+ forge integrations remove < name> # reverse the add — deletes only forge-owned entries
108+ ```
109+
110+ ### What ` add ` writes
111+
112+ ` add --yes ` writes the server into every tool's native MCP config from one canonical
113+ spec:
114+
115+ - ` .mcp.json ` (Claude Code)
116+ - ` .cursor/mcp.json ` (Cursor)
117+ - ` .gemini/settings.json ` (Gemini)
118+ - ` .codex/config.toml ` — as a ` # forge:managed:<name> ` block, refreshed by byte-compare
119+ - ` .continue/mcpServers/<name>.yaml ` — one forge-marked YAML per managed server
120+ - and the rest of the tools Forge emits config for
121+
122+ The installed set is recorded in ` .forge/forge.config.json ` under ` mcp.integrations ` , so
123+ every subsequent ` forge sync ` re-emits the same servers. The stop-hook auto-sync
124+ byte-compares the whole config file, so a hand-edit to that file is detected and
125+ repaired.
126+
127+ ### ` --adopt ` semantics
128+
129+ If a server with the same name already exists in one of the tool config files and Forge
130+ did not put it there, ` add ` ** does not overwrite it** . Instead it reports the file with an
131+ ` --adopt ` hint. Re-run with ` --adopt ` to claim ownership — Forge records the entry under
132+ ` mcp.adopted ` in ` .forge/forge.config.json ` and will manage it from then on.
133+
134+ Use ` --adopt ` when you configured a server by hand earlier and now want Forge to keep it
135+ in sync across every tool.
136+
137+ ### ` remove `
138+
139+ ` forge integrations remove <name> ` reverses an add. It deletes only forge-owned entries,
140+ blocks, and files — a same-name server the user configured (and never ` --adopt ` ed) is
141+ left alone. Running ` remove ` twice is a no-op.
142+
143+ ``` bash
144+ forge integrations remove context7
145+ ```
146+
147+ ### ` .forge/forge.config.json `
148+
149+ Per-repo Forge state — the unified config that also holds ` primaryTool ` , ` tools ` , and
150+ ` profile ` — records opt-in integrations under two keys:
151+
152+ ``` json
153+ {
154+ "mcp" : {
155+ "integrations" : [" context7" ],
156+ "adopted" : []
157+ }
158+ }
159+ ```
160+
161+ Unknown keys round-trip through writes. A malformed file is not silently discarded:
162+ reads warn once per process on stderr, and writers refuse to overwrite an unparseable
163+ config instead of replacing it with defaults.
0 commit comments