Brave Search MCP: 422 "x-subscription-token" missing when using npx version
I'm on Windows running
@brave/brave-search-mcp-servervia npx under WSL. The server starts and exposes 6 tools, but every request fails with422 Unable to validate request parameter(s)andx-subscription-tokenlisted as a missing header. What doesx-subscription-tokenmean, and where should the API key go?Originally asked on GitHub: https://github.com/brave/brave-search-mcp-server/issues/56
5 answers
Closed as explained by the maintainer: the
x-subscription-tokenheader is how the Brave Search API key is transmitted with each request, so the 422 about that header indicates the API key was not delivered the way the server expects. The maintainer's instructions were to sign up and generate a key at https://brave.com/search/api/ (opens external site) and pass it as the value of theBRAVE_API_KEYvariable for the MCP server. The thread does not confirm whether the reporter verified the key or that the error went away.If you use Docker instead, the maintainer pointed to the official image at https://hub.docker.com/r/mcp/brave-search (opens external site). Note that the reporter's Docker setup exposed only 2 tools while the npx version exposed 6, so the two setups are not equivalent.
One commenter on macOS got the same 422 but with code
SUBSCRIPTION_TOKEN_INVALIDeven though plain HTTP requests with the same key worked; no fix was reported for that case. Another commenter passed along that Claude Code suspected a bug in how the HTTP header is sent, but this remained speculation and no fix followed from it.General advice: the API key lives in your MCP client config, and using
--brave-api-keyalso puts it in the process command line, so keep it out of committed or shared files.Did this work for you?What @jonathansampson tried on GitHub (Outcome unclear)
Maintainer explained that
x-subscription-tokenis the header carrying the API key and instructed to generate a key at https://brave.com/search/api/ (opens external site) and set it as theBRAVE_API_KEYvariable; also recommended the official Docker imagemcp/brave-search. No reporter confirmed that this fixed their setup.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Reporter on Windows ran the npx server through WSL with
--brave-api-keyin args andBRAVE_API_KEYin the env block; the server started and exposed 6 tools, but every request returned 422 withx-subscription-tokenlisted as a missing field.Source: https://github.com/brave/brave-search-mcp-server/issues/56 (opens external site)
Did this work for you?What @boldprojekte tried on GitHub (Didn't work)
Commenter on macOS got the same 422 with code
SUBSCRIPTION_TOKEN_INVALIDfrom the MCP server, while plain HTTP requests using the same key succeeded.Did this work for you?What @boldprojekte tried on GitHub (Outcome unclear)
Commenter relayed that Claude Code suspected a bug in how the HTTP header is sent, but this was speculation and no fix followed.
Did this work for you?