返回 CodeWhale
docs-mcp.ts
根目录 / web / lib / i18n / dictionaries / en / docs-mcp.ts
1 import type { DocsMcpDict } from "../types";
2
3 /**
4 * English reference dictionary for `app/[locale]/docs/mcp/page.tsx`
5 * ("Connect tools with MCP"). Commands and flags are checked against
6 * `McpCommand` in crates/tui/src/lib.rs and docs/MCP.md; the code-mode
7 * section against crates/engine/src/tools/codemode.rs and
8 * crates/runtime/src/features.rs (`code_mode`: Experimental stage, on by default).
9 */
10 export const docsMcp: DocsMcpDict = {
11 metaTitle: "Connect tools with MCP · Codewhale Docs",
12 metaDescription:
13 "Connect local and remote MCP servers, understand authentication and plugin compatibility, and troubleshoot missing tools.",
14 bodyClassName: "text-ink-soft leading-relaxed",
15 title: "Connect tools with MCP",
16 lede:
17 "Connect a local tool server or a remote service through Model Context Protocol. Codewhale discovers its tools and applies your tool permissions and approvals when you use them.",
18 sections: [
19 {
20 id: "add",
21 title: "Try the Cloudflare Docs server",
22 blocks: [
23 {
24 p: "The public [Cloudflare Documentation server](https://developers.cloudflare.com/agents/model-context-protocol/cloudflare/servers-for-cloudflare/) provides documentation search and a Pages-to-Workers migration guide. [View its official source](https://github.com/cloudflare/mcp-server-cloudflare/tree/main/apps/docs-vectorize). Add it without credentials:",
25 },
26 {
27 code: `codewhale mcp add cloudflare-docs --url "https://docs.mcp.cloudflare.com/mcp"
28 codewhale mcp tools cloudflare-docs`,
29 lang: "Terminal",
30 },
31 {
32 p: "The tool list should include `search_cloudflare_documentation` and `migrate_pages_to_workers_guide`. In an existing TUI session, run `/mcp reload` to load the new configuration into that session.",
33 },
34 {
35 note: "Checked on November 7, 2026 with published CLI v0.10.2: both commands exited successfully and listed those two tools without credentials. This checked setup and discovery, not tool execution. See the [MCP source guide](https://github.com/codewhale-hq/Codewhale/blob/main/docs/MCP.md) for current details.",
36 },
37 {
38 p: "Inside a session, `/mcp` opens the MCP manager: each server's state, transport, timeouts, errors, and discovered tools. The same actions are available there, for example `/mcp add stdio <name> <command>` and `/mcp add http <name> <url>`.",
39 },
40 {
41 note: "Local MCP servers run with the permissions of the Codewhale process; remote calls use the access you grant that service. Add only servers you trust.",
42 },
43 ],
44 },
45 {
46 id: "compatibility",
47 title: "What can connect",
48 blocks: [
49 {
50 rows: [
51 ["Local stdio", "Codewhale starts the executable you configure with `--command`; repeat `--arg` for its arguments. Install the server and its required runtime first."],
52 ["Remote HTTP / SSE", "Use `--url` for Streamable HTTP, with legacy SSE fallback. A legacy SSE endpoint can use `--transport sse`. A remote entry does not need `command`."],
53 ["Direct remote authentication", "Your own MCP configuration can use environment-backed headers, bearer tokens or OAuth. OAuth needs compatible server metadata and client registration."],
54 ["Plugin-contributed MCP", "A reviewed, enabled plugin can supply stdio or remote MCP servers. Plugin MCP supports environment-backed authentication, but plugin-contributed MCP OAuth is unsupported."],
55 ["Tools, resources and prompts", "Codewhale discovers what the server actually advertises. Resources, templates and prompts are available when the server implements them."],
56 ["Optional extensions and MCP Apps", "General MCP Apps UI support is not available. Basic MCP transport support does not guarantee support for every optional extension or server."],
57 ["Server requirements", "Each server keeps its own OS, executable, browser, dependency and account requirements. A local server runs on the computer hosting Codewhale; Computer Use has its own platform limits."],
58 ],
59 },
60 {
61 p: "A direct MCP entry does not require a plugin. [Plugins](/plugins) can package MCP tools with instructions and other components; each component still needs compatible dependencies, review and permissions.",
62 },
63 ],
64 },
65 {
66 id: "remote-auth",
67 title: "Sign in to a remote server",
68 blocks: [
69 {
70 p: "For a directly configured OAuth server, add its real URL, then log in using the name you gave it:",
71 },
72 {
73 code: `codewhale mcp login <server>
74 codewhale mcp logout <server>`,
75 lang: "Terminal",
76 },
77 {
78 p: "For a bearer token, use `--bearer-token-env-var TOKEN_NAME` when adding the server, and set that variable in the environment launching Codewhale. `env_headers` maps header names to environment variable names. Literal `headers` values do not expand `${TOKEN_NAME}`. Plugin MCP entries cannot use OAuth; configure that server directly instead.",
79 },
80 {
81 p: "An explicit Authorization header always wins: headers from config apply first, then the bearer-token variable, then a stored OAuth login. `codewhale mcp logout <name>` removes the stored login on this machine; the provider may keep its own grant until you revoke it there.",
82 },
83 ],
84 },
85 {
86 id: "config",
87 title: "Edit the config file",
88 blocks: [
89 {
90 p: "Global servers live in `~/.codewhale/mcp.json`; the legacy `~/.deepseek/mcp.json` is read when the Codewhale file is absent. `codewhale mcp init` writes a starter file. Use an absolute `mcp_config_path` or `CODEWHALE_MCP_CONFIG` to override it. The environment also accepts `DEEPSEEK_MCP_CONFIG`; the Codewhale name wins when both are set.",
91 },
92 {
93 code: `{
94 "servers": {
95 "cloudflare-docs": {
96 "url": "https://docs.mcp.cloudflare.com/mcp"
97 }
98 }
99 }`,
100 lang: "mcp.json",
101 },
102 {
103 p: "Use either `servers` or its `mcpServers` alias, never both in one file. `env_http_headers` is an alias for `env_headers`. Adapt the server's documented command, arguments and auth fields rather than assuming every client's configuration format is interchangeable.",
104 },
105 {
106 p: "A trusted workspace can add `.codewhale/mcp.json`. Its entries override same-named global servers; the repository cannot grant itself that trust or override your global config path. Explicit global or trusted-project entries win over a colliding plugin server identity.",
107 },
108 {
109 p: "After editing, run `/mcp reload` in the TUI; no restart is needed. Enabled, allowed servers connect at session start by default. Set `\"lazy\": true` on a user-configured server to connect on demand; `\"required\": true` still connects it at startup. Plugin MCP servers have no lazy manifest option. Headless runtimes need a restart after config changes.",
110 },
111 ],
112 },
113 {
114 id: "tool-names",
115 title: "Find the tools",
116 blocks: [
117 {
118 p: "Each tool appears to the model as `mcp_<server>_<tool>`. For this example, documentation search is `mcp_cloudflare-docs_search_cloudflare_documentation`. `codewhale mcp tools <server>` lists discovered tools in its own process; it does not attach those connections to a running session.",
119 },
120 {
121 p: "MCP tools follow your [approval setting](/docs/modes), allow/deny rules and network policy. Whether a call asks first depends on that policy and posture. Full Access does not override repository rules or managed policy.",
122 },
123 ],
124 },
125 {
126 id: "troubleshooting",
127 title: "When tools do not appear",
128 blocks: [
129 {
130 rows: [
131 ["Check configuration", "Run `codewhale doctor` for static path and configuration diagnostics. Shell `codewhale mcp validate` connects enabled, allowed servers in a separate process; it is a live check."],
132 ["Refresh this session", "TUI `/mcp validate` shows its last snapshot without reconnecting. Use `/mcp reload` after config changes, or `/mcp retry <name>` for one server."],
133 ["Connected, but missing a tool", "Check `codewhale mcp tools <server>`, the server's advertised tools, `enabled_tools` / `disabled_tools`, and the session's allow/deny rules. A connected transport alone does not mean a tool is available or permitted."],
134 ["Authentication required", "For a direct OAuth server, run `/mcp login <name>`. For token auth, check that the variable is present in Codewhale's launch environment. A successful login in one process does not attach its transport to another."],
135 ["Local command fails", "Check the server's executable, arguments, working directory and runtime. On Windows, package runners may need their `.cmd` name. Follow the server vendor's OS and dependency instructions."],
136 ["Plugin server is absent", "Check the owning plugin's review, trust and enabled state. MCP settings cannot activate an untrusted plugin or bypass a rejected manifest."],
137 ],
138 },
139 ],
140 },
141 {
142 id: "serve",
143 title: "Run Codewhale as an MCP server",
144 blocks: [
145 {
146 p: "A client supporting Codewhale's advertised MCP protocol revisions can launch it as a stdio tool server. By default, it exposes only read-only `file_read` and `search` tools.",
147 },
148 {
149 code: `codewhale mcp add-self
150 codewhale mcp tools codewhale`,
151 lang: "Terminal",
152 },
153 {
154 p: "`add-self` registers `codewhale serve --mcp`; `codewhale mcp-server` is the equivalent entry point. This server reads its separate `[server]` settings from the legacy `~/.deepseek/mcp_server.toml`, not the client `mcp.json`. Write or shell tools require explicit exposure and `require_approval = false`; there is no interactive approval channel. [Runtime API](/docs/runtime-api) HTTP is separate from MCP.",
155 },
156 ],
157 },
158 {
159 id: "code-mode",
160 title: "Compose tool calls with code mode (experimental)",
161 blocks: [
162 {
163 note: "This section follows the main candidate's source and can include behavior newer than the latest published release.",
164 },
165 {
166 p: "Code mode lets the model write one short JavaScript program that calls several tools, loops, and filters results, instead of making each call as a separate step. Only the program's final value goes back to the model, which keeps long lookups compact. It is on by default — `execute_tools` is advertised from the first request — and MCP and plugin tools compose inside a program the same way built-in ones do. Turning it off does not remove code mode: `execute_tools` goes back to being deferred, and the model can still find it through `tool_search`. To turn it off for one session, or in config:",
167 },
168 {
169 code: `codewhale --disable code_mode
170
171 # ~/.codewhale/config.toml
172 [features]
173 code_mode = false`,
174 lang: "Terminal / config.toml",
175 },
176 {
177 list: [
178 "Nested native, MCP and plugin calls pass the same gate as a direct call: allow/deny lists, ask-rules, and review still apply. A call that needs approval raises the normal approval card and pauses the program; allow resumes it, deny fails only that call. Approving the program itself grants nothing.",
179 "MCP calls run through the session's MCP pool, and plugin tools are callable inside a program just like built-in ones.",
180 "Limits per program: 4 nested calls at a time and 16 KiB returned. There is no fixed 30-second cap: a program runs on the turn's remaining wall clock, unbounded unless `[tui].turn_wall_clock_secs` is set.",
181 "Code mode works in Plan mode too: every nested call still passes Plan's read-only gates.",
182 ],
183 },
184 ],
185 },
186 ],
187 next: [
188 {
189 href: "/docs/hooks",
190 label: "Run commands on events",
191 note: "Check or rewrite a tool call before it runs, including MCP tools.",
192 },
193 {
194 href: "/docs/modes",
195 label: "Set modes and approvals",
196 note: "Decide which MCP calls stop for your approval.",
197 },
198 {
199 href: "/docs/runtime-api",
200 label: "Automate with the Runtime API",
201 note: "Drive Codewhale from your own app or script over HTTP.",
202 },
203 ],
204 sourceNote:
205 "Source documents: docs/MCP.md, crates/engine/src/tools/codemode.rs · Update docs-map.ts when changing.",
206 };
207
207 lines TYPESCRIPT