Blog

Brave Search MCP server: setup, tools and the API key

T. Krause ·

The Brave Search MCP server is Brave's official MCP server for the Brave Search API. It gives Claude Code, Cursor, VS Code or any other MCP client tools that search Brave's own web index, pull page text for the model's context and write answers from live results. The source is at github.com/brave/brave-search-mcp-server, and the package on npm is @brave/brave-search-mcp-server. It runs on your machine and reads a Brave Search API key from the environment. Brave's README describes no hosted endpoint.

The first half of this guide sets up Brave's server. The second half covers Prompt TM's Brave Search toolkit, for agents that should reach Brave through the same MCP URL as their other apps. The Brave details below come from Brave's GitHub repository (version 2.2.0) and its API pages as of November 2026.

Get a Brave Search API key

Sign up on the Brave Search API page, choose a plan in the dashboard, then create a key under API Keys. Brave sells two plans that matter here:

  • Search covers search results (web pages, news, images and more) and LLM context.
  • Answers covers the written answers from Brave's Answers API.

A key reaches the endpoints its plan includes. Brave's README says the answer tool needs an Answers plan. Current rates and the monthly free credit are on Brave's API page.

The nine tools in Brave's server

Brave's README lists these tools:

ToolWhat the agent gets back
brave_web_searchWeb results with titles, URLs and snippets, filtered by country, language, freshness and result type
brave_local_searchLocal businesses with ratings and hours. Brave notes it needs a Pro plan and falls back to web search otherwise
brave_place_searchPlaces in an area, by location name or coordinates, with address, hours, contact details and ratings
brave_news_searchNews articles, from the last 24 hours unless the agent sets freshness
brave_image_searchImage results with URLs and metadata
brave_video_searchVideo results with thumbnails and metadata
brave_llm_contextText already extracted from the top pages, sized for an agent's context window
brave_answersA written answer from a live search, with optional citations and a multi-search research mode
brave_summarizerDeprecated. A summary from a web search's summary key, kept for existing Pro AI subscribers

For new work Brave points to brave_answers instead of the summarizer: one call instead of a search and a second call with its key. brave_answers needs an Answers plan. Its research mode (enable_research) runs several searches and can take minutes. Brave warns that clients which cap a request at around 60 seconds may need a lower research_maximum_number_of_seconds.

brave_llm_context is the tool to try first for grounding. The agent gets the relevant passages from the top results in one call and doesn't have to fetch each page itself.

Add Brave's server to your client

Claude Code. Add the server with the key in its environment:

claude mcp add brave-search -e BRAVE_API_KEY=YOUR_API_KEY -- \
  npx -y @brave/brave-search-mcp-server --transport stdio

Cursor and Claude Desktop. Both read an mcpServers block. In Cursor that's ~/.cursor/mcp.json, in Claude Desktop claude_desktop_config.json:

{
  "mcpServers": {
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@brave/brave-search-mcp-server", "--transport", "stdio"],
      "env": {
        "BRAVE_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

The README also has a Docker version: replace the command with docker and the arguments with ["run", "-i", "--rm", "-e", "BRAVE_API_KEY", "docker.io/mcp/brave-search"].

VS Code. VS Code uses servers instead of mcpServers, and Brave's README adds an input so VS Code asks for the key instead of storing it in the file. In .vscode/mcp.json:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "brave-api-key",
      "description": "Brave Search API Key",
      "password": true
    }
  ],
  "servers": {
    "brave-search-mcp-server": {
      "command": "npx",
      "args": ["-y", "@brave/brave-search-mcp-server", "--transport", "stdio"],
      "env": {
        "BRAVE_API_KEY": "${input:brave-api-key}"
      }
    }
  }
}

Settings worth knowing

