Skip to content
BENIBIX Learn

--mcp-config Flag

Also known as claude --mcp-config

It loads MCP servers for one session from JSON.

Think of it like

It is like you bring more toys to a friend's house. They are just for today.

Example

Emma's CI job needs a ticket server that no developer has set up. The job passes it with --mcp-config, so it is there for that run only.

Why it matters

A run can bring the servers it needs without touching anyone's saved setup.

Definition

--mcp-config loads MCP servers for this session from JSON files or JSON strings. Pass more than one with spaces between them. These servers join the ones you already set up. With -p, Claude Code waits up to 30 seconds by default for them to connect before the first turn.

Example code

bash
claude -p --mcp-config ./ci-mcp.json "Check the open tickets"
Load the CI's MCP servers for this run.
Without --strict-mcp-config, both sets of servers load.

Common mistake

Thinking only these servers load. Your other servers load too, unless you add --strict-mcp-config.

Key takeaways

  1. 1
    Files or strings. JSON.
  2. 2
    Adds to yours. Not instead.
  3. 3
    Waits to connect. With -p.

Compare

Learn it properly