# Clinamen Guides: full text > Plain, tested how-tos from clinamen.dev/guides: connecting MCP servers to coding agents, keeping API keys out of git, and web motion that stays fast, calm and accessible. The short index is https://clinamen.dev/llms.txt. --- # Add an MCP server to Claude Code, and pick the right scope URL: https://clinamen.dev/guides/claude-code-mcp Updated: 2026-10-28 > One command adds an MCP server to Claude Code. The scope decides who sees it and where it is saved. Tested on Linux and Windows. ## The short answer 1. Open a terminal in your project folder. 2. Add the server: `claude mcp add -- `, for example `claude mcp add everything -- npx -y @modelcontextprotocol/server-everything`. 3. Pick a scope if the default is wrong: add `--scope user` for every project, or `--scope project` to share it with your team through `.mcp.json`. The flag goes before the `--`. 4. Check it: `claude mcp list` should say `Connected` next to the name. 5. Start `claude` in that folder and type `/mcp` to see the server and its tools. An MCP server gives your coding agent tools it did not have: search a catalog, read a database, open a ticket. Claude Code starts the server for you each session. You only tell it once how to start it. ## The command, in three shapes A server that runs on your machine (stdio) is a command line after `--`. Everything after the two dashes is passed through untouched, so the server's own flags never clash with Claude's. ```sh Terminal claude mcp add everything -- npx -y @modelcontextprotocol/server-everything ``` `@modelcontextprotocol/server-everything` is the MCP project's own test server: free, on npm, no key, and it has an `echo` tool, so it is a good first server to prove your setup works. Swap in the command your real server's README gives. A server on the internet (streamable HTTP) is a URL. If it needs a key, send it as a header and keep the key in an environment variable, never typed into the command. The example is Clinamen's hosted server, which needs a Clinamen Signature key (sales open at launch); any server that takes a bearer key works the same way: macOS / Linux: ```sh claude mcp add --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer $CLINAMEN_LICENCE_KEY" ``` Windows PowerShell: ```powershell claude mcp add --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer $env:CLINAMEN_LICENCE_KEY" ``` cmd: ```cmd claude mcp add --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer %CLINAMEN_LICENCE_KEY%" ``` The shell fills the variable in before Claude Code sees the line, so the saved config holds the key itself. That is why the three lines differ: in PowerShell, `$CLINAMEN_LICENCE_KEY` is an empty PowerShell variable, and the line saves `Bearer` with nothing after it. In PowerShell use `$env:NAME`, in cmd `%NAME%`, and in every shell check the variable is set (`echo $env:NAME` or `echo %NAME%`) before you add the server. Live demo on the web page (Build your claude mcp add line): Type your server's name and the command that starts it (or its URL and the **name** of the variable that holds its key), pick who should see it and your computer, and copy the result. It applies exactly the rules on this page and runs in your browser: nothing is sent or saved. With scripts off, the examples below are the same shapes. ## Scopes: who sees the server, and where it is saved | Scope | Flag | Who sees it | Saved in | |---|---|---|---| | Local (the default) | none, or `--scope local` | you, in this folder only | `~/.claude.json`, under this project's path | | Project | `--scope project` | everyone who opens the repo | `.mcp.json` in the project root, meant to be committed | | User | `--scope user` | you, in every folder | `~/.claude.json` | Rules of thumb: - **A tool you want everywhere** (a docs server, a component catalog): `--scope user`. - **A tool the whole team needs for this repo**: `--scope project`, and keep any key out of the file (below). - **Trying something out**: the default. It disappears from view the moment you `cd` elsewhere, which is also the most common "my server vanished" report. Put `--scope` before the `--`. After it, the flag becomes an argument to the server's own command, and Claude Code quietly falls back to the local scope. ## A project server asks first A server in `.mcp.json` does not start until you approve it, because anyone can commit one. `claude mcp list` shows it as: ```text claude mcp list everything: npx -y @modelcontextprotocol/server-everything - ⏸ Pending approval (run `claude` to approve) ``` Start `claude` in the folder and accept the prompt. Your teammates do the same once. A committed `.mcp.json` must never hold a key. Claude Code expands `${VAR}` inside `.mcp.json` when it starts, so write the variable's name and let each person set their own: ```json .mcp.json { "mcpServers": { "clinamen": { "type": "http", "url": "https://mcp.clinamen.dev/mcp", "headers": { "Authorization": "Bearer ${CLINAMEN_LICENCE_KEY}" } } } } ``` ## Check that it works ```sh Terminal claude mcp list ``` Real output of `claude mcp add everything …, then claude mcp list and claude mcp get everything`: ```text $ claude mcp add everything -- npx -y @modelcontextprotocol/server-everything Added stdio MCP server everything with command: npx -y @modelcontextprotocol/server-everything to local config File modified: /home/you/cfg/.claude.json [project: /home/you/proj] $ claude mcp list Checking MCP server health… everything: npx -y @modelcontextprotocol/server-everything - ✔ Connected $ claude mcp get everything everything: Scope: Local config (private to you in this project) Status: ✔ Connected Type: stdio Command: npx Args: -y @modelcontextprotocol/server-everything Environment: To remove this server, run: claude mcp remove everything -s local ``` That is a real session from 28 Oct 2026 (Claude Code 2.1.312, Linux), run with an empty config folder (`CLAUDE_CONFIG_DIR`), which is why the file it names is not `~/.claude.json`; only the folder names were shortened. Each server gets a health check. `✔ Connected` (`√ Connected` in Windows terminals) means Claude Code started it and the handshake worked. For one server in detail: ```sh Terminal claude mcp get everything ``` That prints the scope, the command and **the headers in plain text**, key included. Do not paste its output into an issue or a chat. `Connected` is not proof that your key arrived. A server that accepts a missing key and explains the problem still connects: Clinamen's hosted server, added with an empty key, shows `Connected` and then answers every call with the reason the key was refused. So after `Connected`, ask the agent to call one of the server's tools (for the test server: "call the echo tool of the everything server with hello"); a keyed server's answer tells you whether the key arrived. ## Windows notes - `claude mcp add -- npx -y ` works as written in PowerShell and cmd. We also checked the `cmd /c npx …` form some older guides recommend: it connects too, but you do not need it in Claude Code. - A local package file path must use forward slashes: `npx -y file:C:/Users/you/my-server-1.0.0.tgz`. A backslash path makes `npx` hang with no message. - If `npx --version` itself fails in PowerShell with "running scripts is disabled on this system", PowerShell is blocking `npx.ps1`. Type `npx.cmd` instead of `npx`, or allow signed scripts for your user once: `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`. ## Remove or change a server ```sh Terminal claude mcp remove everything --scope local ``` There is no edit command. Remove the server and add it again with the new line. To move a server to another scope, remove it from the old one first, or you will have two with the same name and the narrower scope wins in that folder. How we tested this: Tested 28 October 2026 with Claude Code 2.1.312 on Linux, 2.1.311 on Windows 11, Node 22 and 24. 28 Oct 2026, Claude Code 2.1.312 on Linux and 2.1.311 on Windows 11 (PowerShell 5.1 and cmd), Node 22 and 24, each run in an empty config folder (`CLAUDE_CONFIG_DIR`): every scope with a local stdio server (`claude mcp list`: Connected), the hosted line in all three shells, `claude mcp get` (it prints the header), and a `.mcp.json` server (Pending approval). Later the same day, Claude Code 2.1.312 on Linux, empty config folder: the `everything` lines on this page as printed (`@modelcontextprotocol/server-everything` 2.1.0: Connected, 13 tools, `echo` answered), `.mcp.json` Pending approval, and the hosted line with an empty key (Connected). --- # Add an MCP server to Claude Desktop on Mac and Windows URL: https://clinamen.dev/guides/claude-desktop-mcp Updated: 2026-10-28 > Where claude_desktop_config.json lives, the exact JSON for a local or keyed server, and the fixes for "spawn npx ENOENT" and a server that never shows up. ## The short answer 1. In Claude Desktop open **Settings → Developer → Edit Config**. It opens `claude_desktop_config.json` (and creates it if it is missing). 2. Add your server under `mcpServers`: a `command` and its `args`, for example `"command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"]`. 3. Save, then quit Claude Desktop completely (from the menu bar or the tray, not just the window) and open it again. 4. In a new chat, open the **+** menu → **Connectors** and check that the server is listed with its tools. 5. If it is missing, read `mcp.log` and `mcp-server-.log` in the logs folder; on Windows, a `spawn npx ENOENT` line means you should start it through `cmd /c`. Claude Desktop starts local MCP servers itself, from one JSON file. It reads that file only when it starts, which is the cause of most "I added it and nothing happened" moments. Live demo on the web page (Build your claude_desktop_config.json): Type your server's name and the command that starts it (or its URL and the **name** of the variable that holds its key), pick your computer, and copy the result. It applies exactly the rules on this page and runs in your browser: nothing is sent or saved. With scripts off, the examples below are the same shapes. ## Where the file lives | System | Config file | Logs | |---|---|---| | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` | `~/Library/Logs/Claude/` | | Windows | `%APPDATA%\Claude\claude_desktop_config.json` | `%APPDATA%\Claude\logs\` | **Edit Config** in the Developer settings opens the right one, so you rarely need the path. ## A local server ```json claude_desktop_config.json { "mcpServers": { "everything": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"] } } } ``` `@modelcontextprotocol/server-everything` is the MCP project's own test server: free, on npm, no key, with an `echo` tool, so it proves the setup before you add the server you really want. Swap in the command your server's README gives. If the file already has servers, add yours inside the same `mcpServers` object, with a comma after the one before it. One missing comma and Claude Desktop starts no servers at all, so paste the file into any JSON checker if in doubt. ## Windows: "spawn npx ENOENT" On Windows, `npx` is not a program but a script (`npx.cmd`). A program that starts another without a shell, as an app does, cannot find a script by the bare name, and the log says `spawn npx ENOENT`. Start it through `cmd`: ```json claude_desktop_config.json (Windows) { "mcpServers": { "everything": { "command": "cmd", "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-everything"] } } } ``` We reproduced both halves on Windows 11: starting `npx` with no shell failed with `ENOENT`; starting `cmd /c npx …` connected and listed the server's tools. Recent Claude Desktop builds may resolve `npx` on their own. If yours does, keep the short form; if the log shows `ENOENT`, use this one. The official MCP docs list one more Windows case: a log line with a literal `${APPDATA}` in a path. The fix there is an `env` entry with your real folder, `"APPDATA": "C:\\Users\\\\AppData\\Roaming\\"`. Note the doubled backslashes: JSON needs them. ## A server that needs a key Claude Desktop's config has no `headers` field for a local entry, and its **Connectors → Add custom connector** form takes a URL plus OAuth, not a bearer header. For a server that wants `Authorization: Bearer `, run a small bridge, `mcp-remote`, as the local command. It connects to the remote server and adds the header. The example is Clinamen's hosted server, which needs a Clinamen Signature key (sales open at launch); the shape is the same for any server that takes a bearer key: ```json claude_desktop_config.json { "mcpServers": { "clinamen": { "command": "npx", "args": ["-y", "mcp-remote", "https://mcp.clinamen.dev/mcp", "--header", "Authorization:${AUTH_HEADER}"], "env": { "AUTH_HEADER": "Bearer " } } } } ``` Two details matter. `${AUTH_HEADER}` is filled in by `mcp-remote` from the `env` block, not by Claude Desktop. And `Authorization:${AUTH_HEADER}` has no space after the colon on purpose: on Windows, a space inside an argument can split it in two on the way through `cmd`. On Windows, wrap it like the local server: `"command": "cmd"`, `"args": ["/c", "npx", "-y", "mcp-remote", …]`. The key now sits in plain text in a file in your user folder. That file never goes in a repo, but do not paste it into a support chat. See [where keys live](/guides/keep-api-key-secret). ## It still does not show up 1. **Quit completely.** On macOS use Claude → Quit (⌘Q); on Windows, quit from the tray icon. Closing the window leaves the app running with the old config. 2. **Check the JSON.** A trailing comma or a missing quote stops every server. 3. **Read the logs.** `mcp.log` says whether Claude Desktop tried to start the server; `mcp-server-.log` (here `mcp-server-everything.log`) holds the server's own messages. macOS: ```sh tail -n 30 ~/Library/Logs/Claude/mcp*.log ``` Windows PowerShell: ```powershell Get-Content "$env:APPDATA\Claude\logs\mcp*.log" -Tail 30 ``` 4. **Run the command yourself.** Paste the `command` and `args` into a terminal (`npx -y @modelcontextprotocol/server-everything`). A local MCP server waits for input, printing nothing or one startup line on its error output (the test server says `Starting default (STDIO) server...`): that is success. Press Ctrl+C. An error here is the error Claude Desktop hit. How we tested this: Tested 28 October 2026 with the configs' command lines on Linux and Windows 11, Node 22 (the app itself not run). 28 Oct 2026. We did not drive the Claude Desktop app itself; we ran the exact command line each config starts, the way an app starts it (no shell), with a small MCP client that sends `initialize` and `tools/list`. Linux: a local stdio server through `npx -y`, handshake OK. Windows 11: bare `npx` without a shell, `ENOENT`; `cmd /c npx …`, handshake OK. Later the same day, Linux: `npx -y @modelcontextprotocol/server-everything` (2.1.0) as in the config above, handshake OK, 13 tools, `echo` answered. `mcp-remote` 0.15.2 against the hosted server: handshake OK, and a local test listener received the header filled in from `env`. File paths, logs and the Edit Config steps are from the official MCP documentation (read 28 Oct 2026). --- # Add an MCP server to Cursor, and fix one that will not show up URL: https://clinamen.dev/guides/cursor-mcp Updated: 2026-10-28 > The mcp.json Cursor reads, global or per project, with a keyed server that keeps the key out of git, and the five causes of a server that never appears. ## The short answer 1. Pick the file: `~/.cursor/mcp.json` for every project, or `.cursor/mcp.json` in the project for this one only. Use one, not both, for the same server. 2. Add the server under `mcpServers`: `"command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"]` for a local one, or `"url"` plus `"headers"` for a remote one. 3. Write keys as `${env:NAME}`, never the value. 4. Reload the window (Command Palette → **Developer: Reload Window**) and check the server's toggle and tool count in Cursor's MCP settings. 5. If it is missing or red, open **Output** (Cmd/Ctrl+Shift+U) → **MCP Logs**. Cursor reads MCP servers from a JSON file with the same `mcpServers` shape Claude Desktop uses, so most configs copy across unchanged. Live demo on the web page (Build your Cursor mcp.json): Type your server's name and the command that starts it (or its URL and the **name** of the variable that holds its key), pick every project or this one, your computer, and copy the result. It applies exactly the rules on this page and runs in your browser: nothing is sent or saved. With scripts off, the examples below are the same shapes. ## A local server ```json ~/.cursor/mcp.json { "mcpServers": { "everything": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"] } } } ``` `@modelcontextprotocol/server-everything` is the MCP project's own test server: free, on npm, no key, with an `echo` tool. Start with it to prove the setup, then swap in the command your server's README gives. ## A server that needs a key A remote server takes `url` and `headers`. Cursor fills in `${env:NAME}` from the environment it started with, so the file holds no secret and a project copy is safe to commit. The example is Clinamen's hosted server, which needs a Clinamen Signature key (sales open at launch); any server that takes a bearer key works the same way: ```json ~/.cursor/mcp.json { "mcpServers": { "clinamen": { "url": "https://mcp.clinamen.dev/mcp", "headers": { "Authorization": "Bearer ${env:CLINAMEN_LICENCE_KEY}" } } } } ``` The syntax is `${env:NAME}` with the `env:` part. A bare `${NAME}` (the Claude Code form) reaches the server as text, and a server that reports it says `unexpanded`. Cursor also understands `${userHome}` and `${workspaceFolder}` in paths. The variable has to exist in the environment Cursor was **started** with. Set it in your shell profile or with `setx` on Windows, then quit Cursor fully and start it again. On a Mac, Cursor started from the Dock may not see a variable exported only in `~/.zshrc`; starting it from a terminal (`cursor .`) always does. For a stdio server, Cursor can also read a `.env` file: `"envFile": "${workspaceFolder}/.env.local"`. That works for local servers only, not remote ones. ## Five reasons a server does not show up 1. **The JSON is broken.** A trailing comma after the last server stops the whole file. Run it through any JSON checker. 2. **Cursor did not reload.** It reads `mcp.json` at start and on window reload. Edit, then **Developer: Reload Window**. 3. **The same server is in both files.** Keep it in the global file or the project file, not both. 4. **The command fails.** Paste `command` and `args` into a terminal. A working MCP server waits for input, printing nothing or one startup line; press Ctrl+C. An error there is the error Cursor got. On Windows, if MCP Logs show `spawn npx ENOENT`, use `"command": "cmd", "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-everything"]`. 5. **Too many tools.** Agents get worse at choosing when dozens of tools are on. Turn off servers you are not using in this project from the MCP settings. Then check it from the chat: ask the agent to "call the echo tool of the everything server with hello". It should answer `Echo: hello`. A keyed server is only proven once one of its tools answers: Clinamen's hosted server, for one, connects with a missing key and then says why it refused it. How we tested this: Tested 28 October 2026 with the configs' command lines on Linux and Windows 11, Node 22 (the app itself not run). 28 Oct 2026. We did not run the Cursor app; Cursor's file locations, `${env:}` syntax, `envFile` and MCP Logs are from Cursor's documentation (read 28 Oct 2026). Every JSON block on this page parses. A local stdio server through `npx -y` completed an MCP handshake on Linux, and through `cmd /c` on Windows 11; bare `npx` without a shell failed with `ENOENT` there. Later the same day, Linux: `npx -y @modelcontextprotocol/server-everything` (2.1.0), handshake OK, 13 tools, `echo` answered `Echo: hello`. The hosted server answered the header `Bearer ${CLINAMEN_LICENCE_KEY}`, sent as text, with reason `unexpanded`. --- # Add an MCP server to Windsurf (now Devin Desktop) URL: https://clinamen.dev/guides/windsurf-mcp Updated: 2026-10-28 > Where Windsurf's Cascade keeps mcp_config.json today, the JSON for a local or keyed server, the 100-tool limit, and the old path older guides still give. ## The short answer 1. In the Cascade panel open the **…** menu and the **MCPs** section, then **Open MCP config file**. That opens the right `mcp_config.json` for your version. 2. Add your server under `mcpServers`: `command` and `args` for a local one, `serverUrl` plus `headers` for a remote one. 3. Write keys as `${env:NAME}`, never the value. 4. Save the file, then refresh the MCPs list (or restart the app) and check the server's tools. 5. Stay under 100 tools in total: turn off servers you are not using, or list unused tools in `disabledTools`. Windsurf's agent, Cascade, now ships inside **Devin Desktop**, and Windsurf's docs redirect to Devin's. The config format did not change, but the file moved, which is why guides from early 2026 disagree about the path. Live demo on the web page (Build your mcp_config.json): Type your server's name and the command that starts it (or its URL and the **name** of the variable that holds its key), pick your computer, and copy the result. It applies exactly the rules on this page and runs in your browser: nothing is sent or saved. With scripts off, the examples below are the same shapes. ## Where the file is | Version | macOS and Linux | Windows | |---|---|---| | Devin Desktop (current) | `~/.config/devin/mcp_config.json` | `%APPDATA%\devin\mcp_config.json` | | Windsurf (older builds) | `~/.codeium/windsurf/mcp_config.json` | `%USERPROFILE%\.codeium\windsurf\mcp_config.json` | The **Open MCP config file** button always opens the one your build reads. Devin's newer default agent (Devin Local) keeps its MCP servers in Devin CLI's config instead; this page is for Cascade. ## A local server ```json mcp_config.json { "mcpServers": { "everything": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"] } } } ``` `@modelcontextprotocol/server-everything` is the MCP project's own test server: free, on npm, no key, with an `echo` tool. Start with it to prove the setup, then swap in the command your server's README gives. ## A server that needs a key Remote servers use `serverUrl` (Cascade also accepts `url`). Interpolation works in `serverUrl`, `headers`, `env`, `command` and `args`. The example is Clinamen's hosted server, which needs a Clinamen Signature key (sales open at launch); any server that takes a bearer key works the same way: ```json mcp_config.json { "mcpServers": { "clinamen": { "serverUrl": "https://mcp.clinamen.dev/mcp", "headers": { "Authorization": "Bearer ${env:CLINAMEN_LICENCE_KEY}" } } } } ``` An unset variable becomes an empty string, so the server receives `Bearer` and nothing else; Clinamen's hosted server answers that with reason `missing`. Set the variable (`export NAME=…` in your shell profile on macOS and Linux, `setx NAME "…"` on Windows), quit the app fully, start it again. There is also `${file:/path/to/key.txt}`, which reads the key from a file outside the project, if you would rather not keep it in your environment. ## The 100-tool limit Cascade uses at most 100 tools across all your servers at once and ignores the rest. A few large servers reach that quickly. Turn off whole servers you do not need in the MCPs section, or switch off single tools: ```json mcp_config.json { "mcpServers": { "everything": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"], "disabledTools": ["trigger-long-running-operation"] } } } ``` If a server does not appear, run its `command` and `args` in a terminal: a working server waits for input, printing nothing or one startup line (Ctrl+C to stop). On Windows, a `spawn npx ENOENT` error means you should start it as `"command": "cmd", "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-everything"]`. How we tested this: Tested 28 October 2026 with the configs' command lines on Linux and Windows 11, Node 22 (the app itself not run). 28 Oct 2026. We did not run Windsurf or Devin Desktop. The current paths, the `serverUrl` and `${env:}`/`${file:}` rules, the empty-string behaviour and the 100-tool limit are from Devin's Cascade MCP documentation (read 28 Oct 2026, redirected from docs.windsurf.com); the older path is the one Windsurf-era setup guides give. Every JSON block parses; a local stdio server completed an MCP handshake (Linux, and `cmd /c` on Windows 11); the hosted server answered an empty `Bearer` with reason `missing`. Later the same day, Linux: `npx -y @modelcontextprotocol/server-everything` (2.1.0), handshake OK, 13 tools, `trigger-long-running-operation` among them. --- # Add an MCP server to VS Code, with a key VS Code asks for once URL: https://clinamen.dev/guides/vscode-mcp Updated: 2026-10-28 > VS Code's mcp.json uses "servers", not "mcpServers". The exact file, a local server, and a keyed server that prompts once and keeps the key out of git. ## The short answer 1. Create `.vscode/mcp.json` in your project, or run **MCP: Open User Configuration** from the Command Palette for every workspace. 2. Put servers under `"servers"` (not `"mcpServers"`), each with a `"type"`: `"stdio"` with `command` and `args`, or `"http"` with `url`. 3. For a key, add an `inputs` entry with `"password": true` and use `${input:}` in the header. VS Code asks once and stores it. 4. Start the server from the **Start** link above it in `mcp.json`, or run **MCP: List Servers**. 5. In Copilot Chat, switch to **Agent** mode and open the tools picker to see the server's tools. VS Code's MCP config looks like everyone else's with one difference that catches people out: the top-level key is `servers`. A Claude Desktop or Cursor block pasted in as `mcpServers` is ignored without an error. Live demo on the web page (Build your .vscode/mcp.json): Type your server's name and the command that starts it (or its URL and the **name** of the variable that holds its key), pick this workspace or every one, your computer, and copy the result. It applies exactly the rules on this page and runs in your browser: nothing is sent or saved. With scripts off, the examples below are the same shapes. ## A local server ```json .vscode/mcp.json { "servers": { "everything": { "type": "stdio", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"] } } } ``` `@modelcontextprotocol/server-everything` is the MCP project's own test server: free, on npm, no key, with an `echo` tool. Start with it to prove the setup, then swap in the command your server's README gives. ## A server that needs a key, asked for once VS Code's own answer to secrets is `inputs`: it prompts the first time the server starts and keeps the value in its secret storage, so the file you commit holds only the question. The example is Clinamen's hosted server, which needs a Clinamen Signature key (sales open at launch); any server that takes a bearer key works the same way. ```json .vscode/mcp.json { "inputs": [ { "type": "promptString", "id": "clinamen-key", "description": "Clinamen licence key", "password": true } ], "servers": { "clinamen": { "type": "http", "url": "https://mcp.clinamen.dev/mcp", "headers": { "Authorization": "Bearer ${input:clinamen-key}" } } } } ``` Prefer an environment variable? `${env:CLINAMEN_LICENCE_KEY}` works in the same place. VS Code must have been started from an environment that has it: quit fully and reopen after `setx` or a profile change. Two limits from VS Code's documentation: `inputs` work only in VS Code's own file format (not in a portable `.mcp.json` at the workspace root, which uses `${NAME}` instead), and servers that need an input are not passed on to Copilot's cloud agent sessions. ## Check it works Run **MCP: List Servers**, pick the server and **Show Output** to see its log. A server that started lists its tools; one that failed says why. Then in Copilot Chat in **Agent** mode, ask: "call the echo tool of the everything server with hello". It answers `Echo: hello`. A keyed server is only proven once one of its tools answers: Clinamen's hosted server, for one, starts with a missing key and then says why it refused it. If it fails, run the `command` and `args` in a terminal first. A working MCP server waits for input, printing nothing or one startup line (Ctrl+C). On Windows, a `spawn npx ENOENT` in the output means: use `"command": "cmd", "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-everything"]`. How we tested this: Tested 28 October 2026 with the configs' command lines on Linux and Windows 11, Node 22 (VS Code itself not run). 28 Oct 2026. We did not run VS Code. The `servers`/`inputs` format, `${input:}` and `${env:}`, the portable `.mcp.json` note and the command names are from VS Code's MCP configuration reference (read 28 Oct 2026). Every JSON block parses; a local stdio server completed an MCP handshake on Linux, and through `cmd /c` on Windows 11. Later the same day, Linux: `npx -y @modelcontextprotocol/server-everything` (2.1.0), handshake OK, 13 tools, `echo` answered `Echo: hello`. --- # Add an MCP server to the Grok CLI so it works in every folder URL: https://clinamen.dev/guides/grok-mcp Updated: 2026-10-28 > Why a per-project Grok server says "folder untrusted" and the agent gets no tools, and the user-scope line that fixes it, with the keyed form per shell. ## The short answer 1. Add the server for your user, so it starts in every folder: `grok mcp add --scope user everything -- npx -y @modelcontextprotocol/server-everything`. 2. For a keyed remote server, add `--transport http --header "Authorization: Bearer $NAME"`, written the way your shell expects (`$env:NAME` in PowerShell). 3. Check it: `grok mcp doctor everything` should end with `handshake OK` and a tool count. 4. If you keep a server per project instead, trust the folder once: `grok --trust mcp doctor everything`. The Grok CLI reads MCP servers from two places: `~/.grok/config.toml` (user scope) and `.grok/config.toml` in a project (project scope). The second only starts in a folder you have trusted, and a headless run (`grok -p "…"`) never stops to ask. That is the whole story behind most "Grok can't see the tools" reports. Live demo on the web page (Build your grok mcp add line): Type your server's name and the command that starts it (or its URL and the **name** of the variable that holds its key), pick user or project scope, your computer, and copy the result. It applies exactly the rules on this page and runs in your browser: nothing is sent or saved. With scripts off, the examples below are the same shapes. ## Add it for your user ```sh Terminal grok mcp add --scope user everything -- npx -y @modelcontextprotocol/server-everything ``` Then ask the doctor. This is the whole session as it ran on 28 Oct 2026 (Grok CLI 1.0.70, Linux, an empty home folder): Real output of `grok mcp add --scope user everything …, then grok mcp list and grok mcp doctor everything`: ```text $ grok mcp add --scope user everything -- npx -y @modelcontextprotocol/server-everything Added stdio MCP server 'everything' with command: npx -y @modelcontextprotocol/server-everything to user config File modified: ~/.grok/config.toml $ grok mcp list everything: npx -y @modelcontextprotocol/server-everything $ grok mcp doctor everything MCP Doctor Config sources ~/.grok/config.toml 1 server ~/.claude.json not found .mcp.json not found everything (stdio: npx -y @modelcontextprotocol/server-everything) ✓ command found (/usr/bin/npx) ✓ server started (0.0s) ✓ handshake OK (protocol 2025-11-25) ✓ 13 tools discovered Found 1 healthy, 0 failing. ``` Notice the config sources: the doctor also looks for Claude Code's `~/.claude.json` and a project's `.mcp.json`, so a server you already added to Claude Code can show up here too. `@modelcontextprotocol/server-everything` is the MCP project's own test server: free, on npm, no key, with an `echo` tool. Start with it to prove the setup, then swap in the command your server's README gives. ## A remote server with a key The example is Clinamen's hosted server, which needs a Clinamen Signature key (sales open at launch); any server that takes a bearer key works the same way. macOS / Linux: ```sh grok mcp add --scope user --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer $CLINAMEN_LICENCE_KEY" ``` Windows PowerShell: ```powershell grok mcp add --scope user --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer $env:CLINAMEN_LICENCE_KEY" ``` cmd: ```cmd grok mcp add --scope user --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer %CLINAMEN_LICENCE_KEY%" ``` Your shell fills the key in, so `~/.grok/config.toml` holds the value. That file lives in your user folder, never in a repo. On a shared Mac or Linux machine, make it private: `chmod 600 ~/.grok/config.toml` (Grok wrote it readable by other users on our test machine). ## Per project: trust the folder A project-scoped server is fine when you want it committed with the repo. Without trust, `doctor` says exactly what happens: ```text grok mcp doctor everything ✗ folder untrusted (repo-local (project-scoped) server not started for an untrusted folder) → re-run with --trust to allow repo-local servers ``` `--trust` is a flag on `grok` itself, before the subcommand. It saves the grant for that folder for good: ```sh Terminal grok --trust mcp doctor everything ``` (`grok mcp doctor --trust` is refused.) Opening `grok` in the folder and accepting its trust prompt does the same. A committed project file must not hold a key. Add the line with the variable's **name** in single quotes, so your shell leaves it alone and Grok fills it in each time it starts: ```sh macOS / Linux grok mcp add --scope project --transport http clinamen https://mcp.clinamen.dev/mcp --header 'Authorization: Bearer ${CLINAMEN_LICENCE_KEY}' ``` ## "Healthy" is not "key accepted" `grok mcp doctor` checks that the server starts and answers. In our test, a remote server added with an **empty** key still reported `handshake OK, 14 tools`, because the server answers every call with "key not received" and how to fix it. So after `doctor`, ask Grok to call one of the server's tools. A server that explains refusals tells you the reason there; Clinamen's says `missing` (no key arrived), `unexpanded` (the variable's name arrived instead of its value) or `unknown` (a key arrived but is not one it issued). ## grok.com and the Grok apps The chat apps are a different path: at grok.com/connectors, **New Connector → Custom** takes a public MCP server URL and runs whatever sign-in the server asks for. A server on your own machine needs a tunnel. Clinamen's hosted server signs in with a key in a header today, not OAuth; we have not tested it as a grok.com connector yet. How we tested this: Tested 28 October 2026 with Grok CLI 1.0.70 on Linux, Node 22. Grok CLI 1.0.70 on Linux, in an empty home folder. 28 Oct 2026: `--scope user` with `@modelcontextprotocol/server-everything` 2.1.0 as printed (doctor: handshake OK, 13 tools); `--scope project` (folder untrusted), then `grok --trust mcp doctor everything` (13 tools). Earlier that day: the remote line with an empty key (healthy, 14 tools, and the server's answer said `missing`); `~/.grok/config.toml` written readable by other users. The PowerShell and cmd forms carry the key the same way we proved for Claude Code on Windows 11; Grok itself was not run on Windows. grok.com steps are from xAI's connector docs (read 28 Oct 2026). --- # Where your API key lives in an AI coding setup, and how to keep it out of git URL: https://clinamen.dev/guides/keep-api-key-secret Updated: 2026-10-28 > Every MCP client saves keys somewhere. Where each one keeps it, which files are safe to commit, and what to do when a key already reached a repo. ## The short answer 1. Keep the key in an environment variable (or the app's own secret prompt), never typed into a file in your project. 2. In any config you commit, write the variable's name in the client's syntax (`${NAME}` for Claude Code, `${env:NAME}` for Cursor, VS Code and Windsurf), not the value. 3. Add `.env*.local` to `.gitignore` and check it with `git check-ignore -v .env.local`. 4. Search your history once: `git log --oneline -S "" --all`. 5. If a key ever reached a remote, rotate it. Deleting the commit is not enough. A key in a config file is not a problem by itself. A key in a file that gets committed, pushed, pasted into an issue or shown on a stream is. The trick is knowing which files each tool writes and which of them travel. ## Where each client saves it When a shell fills in `$NAME` before the client sees the command, the **value** gets saved. When the config holds `${NAME}` and the client fills it in at start, only the **name** is saved. | Client | File | What lands there | Travels with the repo? | |---|---|---|---| | Claude Code, local or user scope | `~/.claude.json` | the value (the shell filled it in) | no, it is in your user folder, readable only by you | | Claude Code, project scope | `.mcp.json` in the project | whatever you wrote: use `${NAME}` | **yes**, it is meant to be committed | | Cursor | `~/.cursor/mcp.json` or `.cursor/mcp.json` | whatever you wrote: use `${env:NAME}` | the project file does | | VS Code | `.vscode/mcp.json` | `${input:…}` makes VS Code ask once and keep it in its secret storage | the project file does | | Windsurf | `mcp_config.json` in your user folder | use `${env:NAME}` | no | | Claude Desktop | `claude_desktop_config.json` in your user folder | values in `env` are plain text | no | | Grok CLI | `~/.grok/config.toml` (user) or `.grok/config.toml` (project) | the value, unless you add it with `'${NAME}'` in single quotes | the project file does | Two details from our own test machines: Claude Code saved `~/.claude.json` readable by you only (mode 600), while the Grok CLI saved `~/.grok/config.toml` readable by other users of the machine (664). On a shared Mac or Linux box, tighten it: ```sh macOS / Linux chmod 600 ~/.grok/config.toml ``` ## Safe to commit: the name, never the value A committed config that carries the name works for everyone on the team, each with their own key. (The example is Clinamen's hosted server, whose keys come with Clinamen Signature when sales open at launch; the shape is the same for any keyed server.) ```json .mcp.json (Claude Code) { "mcpServers": { "clinamen": { "type": "http", "url": "https://mcp.clinamen.dev/mcp", "headers": { "Authorization": "Bearer ${CLINAMEN_LICENCE_KEY}" } } } } ``` Each person sets `CLINAMEN_LICENCE_KEY` in their own shell. If the variable is not set, the server receives the literal text `${CLINAMEN_LICENCE_KEY}` and Clinamen's says `unexpanded`. Set the variable in the terminal you start the agent from (or with `setx` on Windows, then open a new window) and restart the agent. Live demo on the web page (Is this config safe to commit?): Paste an MCP config or a command line. Each line is checked in your browser (nothing is sent or saved) for a value that looks like a real key, versus a reference such as `${env:NAME}`, `${NAME}`, `${input:id}`, `$env:NAME` or `%NAME%`. The example holds a made-up key on purpose. It is a first look, not a secret scanner: use `git log -S` (below) for history. ## .env files: ignore them before you create them Frameworks read keys from `.env.local` (Next.js, Vite) and many tools read `.env`. Ignore the local ones first, then check that git agrees: ```text .gitignore .env.local .env*.local ``` ```sh Terminal git check-ignore -v .env.local ``` That prints the `.gitignore` line that matches. No output means the file **is not** ignored. ## Did a key already get in? Search every commit on every branch for part of the key (ten characters are plenty, and you never have to paste the whole thing): ```sh Terminal git log --oneline -S "clm_abc123" --all ``` Each commit listed added or removed that text. If the commits were only ever on your machine, you can rewrite them. If they were ever pushed, assume the key is public: bots scan public repos within minutes, and forks and caches keep old commits. **Rotate the key** (most providers have a revoke or rotate button in their dashboard; otherwise write to their support and say the key leaked), update the variable on every machine that uses it, then clean the history at leisure. ## Places keys leak that are not git - `claude mcp get ` prints the server's headers in plain text, key included. Fine in your own terminal, not in a bug report. - A screen recording or stream of your terminal while you `echo` a variable or open a config file. - An agent transcript you share: if the agent read a config file, the key is in the transcript. - A cmd line that sets and prints a variable at once: `set NAME=value & echo %NAME%` prints the value from **before** the line ran, because cmd fills in `%NAME%` when it reads the line, so people try again with the real key on screen. Put the two commands on separate lines. ## What a careful server does with your key You can expect a server to keep the key in a header, never in the URL (URLs end up in logs and browser history), and to say why it refused a key without echoing it back. Clinamen's hosted server, for example, records each call as the tool, the entry, the tier and the time, and stores a hash of the key with a support ticket, never the key itself. How we tested this: Tested 28 October 2026 with git 2.43, Claude Code 2.1.312 and Grok CLI 1.0.70 on Linux. 28 Oct 2026, Linux, git 2.43: a made-up key committed to a scratch repo, found by `git log -S`, then untracked and ignored (`git check-ignore -v` printed the matching line). File modes as written by Claude Code 2.1.312 (`~/.claude.json`, 600) and Grok CLI 1.0.70 (`~/.grok/config.toml`, 664), each in an empty home folder. Claude Code filled `${CLINAMEN_LICENCE_KEY}` in from `.mcp.json` at start: a local test listener received the made-up key in the header. --- # Why AI-built sites all look the same, and five fixes that work URL: https://clinamen.dev/guides/ai-sites-look-the-same Updated: 2026-10-28 > Indigo gradients, Inter, three rounded cards, everything fading up. Why agents land there, and the five inputs that move a generated site off the default. ## The short answer 1. Give the agent your own design tokens (colours, type, radius, spacing) as CSS variables **before** it writes a page, and tell it to use nothing else. 2. Choose two typefaces on purpose and name them; never leave the font to the agent. 3. Write the real words and supply real images first. Placeholder copy is what makes layouts generic. 4. Ask for one signature motion moment, not an animation on every block. 5. Review against a short "tells" list and send the agent back with specific fixes. Spend an afternoon on any "built with AI" showcase and you will see the same page a hundred times: a centred hero on an indigo-to-violet gradient, Inter or the system font, three rounded cards with an emoji each, a soft glow, and every section fading up as it scrolls in. It is not that the models cannot do better. It is that, given nothing, they produce the most likely page. Live demo on the web page (The same page, before and after the five fixes): Drag the slider (or use the arrow keys) to compare. **Before**: what an agent makes from "a landing page for my coffee subscription" with nothing else: an indigo-to-violet gradient, a centred headline that could sell anything, three equal cards with an emoji each, a glow. **After**: the same page with the fixes below: two chosen typefaces, one accent from a small token file, the real offer and price, one customer's words, and nothing that exists only to fill a grid. Larkfield Roasters is invented; both versions are plain HTML and CSS. ## Why it happens A coding agent asked for "a landing page for my app" has no brand, no audience and no content to go on, so it fills every gap with the most common answer in what it learned from. The commonest answers are framework defaults: utility CSS libraries ship an indigo as the go-to accent, component kits ship a neutral grey theme with one font, and starter templates put three feature cards under a centred hero. Every default you leave open gets the same answer for everyone. Banning one tell does not help much either: forbid the purple gradient and you get the next most likely look. The fix is not a cleverer adjective. It is giving the agent decisions it cannot make for you. ## Fix 1: your tokens first, as variables Put the brand in one small file and make every component read from it. Agents follow a concrete list far better than a mood: ```css tokens.css :root { --brand-ink: #1d1a16; /* text */ --brand-paper: #f6f1e7; /* page */ --brand-accent: #c2410c; /* one accent, used sparingly */ --brand-muted: #6b6257; --brand-line: #e3dacb; --radius: 4px; /* square-ish: says "print", not "app store" */ --font-display: "Fraunces", Georgia, serif; --font-body: "Source Sans 3", system-ui, sans-serif; --space: 8px; } body { background: var(--brand-paper); color: var(--brand-ink); font-family: var(--font-body); } h1, h2, h3 { font-family: var(--font-display); } ``` Then say: "Use only the variables in `tokens.css`. No new colours, no new fonts, no new radii. If you need a value that is not there, ask me." That one sentence removes most of the sameness. ## Fix 2: pick the type yourself Type carries more personality than colour. A serif display face with a plain sans body reads editorial; a grotesque at heavy weight reads confident; a mono for numbers reads technical. Pick two, load them yourself (self-hosted files avoid a third-party request on every page view), and name them in the prompt. ## Fix 3: real words, real pictures Generic copy produces generic layouts. "Fast. Secure. Scalable." fits three equal cards, so you get three equal cards. Your real material does not: one long customer quote, a price table, a photo of the product in use. Give the agent the text and the images before it lays out the page, and the layout follows the content instead of the template. ## Fix 4: one motion moment, not twenty The fade-up-on-scroll on every section is the motion version of the purple gradient: it is what you get when nobody decided. Pick one moment that matters, such as the hero settling once on arrival, a price that rolls when the plan changes, or a button that confirms a save, and make that one feel good. Leave the rest still. Agents need concrete words to do this well; our [motion prompt cards](/guides/motion-prompts) are written for exactly that, and [scroll animations that do not fight the reader](/guides/scroll-animations) covers the scrolling kind. Finished pieces help here because the agent stops inventing timing curves: whatever component library you use, give the agent its entrance, button-feedback and text-reveal pieces by name and tell it to use those instead of writing new ones. Check that each reads your colour variables and has a reduced-motion version built in. ## Fix 5: review against the tells Before you accept a page, scan for these, and send the agent back with the exact fix: | Tell | Send it back with | |---|---| | Indigo or violet gradient behind the hero | "Flat `--brand-paper` background; the accent only on the main button." | | Inter or the system font everywhere | "Headings in `--font-display`, body in `--font-body`." | | Three equal cards with emoji icons | "One column for the main benefit with the customer quote beside it; no emoji." | | Every section fades up on scroll | "Remove scroll animations; keep only the hero entrance, once." | | Soft glow, glass, large blurred blobs | "No blur or glow effects; borders in `--brand-line`." | | Rounded 16 to 24 px corners on everything | "Use `--radius` only." | None of these are wrong in themselves. They are just what you get when you did not choose. How we tested this: Tested 28 October 2026 with Chromium 153. 28 Oct 2026. The `tokens.css` block was rendered in Chromium on a test page in light colours; every rule applied. The "tells" are the ones designers and reviewers list again and again in 2026 write-ups of AI-built sites (sources in our topic notes); the fixes are what we ask of our own agents when they build Clinamen's showcase pages. --- # Prompts that get good motion from your coding agent URL: https://clinamen.dev/guides/motion-prompts Updated: 2026-10-28 > Seven copyable prompt cards for buttons, page entrances, lists, reduced motion and motion audits, and why vague words like "smooth" get you generic animation. ## The short answer 1. Name the moment, not the mood: what the visitor did, what should answer, and when it stops. 2. Give numbers: durations (UI answers in 150 to 300 ms), an easing that starts fast and settles, and what may move (transform and opacity only). 3. Say what must not happen: no layout shift, nothing hidden while it waits to animate, no motion on load beyond one entrance. 4. Ask for the reduced-motion version in the same prompt. 5. If a component catalog is connected, tell the agent to search it and install a finished piece before it writes motion by hand. "Make it smooth and modern" is the motion version of "make it pop": the agent has to guess, and it guesses the most common answer, usually a fade-up on everything. The cards below replace adjectives with decisions an agent can follow and you can check. Copy one, change the bracketed parts, paste it into Claude Code, Cursor, Codex, Grok or any other agent. Live demo on the web page (Build a prompt card): Pick what moves, how it should feel and whether a component catalog is connected. The card follows the rules table below (the moment, numbers, what must not happen, the reduced-motion version) and copies with one press. Change the words in [brackets] to your own. Nothing is sent anywhere. ## The rules behind every card | Say | Instead of | Why | |---|---|---| | "answers within 100 ms, settles by 300 ms" | "fast" | numbers can be checked | | "starts fast and slows into place (ease-out)" | "smooth" | the easing is most of the feel | | "transform and opacity only" | nothing | anything else repaints or moves the layout and stutters | | "plays once, on arrival" | "animated hero" | stops it replaying on every scroll | | "with reduced motion: [what instead]" | nothing | otherwise it is forgotten | Prompt card: 1 · Set the house rules first ```text Before you add any animation to this project, write these rules into the project's agent instructions (CLAUDE.md, AGENTS.md or .cursor/rules) and follow them from now on: - Durations: 150 ms for small state changes, 200 to 300 ms for things entering or leaving, up to 500 ms for one page entrance. Nothing longer unless I ask. - Easing: ease-out (fast start, gentle stop) for things arriving, ease-in for things leaving, never linear except for spinners and progress. - Animate transform and opacity only. Never animate width, height, top, left, margin or box-shadow on a large area. - Nothing moves on page load except one entrance that plays once. No scroll-triggered fade-ups on every section. - Every animation has a prefers-reduced-motion version: keep the state change, drop the travel. - Put durations and easings in CSS variables and reuse them; no one-off values. Reply with the rules as you wrote them. ``` Do this once per project and every later prompt gets shorter. Prompt card: 2 · A button that confirms ```text The [Save] button needs to confirm what it did. When pressed it presses down slightly (about 97 % size, 100 ms). If saving takes longer than 300 ms, show a small spinner inside the button and keep the button's width fixed so nothing around it moves. When the save finishes, show "Saved" with a check for about 1.5 seconds, then go back to the normal label. If it fails, say so in words and offer Retry. Use only transform and opacity for the motion, use the colour variables the site already has, and honour prefers-reduced-motion (no scaling then, just the state change). If a component catalog is connected (an MCP server), search it for a press, loading and toast piece and install that instead of hand-building. Tell me what you changed and what you could not do. ``` The 300 ms rule is the important line: a spinner that flashes on a fast save is worse than none. Prompt card: 3 · A page that settles once ```text Add one entrance to [the hero]: the navigation, then the headline, then the buttons settle into place in that order, each moving up no more than 12 px and fading in, 60 to 80 ms apart, the whole thing done within 700 ms. It plays once per visit, on load, never again on scroll. The text must be readable and clickable from the first frame for anyone without JavaScript, and with reduced motion it simply appears. Do not animate anything else on the page. ``` "Readable from the first frame" stops the common bug where content stays invisible until a script runs. Prompt card: 4 · A list that keeps its place ```text When the [task list] is sorted or filtered, rows that stay should slide to their new positions (FLIP: measure, move, animate the transform) over about 250 ms with ease-out; rows that leave fade out in 150 ms; new rows fade in after the others have moved. Keyboard focus must stay on the same row it was on. With reduced motion, rows change place instantly. Do not animate height or top. ``` Prompt card: 5 · Make an existing site respect reduced motion ```text Audit every animation and transition in this project (CSS, JS and any animation library). For each, list file:line, what moves, and whether it respects prefers-reduced-motion. Then fix them: under reduced motion keep fades and colour changes, remove movement, scaling, parallax and auto-playing loops, and make sure no content stays hidden waiting for an animation. Show me the list before and after. ``` Prompt card: 6 · Find the motion to cut ```text Look at every animation on [the home page] and rank them by whether they help the visitor (confirm an action, show where something went, explain a change) or only decorate. Recommend which to remove. Also flag anything that animates layout properties, anything longer than 500 ms, anything that plays on scroll more than once, and anything that loops without a pause control. Do not change code yet. ``` Agents are good critics when you give them criteria. This one usually removes more than it adds, which is the point. Prompt card: 7 · Use a finished piece before hand-building ```text I want [a toast stack in the bottom right that says "Copied" for 2 seconds]. First search the connected component catalog for it and show me the top three matches with what each does. If one fits, install it with its own install recipe, set it up with our colours, and tell me how it differs from what I asked. Only build it by hand if nothing fits, and say so. ``` Without the first sentence, agents often build a look-alike even when the right piece is one call away: in our own agent tests, that was the most common miss in the first round. ## What we saw when we ran card 2 We ran card 2, word for word, through a small model (Claude Haiku) in Claude Code, on a plain three-file page with a component catalog connected over MCP (our own, Clinamen's local server, which opens to the public at launch). In 39 turns it searched the catalog, installed the press-and-toast piece with the catalog's own install line, set the press to 97 % for 100 ms, the spinner delay to 300 ms and the "Saved" hold to 1.5 s, and added a Retry line. Then it said what it had not checked: it had not opened a browser, and the piece keeps a spinner up for at least 400 ms once shown, which it offered to lower. We opened it in a browser: the button pressed to 97 %, showed "Saving" with a spinner, then "Saved" with a check, never changed width, and did not scale at all with reduced motion on. That last paragraph of its answer is the part to ask for every time: an agent that tells you what it did not verify saves you finding it later. How we tested this: Tested 28 October 2026 with Claude Code 2.1.312 with Claude Haiku, Chromium 153. 28 Oct 2026, Claude Code 2.1.312 with Claude Haiku, headless, on a scratch page (index.html, style.css, app.js) with Clinamen's local MCP server (pre-release 0.1.0) connected over stdio. Card 2 as printed above; the result opened in Chromium (press scale 0.97, width fixed through Saving and Saved, scale 1 with reduced motion, no console errors). The other cards were written from the same rules and checked for consistency with the [reduced motion](/guides/reduced-motion) and [janky animation](/guides/janky-animation) guides; they were not each run through an agent. --- # Dark mode and brand colours with a coding agent, without the invisible text URL: https://clinamen.dev/guides/dark-mode-brand-colours Updated: 2026-10-28 > Colour variables by role, a dark block that changes only their values, and the attribute every component can see. Plus a prompt for your agent. ## The short answer 1. Name your colours by role (`--ink`, `--paper`, `--accent`, `--muted`, `--line`), not by hue, and define them once on `:root`. 2. Add a dark block that changes only those values, for both the system setting and a manual switch: `@media (prefers-color-scheme: dark)` plus `[data-theme="dark"]`. 3. Mark which theme is showing on `` (`data-theme="dark"` or a `dark` class) and set `color-scheme`, so form controls, scrollbars and third-party components follow. 4. Check contrast in both themes: body text at least 4.5:1 against its background, large text and icons at least 3:1. 5. Ask your agent to follow these rules in one message (the prompt card below), then look at every page in both themes. The most common dark-mode bug in AI-built sites is not ugly colours. It is text you cannot see: a component that still draws dark text because it never learned the page went dark. It happens when dark mode is painted on as a background colour instead of being a state every component can read. ## Colours by role, defined once ```css colours.css :root { --paper: #fbfaf7; /* page background */ --surface: #ffffff; /* cards, inputs */ --ink: #1b1a17; /* text */ --muted: #5f5b53; /* secondary text */ --line: #e4e0d8; /* borders */ --accent: #b4410f; /* brand: buttons, links */ --on-accent: #ffffff; color-scheme: light; } ``` Every rule in the site then uses only these names: `color: var(--ink)`, `background: var(--surface)`. A hard-coded `#333` anywhere is a future invisible-text bug. ## The dark values, two ways in ```css colours.css (continued) @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --paper: #141311; --surface: #1d1c19; --ink: #f1eee8; --muted: #a8a397; --line: #34322d; --accent: #f08a4b; --on-accent: #1b1a17; color-scheme: dark; } } :root[data-theme="dark"] { --paper: #141311; --surface: #1d1c19; --ink: #f1eee8; --muted: #a8a397; --line: #34322d; --accent: #f08a4b; --on-accent: #1b1a17; color-scheme: dark; } ``` The first block follows the visitor's system setting unless they chose light; the second applies when they chose dark on your switch. Notice the accent changes too: an orange that reads well on cream is too dark on near-black, and the text on it flips from white to dark. Live demo on the web page (Your brand colour, both themes, measured): Pick a brand colour and a theme. The sample card re-themes through the role variables above, and each text pair shows its measured contrast (WCAG 2): body text, secondary text, a link and the button label. The dark accent keeps your hue and is lightened until links read at 4.5:1 on the dark card; the button label flips between white and near-black, whichever reads better. Tick **background only** to see the common bug: the page goes dark and the text does not. Open **The CSS for these colours** to copy the values. ## Say which theme is showing A component you install (a chart, a date picker, a toast) cannot see your background colour. It can see an attribute. Set one on `` and keep it in step with the switch: ```js theme.js const root = document.documentElement; function setTheme(choice) { // 'light' | 'dark' | 'system' if (choice === 'system') root.removeAttribute('data-theme'); else root.setAttribute('data-theme', choice); try { localStorage.setItem('theme', choice); } catch {} } const saved = (() => { try { return localStorage.getItem('theme'); } catch { return null; } })(); if (saved === 'light' || saved === 'dark') root.setAttribute('data-theme', saved); ``` Load that before your CSS (a small classic ` ``` Without the script, there is no `js` class and nothing is hidden. With reduced motion, nothing is hidden. Each element reveals once, then the observer lets go of it. Put the first `