
Passing MCP JSON via Stdin in Claude Code 2.1.327
Learn how Claude Code version 2.1.327 lets you pass MCP configurations via standard input using claude mcp add-json <name> -, keeping sensitive Bearer tokens out of shell history and process lists. We also explore the expanded diagnostic checks in /status, safer .mcp.json edits, and other workflow fixes.
Chapter 1
Keeping MCP Tokens Off the Command Line
Lachlan Reed
Brought to you by Jellypod AI, this is The Claude Code Changelog. Version 2.1.327 landed on November 17th, and one line in it fixes a habit a lot of us have had for ages. You can now run claude mcp add-json, a server name, and then a lone dash, and Claude Code reads the server's JSON from standard input.
James Turner
Which matters because of where tokens used to end up. If you passed a Bearer token inline, it sat in your shell history, and it showed up in the process list while the command ran. The changelog says the point is, quote, so tokens can stay off the command line. That's the same credential leakage theme as our MCP security episode on denylists, just at the CLI layer this time.
Lachlan Reed
So the fix is basically, don't shout your password across the room. Show us the pattern.
James Turner
Simplest one is a here-doc. You write claude mcp add-json secure-api, space, dash, then open a here-doc. Inside it, a JSON object with type set to http, a url, and a headers block with Authorization. For the token, you can use command substitution from a vault, like vault read, field token, on your secret path. The shell expands it before Claude Code sees it, and the token never lands in your history as a literal.
Lachlan Reed
And there's a file version too, yeah? Keep a git-ignored config, say .mcp.secrets.json, and run cat on that file, piped into claude mcp add-json private-service, dash. Handy for setup scripts and CI, where command logs are the sneaky leak.
James Turner
Now the caveats. First, this is a terminal command only. The changelog says it's not available inside a Claude Code session, so run it before you launch claude, or in your provisioning script. Second, include the type field. A JSON entry with a url but no type gets read as a stdio server, so Claude Code skips it and tells you to add type http, sse, or ws. Streamable-http works as an alias for http, per the docs.
Lachlan Reed
One more careful bit. If you build that JSON with echo and a variable, the token is still in the shell's own expansion, so the here-doc or file route is tidier. That's my reading, not something the changelog spells out.
James Turner
Fair enough. Related fix in the same release: project scoped claude mcp add and claude mcp remove used to delete other top level keys in .mcp.json, like a dollar schema entry or another tool's servers. That's fixed, so those edits are safe now.
Lachlan Reed
Smaller wins. The /status command now lists broken agent, skill, command and output style files, keybinding errors, an unavailable sandbox, ignored permission settings, and hook matchers that never match. Handy when a hook just silently never fires. Also, /tui classic is now the name for the non fullscreen renderer, and /tui default still works. And /install-github-app asks for confirmation before changing a repository.
James Turner
And remote control in worktree mode no longer deletes git-ignored files like .env when you stop the server. Update, move your tokens to stdin, and run /status once to see what's been quietly broken.