Purpose
-------
Implements the ``oct install-mcp`` CLI subcommand. Detects the target
AI host (Claude Code, Cursor, VS Code, or ``auto``) and writes (or
previews) the ``oct-mcp`` server entry into the host's MCP config file.
Responsibilities
----------------
- Define :data:`MCP_HOSTS` mapping each supported host to its config
file location(s) and the JSON schema for the ``oct-mcp`` entry.
- Implement :func:`run_install_mcp` which detects the host config path,
merges the ``oct-mcp`` server entry, and writes the result (or
previews it in dry-run mode).
- Print a human-readable summary of what was / would be changed.
Diagnostics
-----------
Domain: OCT-CLI
Levels:
L2 — lifecycle: file read, file written
Contracts
---------
- This module does not import ``click`` or any MCP SDK.
- Writes only to known, allowlisted config file paths — never to
arbitrary locations (design decision D-5B-7).
- ``dry_run=True`` (the default) never modifies any file.
- If the host config file already contains an ``oct-mcp`` server entry,
the entry is updated in-place without duplicating it.
| int install_mcp.run_install_mcp |
( |
str | host, |
|
|
Path | project_root, |
|
|
bool | dry_run = True ) |
Install or preview the oct-mcp server entry for the given host.
Parameters
----------
host
One of ``"claude-code"``, ``"cursor"``, ``"vscode"``, or
``"auto"`` (auto-detect).
project_root
Absolute project root path (used as ``--project-root`` arg in
the server entry).
dry_run
When ``True`` (the default), print what would be written without
modifying any files.
Returns
-------
Exit code: 0 on success, 1 on failure.
Definition at line 157 of file install_mcp.py.