| 1 | # MCP (External Tool Servers) |
| 2 | |
| 3 | In the terminal, `/mcp` (also `/mcps`) opens **Extensions → MCP**. Enter opens the selected server’s recovery action or read-only details. An empty inventory offers server suggestions; browsing them installs nothing. Explicit subcommands such as `/mcp status`, `/mcp doctor`, `/mcp login`, and `/mcp add` retain their existing behavior. |
| 4 | |
| 5 | |
| 6 | > 阅读简体中文版:[zh_hans/MCP.md](zh_hans/MCP.md) |
| 7 | |
| 8 | codewhale can load additional tools via MCP (Model Context Protocol). MCP servers can be local stdio processes that the TUI starts, or remote URL-based servers that speak Streamable HTTP with legacy SSE fallback. |
| 9 | |
| 10 | Browsing note: |
| 11 | - `Web` is the canonical, deferred built-in browsing tool; it provides |
| 12 | `search`, `fetch`, and `wait` actions when network policy permits. |
| 13 | - `web_search`, `fetch_url`, and `wait_for_dev_server` are hidden replay-only |
| 14 | aliases. New prompts and integrations should use `Web`. |
| 15 | |
| 16 | Server mode note: |
| 17 | - `codewhale serve --mcp` runs the MCP stdio server. |
| 18 | - `codewhale serve --http` runs the runtime HTTP/SSE API (separate mode). |
| 19 | - `codewhale mcp-server` is an equivalent stdio entrypoint on the same |
| 20 | consolidated runtime. |
| 21 | |
| 22 | ## Setup wizard vs manual MCP setup (#3407) |
| 23 | |
| 24 | The `/setup` hub includes an optional **Tools and MCP** |
| 25 | step. That step is discovery/readiness only: |
| 26 | |
| 27 | | Wizard can do | Still requires manual / explicit action | |
| 28 | | --- | --- | |
| 29 | | Show configured servers as `healthy` / `needs_config` / `off` | Start or connect MCP servers | |
| 30 | | Report config path presence (global + project) | Write or edit `mcp.json` contents | |
| 31 | | Safe static health probe (missing command/url, broken absolute path, missing bearer env) | `codewhale mcp validate`, live connect, OAuth login | |
| 32 | | Point at safe on-ramps (`/mcp`, `codewhale mcp init`, `codewhale doctor`) | Install community skills, trust skills, enable plugins | |
| 33 | | Share Hotbar source counts from the same skill/MCP adapters (#3399) | Bind Hotbar slots (Hotbar step / `H`) | |
| 34 | | Record optional/`needs_action` setup_state without blocking first-run | Anything that spawns processes or installs packages | |
| 35 | |
| 36 | Empty inventory is **not** an error: first-run users see “nothing configured |
| 37 | yet, that’s fine.” Failing or incomplete configured servers surface as |
| 38 | `needs_config` with an actionable hint and never block setup completion. |
| 39 | Enumeration never executes MCP/plugin commands beyond the static probe. |
| 40 | Summaries redact commands, args, env, headers, and tokens. |
| 41 | |
| 42 | `codewhale doctor` reports MCP/skills/tools/plugins health with the same |
| 43 | optional-surface intent (paths, counts, static checks) so wizard and doctor |
| 44 | stay consistent. |
| 45 | |
| 46 | ## Plugin-contributed MCP |
| 47 | |
| 48 | A reviewed local plugin bundle may contribute MCP servers without creating a |
| 49 | second transport or approval system. The servers use the same MCP manager, |
| 50 | tool approval, resource, prompt, timeout, and network-policy paths documented |
| 51 | here, and appear under namespaced `<plugin>-<server>` identities. |
| 52 | |
| 53 | The bundle boundary is intentionally stricter than user-authored `mcp.json`: |
| 54 | unknown fields and ambiguous transports fail closed; stdio environment values |
| 55 | must be exact environment-source references; remote literal headers and |
| 56 | secret-bearing URLs are rejected; declared network hosts must exactly match |
| 57 | the normalized endpoint host set; and redirects remain on the reviewed origin. |
| 58 | Reviewed plugin remotes also bypass ambient HTTP proxy configuration entirely; |
| 59 | proxy credentials and proxy-observed traffic are not part of the v1 review. |
| 60 | The plugin review discloses local host-user authority, structural argv, |
| 61 | environment provenance, endpoint, auth source names, scopes, and tool filters |
| 62 | without reading or printing secret values. |
| 63 | |
| 64 | Trust stages reviewed content but does not enable it. Enablement attaches that |
| 65 | staged snapshot to the current workspace's MCP pool. Disable, revoke, and other |
| 66 | cross-process generation changes remove catalog entries, cancel in-flight |
| 67 | operations, and terminate plugin stdio children. Source or staged-tree drift is |
| 68 | fully revalidated before each dispatch/catalogue boundary and fails the next |
| 69 | boundary closed; v0.9.1 does not continuously hash mutable trees during an |
| 70 | already-running call and therefore does not promise drift-triggered mid-call |
| 71 | cancellation. MCP subscriptions are not exposed through plugin bundles. See |
| 72 | [Plugin bundles](PLUGIN_BUNDLES.md) for the complete lifecycle contract. |
| 73 | |
| 74 | ## Bootstrap MCP Config |
| 75 | |
| 76 | Create a starter MCP config at your resolved MCP path: |
| 77 | |
| 78 | ```bash |
| 79 | codewhale mcp init |
| 80 | ``` |
| 81 | |
| 82 | `codewhale setup --mcp` performs the same MCP bootstrap alongside skills setup. |
| 83 | |
| 84 | Common management commands: |
| 85 | |
| 86 | ```bash |
| 87 | codewhale mcp list |
| 88 | codewhale mcp tools [server] |
| 89 | codewhale mcp add <name> --command "<cmd>" --arg "<arg>" |
| 90 | codewhale mcp add <name> --url "http://localhost:3000/mcp" |
| 91 | codewhale mcp add <name> --url "https://example.com/mcp" --bearer-token-env-var MCP_TOKEN |
| 92 | codewhale mcp login <name> |
| 93 | codewhale mcp logout <name> |
| 94 | codewhale mcp enable <name> |
| 95 | codewhale mcp disable <name> |
| 96 | codewhale mcp remove <name> |
| 97 | codewhale mcp validate |
| 98 | ``` |
| 99 | |
| 100 | `codewhale mcp logout <name>` (and `/mcp logout`) clears locally stored |
| 101 | OAuth credentials only — the provider may keep its standing grant. The next |
| 102 | login forces the consent screen, so the authorized account/workspace can |
| 103 | change; to sever the grant remotely, revoke the app from the provider's |
| 104 | account settings. |
| 105 | |
| 106 | ## In-TUI Manager |
| 107 | |
| 108 | Inside the interactive TUI, `/mcp` opens a compact manager for the resolved |
| 109 | MCP config path. It shows each configured server, whether it is enabled or |
| 110 | disabled, its transport, command or URL, timeout values, connection errors, |
| 111 | and discovered tools/resources/prompts when discovery has been run. |
| 112 | |
| 113 | Supported in-TUI actions: |
| 114 | |
| 115 | ```text |
| 116 | /mcp init |
| 117 | /mcp init --force |
| 118 | /mcp import |
| 119 | /mcp recommendations |
| 120 | /mcp add recommended <id> |
| 121 | /mcp add stdio <name> <command> [args...] |
| 122 | /mcp add http <name> <url> |
| 123 | /mcp login <name> [--scope scope] |
| 124 | /mcp logout <name> |
| 125 | /mcp enable <name> |
| 126 | /mcp disable <name> |
| 127 | /mcp remove <name> |
| 128 | /mcp validate |
| 129 | /mcp reload |
| 130 | ``` |
| 131 | |
| 132 | ### Suggested plugins and companion integrations |
| 133 | |
| 134 | `/mcp recommendations` is Codewhale's native, curated suggestions surface. |
| 135 | The entries are described as product plugins, with their component type and |
| 136 | provenance, but `/mcp add recommended <id>` still writes only the named MCP |
| 137 | server component. Viewing recommendations never fetches, installs, trusts, or |
| 138 | enables anything. Adding one writes configuration; the server is first started |
| 139 | only after an explicit `/mcp restart`. |
| 140 | |
| 141 | The v0.9.10 product suggestions use these reviewed, pinned definitions. The |
| 142 | Plugins view is the product/install surface; MCP, Skills, and sandbox adapters |
| 143 | are transparent component kinds and their own tabs remain operational and |
| 144 | diagnostic surfaces: |
| 145 | |
| 146 | | Plugin | Component | Pinned definition | Provenance and maturity | Installation boundary | |
| 147 | | --- | --- | --- | --- | --- | |
| 148 | | Chrome DevTools | MCP server (stdio) | `npx -y chrome-devtools-mcp@1.7.0` (`npx.cmd` on Windows) | [Official ChromeDevTools project](https://github.com/ChromeDevTools/chrome-devtools-mcp) | npm may download the pinned package when the user restarts MCP. | |
| 149 | | Playwright | MCP server (stdio) | `npx -y @playwright/mcp@0.0.79 --isolated` (`npx.cmd` on Windows) | [Official Microsoft project](https://github.com/microsoft/playwright-mcp) | `--isolated` starts a fresh browser profile; npm may download the pinned package only after an explicit restart. | |
| 150 | | Computer Use | First-party plugin (MCP + skill) | Ships in the binary as the `computer-use` plugin | Codewhale; enable through `/plugin` or the Extensions marketplace | This is the only computer-use integration Codewhale recommends. Third-party desktop-control MCPs are not listed here. | |
| 151 | | Browser Use | Skill plus separately installed Python runtime | Skill/runtime release `0.13.8` | [Official browser-use project](https://github.com/browser-use/browser-use) | Optional companion: not an MCP server. Codewhale does not auto-run the upstream Skill installer or install its browser/runtime dependencies. | |
| 152 | | Anthropic Sandbox Runtime | Sandbox adapter companion | `@anthropic-ai/sandbox-runtime@0.0.73` | [Official anthropic-experimental project](https://github.com/anthropic-experimental/sandbox-runtime); beta | Documentation-only adapter candidate in v0.9.10: not an MCP server and not an active Codewhale plugin adapter. It does not replace Codewhale's sandbox policy. | |
| 153 | |
| 154 | [Container Use](https://github.com/dagger/container-use) remains an additional |
| 155 | experimental suggestion with an MCP server component (`container-use stdio`). |
| 156 | The binary must be installed separately; `/mcp add recommended container-use` |
| 157 | only writes config and Codewhale never downloads it. |
| 158 | |
| 159 | This presentation follows the same useful boundary found in the local |
| 160 | Grokbuild extensions view (one product plugin may expose MCP or Skill |
| 161 | components while component tabs stay inspectable), the Kimi marketplace's |
| 162 | explicit display name/tier/source fields, and the Codex marketplace's explicit |
| 163 | source and install-policy fields. |
| 164 | Codewhale keeps its stricter rule: provenance and foreign policy are display |
| 165 | metadata only, never inherited trust or automatic installation. For full |
| 166 | bundle and marketplace semantics, see [Plugin bundles](PLUGIN_BUNDLES.md). |
| 167 | |
| 168 | `/mcp validate` (alias `/mcp doctor`) reconnects for UI discovery only: it |
| 169 | refreshes the manager snapshot you see in the pager, not the catalog the model |
| 170 | gets. |
| 171 | |
| 172 | `/mcp reload` (aliases `/mcp reconnect`, `/mcp restart`) is the hot-reload path. |
| 173 | It re-reads the MCP config sources and reconnects through the engine-owned pool, |
| 174 | so the rebuilt catalog is the exact one the next model turn uses — no TUI |
| 175 | restart. Config edits made from the TUI are written immediately and the manager |
| 176 | marks the snapshot reload-required until you run it; a failed reload leaves the |
| 177 | previous live pool intact and says so. |
| 178 | |
| 179 | Headless surfaces are the exception: the `ConfigReload` app-server request does |
| 180 | **not** refresh MCP connections, so a headless runtime still needs a restart |
| 181 | after MCP config changes. |
| 182 | |
| 183 | ## Remote network authority |
| 184 | |
| 185 | Direct HTTP/SSE requests to public hostnames validate every DNS answer and pin |
| 186 | connections to a public address. This also applies to configured servers, |
| 187 | redirects, and OAuth HTTP requests. The configured network allow/deny policy |
| 188 | applies to login and token refresh as well as MCP tool requests. |
| 189 | |
| 190 | A configured `localhost` name or private IP literal explicitly permits that |
| 191 | local endpoint. For a private DNS name, opt in on the server configuration: |
| 192 | |
| 193 | ```json |
| 194 | { |
| 195 | "mcpServers": { |
| 196 | "internal": { |
| 197 | "url": "https://mcp.internal.example/mcp", |
| 198 | "allow_private_network": true |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | ``` |
| 203 | |
| 204 | `allow_private_network` defaults to false. This exception applies only to the |
| 205 | configured origin (scheme, host, and port); it does not authorize a different |
| 206 | redirect or OAuth origin. Servers added by the model during a session cannot |
| 207 | use this exception, even if their configuration contains the flag. |
| 208 | |
| 209 | Operator-configured servers continue to honor `HTTP_PROXY`, `HTTPS_PROXY`, and |
| 210 | `NO_PROXY`. When a proxy is selected for the configured origin, destination DNS |
| 211 | resolution and private-network filtering are delegated to that operator-chosen |
| 212 | proxy; a local DNS pin cannot constrain a proxy's own resolution. A `NO_PROXY` |
| 213 | match uses the direct guarded connection instead. Model-added servers, |
| 214 | reviewed plugin remotes, and secondary redirect/OAuth origins do not inherit |
| 215 | ambient proxy authority. |
| 216 | |
| 217 | ## Remote HTTP Auth |
| 218 | |
| 219 | URL-based MCP servers can use static headers, env-derived headers, bearer-token |
| 220 | env vars, or OAuth. Authorization precedence is conservative: |
| 221 | |
| 222 | 1. `headers` and `env_headers` are applied first. |
| 223 | 2. `bearer_token_env_var` adds `Authorization: Bearer <env value>` when no |
| 224 | Authorization header was already set. |
| 225 | 3. Stored OAuth credentials are used only when no Authorization header exists. |
| 226 | |
| 227 | For bearer-token auth, prefer env-backed config: |
| 228 | |
| 229 | ```json |
| 230 | { |
| 231 | "servers": { |
| 232 | "remote": { |
| 233 | "url": "https://example.com/mcp", |
| 234 | "bearer_token_env_var": "EXAMPLE_MCP_TOKEN" |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | ``` |
| 239 | |
| 240 | For generic remote MCP OAuth, add the URL server and run login: |
| 241 | |
| 242 | ```bash |
| 243 | codewhale mcp add remote --url "https://example.com/mcp" |
| 244 | codewhale mcp login remote |
| 245 | ``` |
| 246 | |
| 247 | Codewhale discovers the server OAuth metadata, opens the authorization URL in |
| 248 | your browser, listens on a local callback, exchanges the code, and stores the |
| 249 | token response through the Codewhale secrets backend. Stored OAuth tokens are |
| 250 | looked up by server name plus URL and refreshed when possible before requests. |
| 251 | During login, the CLI prints the authorization URL and a waiting status while |
| 252 | the local callback listener is active. If a URL-based server returns 401 or |
| 253 | Unauthorized during connect/discovery, `codewhale mcp connect <name>` reports |
| 254 | that OAuth authentication is required and points to |
| 255 | `codewhale mcp login <name>`. Resource helper listings also surface an |
| 256 | `authentication_required` entry for auth-shaped failures instead of silently |
| 257 | looking empty. |
| 258 | |
| 259 | Optional OAuth fields: |
| 260 | |
| 261 | ```json |
| 262 | { |
| 263 | "servers": { |
| 264 | "remote": { |
| 265 | "url": "https://example.com/mcp", |
| 266 | "scopes": ["tools/read"], |
| 267 | "oauth": { |
| 268 | "client_id": "public-client-id" |
| 269 | }, |
| 270 | "oauth_resource": "https://example.com" |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | ``` |
| 275 | |
| 276 | User-level config can set callback behavior when the provider requires a fixed |
| 277 | redirect: |
| 278 | |
| 279 | ```toml |
| 280 | mcp_oauth_callback_port = 1455 |
| 281 | mcp_oauth_callback_url = "http://127.0.0.1:1455/callback" |
| 282 | ``` |
| 283 | |
| 284 | These callback fields are ignored from project-scope config overlays. |
| 285 | |
| 286 | ## Hugging Face MCP |
| 287 | |
| 288 | Hugging Face provides a hosted MCP server for Hub resources, documentation, |
| 289 | datasets, Spaces, and community tools. Codewhale does not call Hugging Face's |
| 290 | Hub HTTP APIs from `/hf`; it only helps you inspect and set up the MCP config |
| 291 | that the regular MCP manager will load. |
| 292 | |
| 293 | The recommended setup path is Hugging Face's settings-generated configuration: |
| 294 | |
| 295 | 1. Visit <https://huggingface.co/settings/mcp> while signed in. |
| 296 | 2. Choose the MCP client closest to your Codewhale config shape and copy the |
| 297 | generated server snippet. |
| 298 | 3. Paste the Hugging Face server entry into your resolved MCP config file. |
| 299 | 4. Run `/mcp reload` to rebuild the live model-visible tool pool. |
| 300 | |
| 301 | Codewhale reads both `servers` and `mcpServers`, so settings-generated snippets |
| 302 | can be adapted without changing the rest of the MCP file. A placeholder-only |
| 303 | shape looks like this: |
| 304 | |
| 305 | ```json |
| 306 | { |
| 307 | "servers": { |
| 308 | "huggingface": { |
| 309 | "url": "https://huggingface.co/mcp", |
| 310 | "headers": { |
| 311 | "Authorization": "Bearer ${HF_TOKEN}" |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | ``` |
| 317 | |
| 318 | The placeholder above is not a runnable secret. Use the settings-generated |
| 319 | value in your private MCP config and never commit real Hugging Face tokens. |
| 320 | |
| 321 | Interactive helpers: |
| 322 | |
| 323 | ```text |
| 324 | /hf mcp status |
| 325 | /hf mcp setup |
| 326 | /hf concepts |
| 327 | ``` |
| 328 | |
| 329 | `/hf mcp status` checks the configured MCP file for common Hugging Face server |
| 330 | names or Hugging Face MCP URLs. `/hf concepts` explains the difference between |
| 331 | the Hugging Face provider route, Hugging Face MCP, and explicit Hub workflows. |
| 332 | |
| 333 | Official docs: <https://huggingface.co/docs/hub/hf-mcp-server> |
| 334 | |
| 335 | ## Config File Location |
| 336 | |
| 337 | Default path: |
| 338 | |
| 339 | - `~/.codewhale/mcp.json` (`~/.deepseek/mcp.json` is still read when the Codewhale file is absent) |
| 340 | |
| 341 | Overrides: |
| 342 | |
| 343 | - Config: `mcp_config_path = "/path/to/mcp.json"` |
| 344 | - Env: `DEEPSEEK_MCP_CONFIG=/path/to/mcp.json` |
| 345 | |
| 346 | `codewhale mcp init` (and `codewhale setup --mcp`) writes to this resolved path. |
| 347 | |
| 348 | The interactive `/config` editor also exposes `mcp_config_path`. Changing it in |
| 349 | the TUI updates the path used by `/mcp` and marks the pool reload-required; |
| 350 | `/mcp reload` then switches the live pool to the new config source. |
| 351 | |
| 352 | After editing the MCP file or changing `mcp_config_path`, run `/mcp reload`. No |
| 353 | TUI restart is needed. |
| 354 | |
| 355 | ## Tool Naming |
| 356 | |
| 357 | Discovered MCP tools are exposed to the model as: |
| 358 | |
| 359 | - `mcp_<server>_<tool>` |
| 360 | |
| 361 | Example: a server named `git` with a tool named `status` becomes `mcp_git_status`. |
| 362 | |
| 363 | The command palette includes MCP entries grouped by server. It shows disabled |
| 364 | and failed servers instead of hiding them, and uses the same runtime tool names |
| 365 | shown to the model. |
| 366 | |
| 367 | ## Resource and Prompt Helpers |
| 368 | |
| 369 | The CLI also exposes helper tools when MCP is enabled: |
| 370 | |
| 371 | - `list_mcp_resources` (optional `server` filter) |
| 372 | - `list_mcp_resource_templates` (optional `server` filter) |
| 373 | - `mcp_read_resource` / `read_mcp_resource` (aliases) |
| 374 | - `mcp_get_prompt` |
| 375 | |
| 376 | ## Minimal Example |
| 377 | |
| 378 | ```json |
| 379 | { |
| 380 | "timeouts": { |
| 381 | "connect_timeout": 10, |
| 382 | "execute_timeout": 60, |
| 383 | "read_timeout": 120 |
| 384 | }, |
| 385 | "servers": { |
| 386 | "example": { |
| 387 | "command": "node", |
| 388 | "args": ["./path/to/your-mcp-server.js"], |
| 389 | "env": {}, |
| 390 | "disabled": false |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | ``` |
| 395 | |
| 396 | You can also use `mcpServers` instead of `servers` for compatibility with other clients. |
| 397 | |
| 398 | ## Running Codewhale as an MCP Server |
| 399 | |
| 400 | You can register your local Codewhale binary as an MCP server so other Codewhale sessions (or any MCP client) can call its tools. |
| 401 | |
| 402 | ### Quick Setup |
| 403 | |
| 404 | ```bash |
| 405 | codewhale mcp add-self |
| 406 | ``` |
| 407 | |
| 408 | This resolves the current binary path, generates a config entry that runs |
| 409 | `codewhale serve --mcp`, and writes it to your MCP config file. The default |
| 410 | server name is `codewhale`. |
| 411 | |
| 412 | Options: |
| 413 | |
| 414 | - `--name <NAME>` — custom server name (default: `codewhale`) |
| 415 | - `--workspace <PATH>` — workspace directory for the server |
| 416 | |
| 417 | ### Manual Config |
| 418 | |
| 419 | Equivalent manual entry in `~/.codewhale/mcp.json`: |
| 420 | |
| 421 | ```json |
| 422 | { |
| 423 | "servers": { |
| 424 | "codewhale": { |
| 425 | "command": "/path/to/codewhale", |
| 426 | "args": ["serve", "--mcp"], |
| 427 | "env": {} |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | ``` |
| 432 | |
| 433 | The consolidated `codewhale` runtime supports `serve --mcp` directly and also |
| 434 | offers the equivalent `codewhale mcp-server` stdio entrypoint. Release |
| 435 | installers expose the same runtime as `codew`; `mcp add-self` automatically |
| 436 | resolves the command that invoked it. |
| 437 | |
| 438 | ### Prerequisites |
| 439 | |
| 440 | - The binary referenced in `command` must exist and be executable. |
| 441 | - The MCP server runs as a child process via stdio — no network ports required. |
| 442 | - Each MCP client session spawns its own server process. |
| 443 | |
| 444 | ### Tool Naming |
| 445 | |
| 446 | Tools from an MCP server follow the standard naming convention: |
| 447 | |
| 448 | - `mcp_<server>_<tool>` |
| 449 | |
| 450 | For example, the `shell` tool from the default server (named `codewhale`) |
| 451 | becomes `mcp_codewhale_shell`. |
| 452 | |
| 453 | ### MCP Server vs HTTP/SSE API vs ACP |
| 454 | |
| 455 | | | `codewhale serve --mcp` | `codewhale serve --http` | `codewhale serve --acp` | |
| 456 | |---|---|---|---| |
| 457 | | **Protocol** | MCP stdio | HTTP/SSE JSON-RPC | ACP stdio | |
| 458 | | **Use case** | Tool server for MCP clients | Runtime API for apps | Editor agent for Zed/custom ACP clients | |
| 459 | | **Config** | `~/.codewhale/mcp.json` entry | Direct URL connection | Editor `agent_servers` custom command | |
| 460 | | **Lifecycle** | Spawned per client session | Long-running daemon | Spawned per editor agent session | |
| 461 | |
| 462 | Use `mcp add-self` when you want Codewhale tools available to other MCP clients. |
| 463 | Use `serve --http` when building applications that consume the API directly. |
| 464 | Use `serve --acp` when an editor wants to talk to Codewhale as an ACP agent. |
| 465 | |
| 466 | ### Verification |
| 467 | |
| 468 | After adding, test the connection: |
| 469 | |
| 470 | ```bash |
| 471 | codewhale mcp validate |
| 472 | codewhale mcp tools codewhale |
| 473 | ``` |
| 474 | |
| 475 | ## Connection Lifecycle |
| 476 | |
| 477 | Session boot is lazy (#6033): a configured server is not spawned until |
| 478 | something asks for it — a turn whose `allowed_tools`/`tools.always_load` |
| 479 | selection covers its `mcp_<server>_*` names, a model call that resolves to |
| 480 | one of its tools, or an explicit `/mcp` connect/retry. Servers marked |
| 481 | `required` still connect eagerly at boot so their failure surfaces before the |
| 482 | first turn. A configured-but-unstarted server shows as `configured`, never |
| 483 | `connecting`; the connecting label only describes handshakes actually in |
| 484 | flight. |
| 485 | |
| 486 | ## Server Fields |
| 487 | |
| 488 | Per-server settings: |
| 489 | |
| 490 | - `command` (string, required) |
| 491 | - `args` (array of strings, optional) |
| 492 | - `env` (object, optional) |
| 493 | - `connect_timeout`, `execute_timeout`, `read_timeout` (seconds, optional) |
| 494 | - `disabled` (bool, optional) |
| 495 | - `enabled` (bool, optional, default `true`) |
| 496 | - `required` (bool, optional): startup/connect validation fails if this server cannot initialize. |
| 497 | - `enabled_tools` (array, optional): allowlist of tool names for this server. |
| 498 | - `disabled_tools` (array, optional): denylist applied after `enabled_tools`. |
| 499 | - `url` (string, optional): Streamable HTTP endpoint for a remote MCP server. |
| 500 | - `allow_private_network` (boolean, default false): operator opt-in for private DNS addresses on this configured origin; ignored for model-added servers. |
| 501 | - `transport` (string, optional): set to `"sse"` for legacy SSE endpoints. |
| 502 | - `headers` (object, optional): literal HTTP headers for URL-based servers. |
| 503 | - `env_headers` or `env_http_headers` (object, optional): header names mapped to environment variable names. |
| 504 | - `bearer_token_env_var` (string, optional): environment variable containing a bearer token. |
| 505 | - `scopes` (array, optional): default OAuth scopes for `mcp login`. |
| 506 | - `oauth.client_id` (string, optional): pre-registered OAuth client ID. |
| 507 | - `oauth_resource` (string, optional): resource parameter appended to the authorization URL. |
| 508 | |
| 509 | ## Safety Notes |
| 510 | |
| 511 | MCP tools flow through the same approval framework as built-in tools. Read-only |
| 512 | MCP helpers (resource/prompt listing and reads) can run without prompts in Ask |
| 513 | and Auto-Review when policy permits, while side-effectful MCP tools require |
| 514 | approval. Full Access does not bypass hard policy holds. |
| 515 | |
| 516 | You should still only configure MCP servers you trust, and treat MCP server configuration as equivalent to running code on your machine. |
| 517 | Avoid committing literal `Authorization` headers. Prefer `env_headers`, |
| 518 | `bearer_token_env_var`, or OAuth login so secrets stay outside the MCP file. |
| 519 | |
| 520 | ## Troubleshooting |
| 521 | |
| 522 | - Run `codewhale doctor` to confirm the MCP config path it resolved and whether it exists. |
| 523 | - In the TUI, run `/mcp validate` to refresh the visible server/tool snapshot. |
| 524 | - If tools are missing from the model's catalog after a config or credential |
| 525 | change, run `/mcp reload` — `/mcp validate` only refreshes the UI snapshot. |
| 526 | - If the MCP config is missing, run `codewhale mcp init --force` to regenerate it. |
| 527 | - If tools don’t appear, verify the server command works from your shell and that the server supports MCP `tools/list`. |
| 528 |