Skip to content

Commit 6488a9a

Browse files
committed
scripts(docs[mcp_swap]): clarify global-config + simple-detection scope
The script's previous docstring implied broad cross-CLI parity with the actual CLIs' install/discovery surface. In practice it writes only to the four canonical *global* config paths and probes binaries via ``shutil.which`` + file-exists. Workspace configs (``$PWD/.cursor/mcp.json``, ``$PWD/.gemini/settings.json``), npm prefixes, Homebrew paths, and post-migration locations like ``~/.claude/local/claude`` are intentionally not handled — those match each CLI's native installer logic, which this script does not duplicate. Add an explicit "Scope" section to the module docstring and an "Out of scope" subsection to ``scripts/README.md`` so contributors know where to use ``cursor mcp add`` / ``gemini mcp add`` directly. No behaviour change.
1 parent 58a0ce2 commit 6488a9a

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

scripts/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ invocation with no reinstall step.
5959

6060
### Scope
6161

62-
Covers four CLIs and their canonical config paths:
62+
Covers four CLIs and their canonical **global** config paths:
6363

6464
| CLI | Config | Format |
6565
|--------|-------------------------------|--------|
@@ -72,6 +72,19 @@ Claude's config is keyed per-project under the repo's absolute path — the
7272
script writes only under the current repo's key, leaving other projects'
7373
entries untouched.
7474

75+
#### Out of scope (use the CLI's native command)
76+
77+
- **Workspace / project-local configs** for Cursor and Gemini
78+
(`$PWD/.cursor/mcp.json`, `$PWD/.gemini/settings.json`). When
79+
workspace precedence matters, use `cursor mcp add` / `gemini mcp add`
80+
directly — workspace files take precedence over the global ones this
81+
script writes.
82+
- **Custom binary install locations.** Detection is `shutil.which` plus
83+
the file existing at the configured global path. Homebrew, npm
84+
prefixes (`~/.npm-global/bin`), and post-migration paths
85+
(`~/.claude/local/claude`, `~/.gemini/local/gemini`) are picked up
86+
only when the binary is already on `PATH`.
87+
7588
### Extending to a new CLI
7689

7790
Add an entry to the `CLIS` table in `mcp_swap.py` and extend the three

scripts/mcp_swap.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,29 @@
2525
$ uv run scripts/mcp_swap.py use-local
2626
$ uv run scripts/mcp_swap.py revert
2727
```
28+
29+
Scope
30+
-----
31+
This script is best-effort and intentionally narrow:
32+
33+
- **Global configs only.** Writes to ``~/.cursor/mcp.json``,
34+
``~/.claude.json``, ``~/.codex/config.toml``, and
35+
``~/.gemini/settings.json``. Workspace / project-local configs
36+
(``$PWD/.cursor/mcp.json``, ``$PWD/.gemini/settings.json``,
37+
per-project ``projects.<abs>.mcpServers`` entries inside
38+
``~/.claude.json`` *are* recognised for Claude only) are NOT
39+
walked — workspace files for Cursor/Gemini are silently ignored.
40+
When workspace precedence matters, run the CLI's own
41+
``cursor mcp add ...`` / ``gemini mcp add ...`` directly.
42+
- **Simple binary detection.** Probing is ``shutil.which(<binary>)``
43+
plus ``<config_path>.exists()``. Custom install locations
44+
(Homebrew, npm prefixes, ``~/.npm-global/bin``,
45+
``~/.claude/local/claude``, ``~/.gemini/local/gemini``) are picked
46+
up only if the binary is on ``PATH``. FastMCP's installer probes
47+
these locations directly; this script does not.
48+
- **Single config shape per CLI.** No fallback paths, no merge of
49+
multiple sources. If your setup deviates from the defaults above,
50+
use the CLI's native ``mcp`` subcommand instead.
2851
"""
2952

3053
from __future__ import annotations

0 commit comments

Comments
 (0)