AI News Daily한국어
← AI tool tips
Claude Code✓ Confirmed in official docsAdded Nov 18

How to add a Claude Code MCP server with add-json without putting tokens on the command line

Claude Code's claude mcp add-json registers an MCP server from a single JSON configuration. Until now the JSON had to be a command argument, so an API token in its headers ended up in your shell history.

Since v2.1.327 (November 17), passing - in place of the JSON reads it from stdin. Keep the configuration with the token in a file and pass that instead.

claude mcp add-json weather-api - < weather-mcp.json

The file holds the same JSON you used to pass as an argument.

{"type":"http","url":"https://api.weather.com/mcp","headers":{"Authorization":"Bearer YOUR_TOKEN"}}

A pipe works too.

cat weather-mcp.json | claude mcp add-json weather-api -

According to the changelog, this form isn't available inside a Claude Code session, so run it in your own terminal instead of asking Claude to. Afterwards, check the connection with claude mcp get weather-api, and delete the JSON file with the token or move it somewhere git won't pick it up.

Get notified when a new tip lands

Tip alerts only go out in the app. Install it and turn notifications on.

Get the app

All tips →