claude -p with HTTP MCP server silently exits with no output
Resolved 💬 3 comments Opened Mar 8, 2026 by abanjaara Closed Mar 12, 2026
Description
claude -p with --mcp-config containing an HTTP MCP server silently exits with code 0 and produces no output. Local stdio MCPs work fine. This has persisted since at least 2.1.58 through current 2.1.71.
Reproduction
# Works fine — no MCP:
claude -p "say hello" --output-format json
# Works fine — stdio MCP:
claude -p "say hello" --mcp-config '{"mcpServers":{"pw":{"command":"npx","args":["@playwright/mcp@latest","--headless"]}}}' --output-format json
# Silent exit, code 0, no output — HTTP MCP:
claude -p "say hello" --mcp-config '{"mcpServers":{"notion":{"type":"http","url":"https://mcp.notion.com/mcp"}}}' --output-format json
# Also silent exit with any HTTP URL:
claude -p "say hello" --mcp-config '{"mcpServers":{"test":{"type":"http","url":"https://httpbin.org/status/200"}}}' --output-format json
Expected behavior
claude -p should either:
- Connect to the HTTP MCP and proceed normally, OR
- Fail with a clear error message if the connection fails
Actual behavior
Process exits with code 0, no stdout, no stderr. Completely silent.
Environment
- Claude Code: 2.1.71
- macOS 15.3 (Darwin 24.3.0), arm64
- Node: v22.20.0
Notes
- The old schema (
"url":"..."without"type":"http") is now properly rejected with a schema validation error — that part was fixed - The issue is specifically with the HTTP transport in
-p(print/non-interactive) mode --strict-mcp-configvs without makes no difference- This blocks using any remote/HTTP MCP server (Notion, GitHub, etc.) in headless/automated scripts
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