The server reads its configuration from environment variables or the matching command-line flags:

  • BRAVE_API_KEY_FILE reads the key from a file and wins over BRAVE_API_KEY. It's meant for Docker secrets and other mounted files.
  • BRAVE_MCP_ENABLED_TOOLS and BRAVE_MCP_DISABLED_TOOLS take a space-separated list of tools to allow or to hide. Use them to keep an agent on, say, brave_llm_context and brave_news_search only.
  • BRAVE_MCP_TRANSPORT=http (or --transport http) serves the tools over HTTP at port 8080. Since version 2.0 the default is stdio.

Read the HTTP part of the README before sharing a server with a team. The HTTP endpoint has no authentication of its own, so the server binds to 127.0.0.1 unless you set BRAVE_MCP_HOST. Brave says to bind to 0.0.0.0 only on a trusted network. Anyone who can reach the port searches on your key.

Older guides install @modelcontextprotocol/server-brave-search, the reference server from the MCP project. It now sits in the archived servers-archived repository, npm marks the package as no longer supported, and it had two tools, brave_web_search and brave_local_search. Replace it with @brave/brave-search-mcp-server. The web and local search tools keep their names.

If you're upgrading Brave's own server from 1.x, two things changed in 2.x. The default transport became stdio, and brave_image_search stopped returning base64 image data and returns image URLs and metadata instead.

Which one to use

  • Your own coding agent, run on your machine. Use Brave's server with your key in the client config.
  • A team that shares one search key. Run Brave's server over HTTP behind your own authentication, or give each person their own key.
  • An agent that uses Brave next to other apps, keeps the key out of every client's config, or searches with each user's own key. Use Prompt TM's Brave Search toolkit, which the rest of this guide covers.

You can use both. Keep brave-search in Claude Code for your own lookups and give the agent you ship Brave through Prompt TM.

Where the toolkit differs from Brave's server

Prompt TM calls the Brave Search API at api.search.brave.com directly. It doesn't run Brave's MCP server, so its tool list and inputs differ.

Brave's MCP serverPrompt TM's Brave Search toolkit
Where the agent connectsA process on your machine, or your own HTTP serverThe same MCP URL as its GitHub, Linear or Slack tools
Credentials in the clientA Brave API key in the client config or a key fileOne Prompt TM key. The Brave key stays encrypted on Prompt TM
Whose key a call usesThe one key the server was started withThe key of the user the agent acts for, connected through the API or a connect link on prompt-tm.com
Local businessesbrave_local_search and brave_place_searchBRAVESEARCH_PLACE_SEARCH only
Written answersbrave_answers, with citations and a research modeBRAVESEARCH_ANSWER, a single answer without the citation or research options
Query helpA spellcheck input on the search tools, no separate toolsBRAVESEARCH_SUGGEST for completions and BRAVESEARCH_SPELLCHECK for corrections
Location hints for LLM contextx-loc-* headersNot supported

Prompt TM's nine Brave Search tools

The last column names the closest tool on Brave's server.

ToolWhat it doesClosest Brave MCP tool
BRAVESEARCH_WEB_SEARCHSearches the web and returns results with titles, URLs and snippets, plus news, videos, discussions, FAQs and an infobox where they applybrave_web_search
BRAVESEARCH_LLM_CONTEXTReturns the relevant text from the top pages with its sources, sized for the agent's contextbrave_llm_context
BRAVESEARCH_ANSWERAnswers a question in prose from a live search and returns an OpenAI-compatible chat completionbrave_answers
BRAVESEARCH_NEWS_SEARCHSearches news and returns titles, URLs, sources and each article's agebrave_news_search
BRAVESEARCH_VIDEO_SEARCHSearches videos and returns titles, thumbnails, duration, views and creatorbrave_video_search
BRAVESEARCH_IMAGE_SEARCHSearches images and returns titles, thumbnails, metadata and the source pagebrave_image_search
BRAVESEARCH_PLACE_SEARCHFinds businesses and places by location name or coordinatesbrave_place_search
BRAVESEARCH_SUGGESTReturns query completions for a partial queryNone
BRAVESEARCH_SPELLCHECKReturns spelling corrections for a queryNone

