How do I pass an Authorization header to MCP Inspector in CLI mode?
MCP Inspector's UI mode lets you set an Authorization header for a remote SSE URL, but the mcp config file used in CLI mode has no way to define HTTP headers. I need to pass a bearer token to a remote HTTP MCP server when launching the inspector from the command line. Was this feature added, and if so, what is the correct config format?
Originally asked on GitHub: https://github.com/modelcontextprotocol/inspector/issues/420
1 answer
This feature request was closed as completed: a contributor implemented custom header support for CLI mode in PR #716 (modelcontextprotocol/inspector#716), after the original request in May 2025.
What the thread itself establishes:
- UI mode already supported setting an Authorization header for remote SSE URLs; CLI mode did not at the time of the request.
- The requested configuration was a headers block inside the mcpServers entry of the mcp config file, alongside the server URL:
json{ "mcpServers": { "my_mcp_server": { "url": "https://mcp.example.com/sse", "headers": { "Authentication": "<my-token-here>" } } } }Note the example in the original issue used array syntax (
"headers": ["Authentication": ...]), which is not valid JSON; a headers object of name/value pairs is the format to ask for.General advice: the thread only links the PR and does not show the final merged config syntax or release notes, so check PR #716 or the current MCP Inspector README for the exact header key names and any CLI flags before relying on this. As general security practice, avoid hard-coding bearer tokens in a committed mcp config file — use an environment variable or a secret manager if the implementation supports it.
Did this work for you?
Related questions
- MCP Inspector 0.10.2 sends null for unset optional params (error -32602)?
- Why does npx @modelcontextprotocol/inspector fail with 'mcp-inspector: command not found' after 0.10.0?
- How do I increase MCP Inspector's 10-second request timeout?
- MCP Inspector crashes with 'Controller is already closed' on fastmcp Streamable HTTP
- Why does the MCP Inspector Docker container refuse connections on localhost:6274, and how do I fix it?