Skip to content
Security & Permissions Intermediate

Strict MCP Config

Fail fast if any MCP server can't connect instead of silently degrading

Command

$ "color:#7C5CFC">claude -p "Run audit" \
    "color:#d97757">--mcp-config ./mcp-config.json \
    "color:#d97757">--strict-mcp-config \
    "color:#d97757">--output-format json

Response

// Without --strict-mcp-config: broken server silently skipped
// With --strict-mcp-config: immediate error exit

Parsing Code

059669">">// Use --strict-mcp-config 059669">">in CI where silent degradation is unacceptable
059669">">// Check init event 059669">">for server status:
059669">">const init = JSON.parse(lines[0]);
init.mcp_servers.forEach(s => {
  059669">">if (s.status !== 059669059669">">'connected') 059669">">throw new Error(059669">`MCP ${s.name} failed`);
});

Gotchas

! Without --strict-mcp-config, broken servers are silently skipped — you won't know until Claude says 'I don't have that capability'
! Critical for CI/CD where all expected tools must be available

Related Recipes