Web, news and video search take country, search_lang, freshness (pd, pw, pm, py or a date range) and an offset from 0 to 9 for paging. Web search, news search and LLM context also take goggles, Brave's custom re-ranking. BRAVESEARCH_LLM_CONTEXT takes token limits for the whole context and per page, and a context_threshold_mode for how closely a passage must match the query. BRAVESEARCH_ANSWER takes brave or brave-pro as its model and search_context_size for how much search content the answer draws on.

All nine tools are marked read-only, so an MCP server set to Ask a person before destructive calls or Ask a person before any call that changes something holds none of them. Each call is still a billed Brave request. To keep the agent off a tool, leave it out when you pick the server's tools, or set restrict_to_following_tools on the auth config to keep it away from every account on that config. Details are in the router docs.

Connect Brave Search to Prompt TM

The Brave Search toolkit takes a Brave Search API key, which Prompt TM sends in Brave's X-Subscription-Token header. The toolkit has no Brave sign-in, and Brave's API has no account endpoint to test a key against, so Prompt TM saves the key without a test call. A wrong key shows up as an error on the agent's first search, under Logs.

1. Add an auth config for Brave Search. In the dashboard, open Auth configs → New, choose Brave Search and API key. Or with the API:

curl -X POST https://www.prompt-tm.com/api/v3/auth_configs \
  -H "x-api-key: $PROMPT_TM_KEY" -H "content-type: application/json" \
  -d '{ "toolkit": { "slug": "bravesearch" }, "auth_config": { "auth_scheme": "API_KEY" } }'

2. Connect an account. With your own key:

curl -X POST https://www.prompt-tm.com/api/v3/connected_accounts \
  -H "x-api-key: $PROMPT_TM_KEY" -H "content-type: application/json" \
  -d '{ "auth_config": { "id": "ac_..." }, "user_id": "me",
        "connection": { "data": { "api_key": "YOUR_BRAVE_API_KEY" } } }'

For a user's own key, POST /api/v3/connected_accounts/link returns a connect link on prompt-tm.com with a form for the key, so the key never passes through your app or the agent. The link expires after one hour. More in the authentication docs.

3. Create an MCP server. In MCP servers → New, choose Custom, tick Brave Search, and under Only some tools pick the tools the agent should see. If the key is on a Search plan, leave out BRAVESEARCH_ANSWER. Add the agent's other toolkits to the same server. Copy the server URL.

4. Add it to your client. In Cursor, ~/.cursor/mcp.json:

{
  "mcpServers": {
    "prompt-tm-brave": {
      "url": "https://www.prompt-tm.com/mcp/mcp_...?user_id=me",
      "headers": { "x-api-key": "ptm_..." }
    }
  }
}

In Claude Code:

claude mcp add --transport http prompt-tm-brave \
  "https://www.prompt-tm.com/mcp/mcp_...?user_id=me" \
  --header "x-api-key: $PROMPT_TM_KEY"

The name prompt-tm-brave keeps this server apart from Brave's own brave-search server if you added both. The user_id in the URL picks whose Brave key the calls use. The other clients are in the MCP client docs, and Claude Code MCP server setup covers scopes and sharing a server in .mcp.json without committing the key. Then ask something like "Find this week's news about the EU AI Act and list the sources." The call shows up under Logs with the tool, the user and the outcome.

To put Brave Search in a router with the rest of the catalogue instead of a fixed tool list, see tool router vs fixed tools. If you're choosing between search providers, the Perplexity MCP guide covers the same setup for Perplexity's search and answer tools. The Brave Search toolkit page lists every input. Prompt TM is free during early access, with 20,000 tool calls per project per month. To try it, create a free project and connect a Brave Search API key.

Cookies and analytics

Prompt TM's own cookies only keep you signed in and remember the project you last opened. Accepting turns on Google Analytics on the public pages, so we can count visits and see which pages get read. It never runs in the dashboard, and it does not load until you choose.

Read the privacy notice