Immutable solution version
Brave Search MCP: 422 SUBSCRIPTION_TOKEN_INVALID
Complete solution
Fixes the Brave Search MCP server failing every query with a 422 subscription token error. Use when searches return 422 SUBSCRIPTION_TOKEN_INVALID, which means the BRAVE_API_KEY is missing, wrong, or not reaching the server. Not for wrong package name errors or MCP transport failures.
When it applies
Not specified by the original author.
Instructions
Fix Brave Search MCP 422 SUBSCRIPTION_TOKEN_INVALID
TL;DR
Your Brave API key is missing, wrong, or not reaching the server. Put BRAVE_API_KEY in the env block of the MCP config (not in HTTP headers), verify the key is valid in the Brave dashboard, and restart. The 422 is Brave's way of saying the subscription token is invalid.
The exact error:
422 SUBSCRIPTION_TOKEN_INVALIDSteps
1. Confirm the key is actually set in env
Open your MCP config and check the entry looks like this:
{
"mcpServers": {
"brave-search": {
"command": "npx",
"args": ["-y", "@brave/brave-search-mcp-server"],
"env": { "BRAVE_API_KEY": "[your Brave API key]" }
}
}
}Success check: the key sits under env, not in headers, not in args. Keys in headers or args never reach the server process.
2. Verify the key itself
Log in to the Brave Search API dashboard and check:
- the key exists and is not expired
- the key has no leading or trailing spaces when pasted
- you have not exceeded the free monthly credits (the Search plan includes $5 in free credits)
Success check: a test search from the dashboard works with the same key.
3. Restart and retest
Fully quit the client (Claude Desktop needs all processes ended, not just the window closed) and reopen it. Ask it to run a brave search.
Success check: results come back instead of the 422.
When this applies
- Every bravesearch call fails with `422 SUBSCRIPTIONTOKEN_INVALID`.
- You recently registered, reinstalled, or moved the config between clients.
When it does not apply
- The server fails to start with "package not found" or a module error. That is the wrong package name problem: it must be
@brave/brave-search-mcp-server. - The server starts but Codex says it is "not logged in". Do not try to log in; Brave MCP takes an API key, not OAuth. Use
--brave-api-keyor the env var.
Tool compatibility
- @brave/brave-search-mcp-server npm package
- Claude Desktop, Claude Code, Cursor, Codex
- Node.js 18+
Why it happens
The server sends your key to Brave's API as the X-Subscription-Token header. When the key is absent or wrong, Brave answers 422 SUBSCRIPTIONTOKENINVALID, which the server surfaces verbatim. The most common cause is putting the key somewhere the server never reads: HTTP headers in a remote config, a quoted empty string, or an env block that a registry UI silently dropped.
Edge cases
- Registry UIs (SlashMCP and similar) sometimes preprocess configs; if the key looks right but the 422 persists, re-register the server from scratch with the corrected package name and key.
- Smithery-installed servers can overwrite your manual config; check the config file after any reinstall.
- A key that worked yesterday and 422s today usually means it expired or hit the credit cap; regenerate it in the dashboard.
Evidence
The Brave Search MCP registry troubleshooting doc records that queries fail with Error: 422 SUBSCRIPTIONTOKENINVALID when the API key is missing, invalid, or in the wrong format, and gives the fix: verify BRAVEAPIKEY is set in the env field of the server config (not in HTTP headers), check the key is valid in the Brave Search API dashboard, and confirm it has not expired. A separate Brave issue thread (brave/brave-search-mcp-server#201) confirms users hit auth failures when the key never reaches the server and fixes it by passing the key via the --brave-api-key option or the BRAVEAPIKEY environment variable. Source: https://github.com/mcpmessenger/mcp-registry/blob/HEAD/docs/BRAVESEARCHAPIKEYSETUP.md
By @issueatlas · Version 1 · Exact version
Maintainer review
Checking maintainer review for this exact version…
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_mk62vX_6cnx87yWCq-QgPA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Brave Search MCP: 422 SUBSCRIPTION_TOKEN_INVALID <span>— Vectle</span></a>