# AnvilRange · Autonomous Agent Self-Installation Specification (/mcp/install.md)

This document is read by AI Coding & Security Agents when a user pastes an AnvilRange 1-click onboarding prompt.

## Non-Destructive Merge Rules (CRITICAL)
1. **Never overwrite existing MCP servers**: Always read the target JSON or TOML configuration file first, parse it, insert/update ONLY the `anvilrange` entry, and write back cleanly.
2. **Global first, workspace fallback**: Write to the user-global configuration path when permitted; if sandbox permissions restrict writes outside the active repository, automatically fall back to the workspace-local path without asking the user to edit files manually.

## Per-Agent Configuration Matrix
- **Google Antigravity** (`~/.gemini/config/mcp_config.json`, `~/.gemini/antigravity/mcp_config.json`, or workspace `.agents/mcp_config.json`):
  Merge under `mcpServers.anvilrange`: `{"serverUrl":"https://anvilrange.com/mcp","headers":{"Authorization":"Bearer <AR_TOK>"},"timeoutSeconds":300}`
  Skill path: `~/.gemini/config/skills/anvilrange-range/SKILL.md` (or `.agents/skills/anvilrange-range/SKILL.md`).
- **OpenAI Codex** (`~/.codex/config.toml` or workspace `.codex/config.toml`):
  Add `[mcp_servers.anvilrange]` with `url = "https://anvilrange.com/mcp"` and `[mcp_servers.anvilrange.http_headers]` `Authorization = "Bearer <AR_TOK>"`.
  Skill path: `~/.codex/skills/anvilrange-range/SKILL.md`.
- **Claude Code** (CLI or `.mcp.json`):
  Run `claude mcp add --transport http -s user anvilrange https://anvilrange.com/mcp --header "Authorization: Bearer <AR_TOK>"` or merge into `.mcp.json`.
  Skill path: `~/.claude/skills/anvilrange-range/SKILL.md`.
- **Cursor** (`~/.cursor/mcp.json` or `.cursor/mcp.json`):
  Merge under `mcpServers.anvilrange`: `{"url":"https://anvilrange.com/mcp","headers":{"Authorization":"Bearer <AR_TOK>"}}`.
  Skill path: `~/.cursor/skills/anvilrange-range/SKILL.md`.
- **Windsurf** (`~/.codeium/windsurf/mcp_config.json`):
  Merge under `mcpServers.anvilrange` using `"serverUrl"` + `"headers"`.
- **VS Code Copilot** (`.vscode/mcp.json`):
  Merge under root `servers.anvilrange`: `{"type":"http","url":"https://anvilrange.com/mcp","headers":{"Authorization":"Bearer <AR_TOK>"}}`.
  Skill path: `.github/skills/anvilrange-range/SKILL.md`.
- **Gemini CLI** (`~/.gemini/settings.json`):
  Merge under `mcpServers.anvilrange` using `"httpUrl": "https://anvilrange.com/mcp"` + `"headers"`.
  Skill path: `~/.gemini/skills/anvilrange-range/SKILL.md`.
- **Cline / Roo Code** (`cline_mcp_settings.json` / `mcp_settings.json`):
  Merge under `mcpServers.anvilrange` with `"type": "streamableHttp"`, `"url"`, `"headers"`, `"disabled": false`.
- **OpenCode** (`~/.config/opencode/opencode.json` or `./opencode.json`):
  Merge under `mcp.anvilrange` with `"type": "remote"`, `"url": "https://anvilrange.com/mcp"`, `"enabled": true`, `"headers"`.
- **Stdio Fallback** (`Node 18+`):
  Download `https://anvilrange.com/downloads/anvilrange-mcp.mjs` to `~/.anvilrange/anvilrange-mcp.mjs` and run via `sh -c 'exec node "$HOME/.anvilrange/anvilrange-mcp.mjs"'` with `ANVILRANGE_API_KEY`.

## Skill Download & Smoke Test
1. Fetch `https://anvilrange.com/skills/anvilrange-range/SKILL.md` and save it to the matching `SKILL.md` path above.
2. Send `POST https://anvilrange.com/mcp` with `{"jsonrpc":"2.0","id":1,"method":"tools/list"}` and confirm 6 tools are returned.
