Claude Code stops clobbering your .mcp.json
I keep a handful of MCP servers wired into my coding agent, and the part I always dislike is the setup: pasting an API token into a shell command that then lives forever in my shell history. Claude Code's mid-November releases quietly fix that, and they fix a nastier bug in the same command. I read the v2.1.327 release notes (17 Nov) and the v2.1.329 notes (19 Nov) to see exactly what changed.
Tokens without the shell history
v2.1.327 adds claude mcp add-json <name> -, which reads the server's JSON from stdin. The release note says the point outright: tokens can stay off the command line. It is also explicitly not available inside a Claude Code session, so this is something you run from your own terminal.
In practice that means piping from a file or a secret manager instead of inlining the config as an argument. I haven't built my own pipeline around it yet, so treat the exact invocation as the one in the notes and check claude mcp add-json --help on your version. The principle is the old one: anything on a command line is visible in ps output and usually ends up in history, and stdin is neither.
The .mcp.json clobbering fix
The more interesting line is a bug fix: claude mcp add and claude mcp remove with project scope used to delete other top-level keys from .mcp.json, such as $schema or another tool's servers. That file is committed to the repo and shared with other tools, so an innocent mcp add could rewrite it and silently drop someone else's config. If you have ever seen a diff in .mcp.json that removed things you never touched, this is likely why.
The same release also changes claude mcp add --scope project to stop, instead of overwriting the file, when .mcp.json lists its servers at the top level with no mcpServers key. Stopping rather than guessing is the right call for a file several tools write to.
Hooks get named in the trust dialog
v2.1.329 adds a trust dialog warning that says where a folder's hooks are declared. I've written before about opening a repo turning into code execution via settings files, so I like this one. A hook is a command that runs on your machine, and knowing whether it comes from the project, a user file or somewhere else is exactly the information you want before you click through a trust prompt. The same release adds a warning when hooks in managed settings fail to load in non-interactive hosts like Claude Desktop, so a missing guardrail is no longer silent.
One related change worth knowing if you gate actions with hooks: v2.1.328 added "onFailure": "block" for mcp_tool hooks, matching command and HTTP hooks, so a hook whose call fails blocks the action. And v2.1.329 notes that in Code Mode a PreToolUse hook that errors no longer refuses a script's tool call, as outside Code Mode, so set that same onFailure value on any hook that must refuse.
What I'm doing about it
- Update, then diff
.mcp.jsonafter anymcp addormcp removein a repo with other tooling. - Move any server whose token I pasted inline to the stdin form, and rotate the ones already sitting in history.
- Re-read hook declarations in repos I open from strangers, now that the trust dialog tells me where they live.
None of this is glamorous, but it is the kind of release I trust more than a big feature drop: it closes small, real ways to leak a secret or wreck a shared config file. Update, check your diffs, and keep tokens out of your history.