Skip to content

Add --install CLI flag for MCP client auto-registration#54

Merged
danielealbano merged 11 commits intomainfrom
feat/cli-install-flag
Mar 12, 2026
Merged

Add --install CLI flag for MCP client auto-registration#54
danielealbano merged 11 commits intomainfrom
feat/cli-install-flag

Conversation

@danielealbano
Copy link
Owner

@danielealbano danielealbano commented Mar 12, 2026

Summary

  • Adds --install <target> CLI flag for auto-registering the MCP server with 6 clients: Claude Code, Claude Desktop, Cursor, VS Code, gemini-cli, and Codex CLI
  • Generates correct JSON (mcpServers/servers) or TOML (mcp_servers) config files per target, preserves existing config content, creates parent directories
  • Includes 25 unit tests covering all targets, edge cases (malformed input, empty files, re-install), and path resolution
  • Adds 3 E2E testcontainers tests (Claude Code, Cursor CLI, gemini-cli) to verify config format compatibility with real CLI tools
  • Restructures README MCP Configuration section with all 6 targets, macOS/Windows binary paths, and quick --install setup guide
  • Updates docs/PROJECT.md and docs/ARCHITECTURE.md with new dependencies and module

Test plan

  • make fmt passes
  • make lint passes (zero clippy warnings)
  • make test passes (84 unit tests + 80 integration tests)
  • make build passes
  • make test-e2e — requires Docker and pre-built images (run manually)

Plan: docs/plans/3_cli_install_flag_mcp_client_config_20260312160258.md

Adds plan document covering: --install <target> CLI flag for auto-registering
with 6 MCP clients (Claude Code, Claude Desktop, Cursor, VS Code, gemini-cli,
Codex CLI), E2E testcontainers tests, and README restructure.
Implements the install module (src/install.rs) with support for 6 targets:
claude-code, claude-desktop, cursor, vscode, codex, gemini-cli. Generates
correct JSON (mcpServers/servers) or TOML (mcp_servers) config files per
target, preserves existing config content, and creates parent directories.
Includes comprehensive unit tests for all targets and edge cases.
Adds testcontainers dev-dependency, Dockerfiles for Claude Code, Cursor CLI,
and gemini-cli test images, and E2E tests that verify generated configs are
recognized by real CLI tools inside containers. Tests are #[ignore] and run
via make test-e2e. Updates Makefile with test-e2e-build and test-e2e targets.
Replaces the single Claude Desktop config example with comprehensive
documentation covering all 6 supported targets (Claude Code, Claude Desktop,
Cursor, VS Code, gemini-cli, Codex CLI). Adds quick setup via --install flag,
macOS/Windows binary paths. Updates PROJECT.md with new deps and CLI flag,
ARCHITECTURE.md with install.rs and test infrastructure.
Fix mutability and temporary lifetime issues in test_install_e2e.rs.
All quality gates pass: fmt, lint, test (84 unit + 80 integration),
build. Mark all plan checkmarks as complete.
Cargo.lock updated with new dependency resolutions (dirs, toml, tempfile,
testcontainers and their transitive dependencies). Source files reformatted
by cargo fmt.
The InstallError enum exceeds clippy's 128-byte threshold on Windows
due to platform-specific type sizes. Box the error in all function
return types (resolve_config_path, install, install_json, install_toml)
so the Result Err variant is pointer-sized. The ? operator auto-boxes
via From<InstallError> for Box<InstallError>.
Adds a dedicated E2E Tests job on ubuntu-latest that builds the Docker
test images (Claude Code, Cursor CLI, gemini-cli) and runs the ignored
testcontainers tests. Integration tests already run in the existing
build-and-test matrix via cargo test --all-features.
Remove #[ignore] from E2E tests and gate them behind a Cargo feature
(e2e-tests) instead. The test file uses #![cfg(feature = "e2e-tests")]
so it's not compiled unless the feature is enabled. CI regular tests
use --features test-support, E2E job uses --features test-support,e2e-tests.
Updates Makefile test-e2e target to match.
gemini-cli requires an auth method configured before it will list MCP
servers. Setting GOOGLE_GENAI_USE_GCA=true as a container env var
satisfies this requirement without needing a real API key.
…mages

- gemini-cli requires auth to run `mcp list`; GOOGLE_GENAI_USE_GCA triggers
  an interactive OAuth flow. GEMINI_API_KEY=dummy satisfies the check without
  network access.
- Add --load to docker build commands so images are available to the daemon
  when using buildx container drivers.
- Pre-create /root/.gemini in the gemini-cli Dockerfile to avoid ENOENT
  on projects.json.
@danielealbano danielealbano merged commit c92c7b6 into main Mar 12, 2026
9 checks passed
@danielealbano danielealbano deleted the feat/cli-install-flag branch March 12, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant