brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: claude --strict-mcp-config --mcp-config loads only the MCP servers you name

Claude
~/tips/tip-claude-code-strict-mcp-config

claude --strict-mcp-config --mcp-config ./only-this.json

Starts Claude Code with only the MCP servers from the file you pass, skipping all others.

My MCP servers pile up over time, and a session that needs one of them still starts them all. A pair of flags gives me a session with exactly the servers I choose.

--mcp-config loads MCP servers from one or more JSON files or strings. --strict-mcp-config makes Claude Code skip the servers configured in places such as .mcp.json, ~/.claude.json or a plugin, and load only the ones you pass.

claude --strict-mcp-config --mcp-config ./only-this.json

A minimal file for one local server looks like this, using the mcpServers wrapper that Claude Code reads:

{
  "mcpServers": {
    "example": {
      "command": "npx",
      "args": ["-y", "@example/mcp-server"]
    }
  }
}

The CLI reference adds that with -p, Claude Code waits for servers that are still pending to connect before it runs the first turn, up to the MCP_TIMEOUT startup timeout (30 seconds by default). That helps scripted runs, because the tools exist when the prompt starts. It requires Claude Code v2.1.221 or later.

@example/mcp-server is a placeholder for the server you actually use. Under a managed MCP file the strict flag behaves differently, and the docs section on exclusive control with managed-mcp.json explains how. An MCP server runs code on your machine, so only name servers you trust.

Further reading: Claude Code CLI reference

More Claude tips /recap /focus /skill-doctor /autocompact 500k claude purge ~/work/my-repo --dry-run All Claude tips (83) All topics

Link