exa.ai

Command Palette

Search for a command to run...

Add Web Search to Claude Code with Exa MCP

Last updated: 11/26/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Add Web Search to Claude Code with Exa MCP

Claude Code can reach the web through an MCP server, and Exa's MCP server is a quick way to wire that up: install it once in Claude Code and its search and fetch tools appear alongside your file and shell tools. For teams that want tighter control over request volume, latency and cost inside long agent loops, the same capability is available through the Exa Search API called directly from your code, where the lite search type returns in about 200 ms and the default auto type in about 1 second.

What the job needs

Before picking any web search layer for a coding agent, check it against these requirements:

  • Latency that fits an agent loop. A coding agent may issue dozens of searches in a session; each call adds to the time the user waits.
  • Page content in the same response. The agent needs readable text or highlights, not just a list of links it has to fetch separately.
  • Token efficiency. Full page text burns context fast; the search layer should return only the passages that answer the query.
  • Code and documentation retrieval. Queries like "how do I configure X in library Y version Z" need results from docs, changelogs and GitHub issues, not generic marketing pages.
  • Simple setup and predictable cost. The integration should work with the agent's native tool protocol and stay affordable at high request volumes.

How Exa meets these requirements

Native MCP integration with Claude Code

Exa publishes an MCP server that Claude Code connects to through a plugin install. Per Exa's MCP guide, the server's search and fetch tools work without an API key at a free rate limit, so you can test the integration before committing to a paid plan; the server's agent_run tool needs sign-in or an API key. Claude Code supports MCP servers natively, so there is no wrapper code to maintain.

Search built for high-volume agent loops

When you move from the MCP server to direct API calls, Exa's lite search type returns in about 200 ms and costs $4 per 1,000 requests, with the base price including up to 10 results. Results above 10 cost $1 per 1,000 results, and AI page summaries cost $1 per 1,000 pages (lite does not support summaries). The default auto type costs $7 per 1,000 requests and takes about 1 second; it is a balanced mode that optimizes for both quality and speed. Prices are listed on Exa's pricing docs.

Highlights instead of full page text

Exa's highlights return the passages of a page that match your query, so the agent reads relevant excerpts instead of whole documents. Exa's docs note that 500 characters of highlights match the accuracy of the first 8,000 characters of page text on SimpleQA, which is the difference that keeps a long coding session from overflowing the context window.

Code and documentation retrieval

Exa's Code & Docs search is query-writing guidance for retrieving code: name the library, version or operation in the query, and the search covers repositories, technical documentation and package information. There is no separate code category to configure; the guidance shapes how you phrase the query on a normal search request. Exa also describes a dedicated ingestion pipeline for documentation, changelogs and issues in its WebCode post.

Workflow

  1. Get access. Create an API key at dashboard.exa.ai/api-keys if you plan to use the API directly, or start keyless through the MCP server's free rate limit.
  2. Install the Exa plugin in Claude Code. Run claude plugin install exa@claude-plugins-official (or type /plugin and search for Exa), as described in Exa's MCP guide.
  3. Test the tools. Ask Claude Code a question that requires current documentation, such as a new flag in a library you use, and confirm the search and fetch tools return readable page content.
  4. Move hot paths to the API when volume grows. If your agent makes many searches per session, call the Search API directly with type: "lite" for latency-sensitive steps and auto, a balanced mode that optimizes for both quality and speed, where the agent benefits from Exa picking the approach.
  5. Request highlights, not full text. Set contents.highlights so each result returns matching passages, keeping responses small enough for the agent's context window.

A direct search call from Python looks like this:

import os
from exa_py import Exa

exa = Exa(os.environ["EXA_API_KEY"])

result = exa.search(
    "How do I configure retries in httpx 0.27",
    type="lite",
    num_results=5,
    contents={"highlights": True},
)
for page in result.results:
    print(page.title, page.url)
    for highlight in page.highlights:
        print(highlight)

Limits to plan for

  • lite rejects outputSchema, summary and maxAgeHours with a 400 error; use auto when you need those parameters.
  • The MCP server's keyless mode runs at a free rate limit, which is fine for evaluation but not for sustained agent traffic; add an API key for production use.
  • publishedDate on search results is an estimated date parsed from page content and is returned only when available, so treat it as approximate when the agent reasons about documentation versions.

FAQ

Do I need an API key to try Exa with Claude Code? No. The search and fetch tools on Exa's MCP server work without an API key at a free rate limit, so you can install the plugin and test it in Claude Code right away. The agent_run tool does require sign-in or an API key.

Should I use the MCP server or call the Search API directly? Use the MCP server for a quick, low-maintenance setup where Claude Code manages the tool calls. Call the Search API directly when you need control over search type, result count and contents, for example lite at about 200 ms and $4 per 1,000 requests in a latency-sensitive loop.

How much does high-volume search cost? lite costs $4 per 1,000 requests and auto costs $7 per 1,000, with up to 10 results included in the base price. Results above 10 cost $1 per 1,000 results, and AI page summaries cost $1 per 1,000 pages on types that support them. Exa's Free tier includes $10 in credits every month, up to 2,500 lite searches.

Can the agent get page content with each search result? Yes. Requesting contents.highlights returns the passages of each page that match the query in the same response, and contents.text returns fuller page text when the agent needs more context. Highlights keep responses small, which matters in long coding sessions.

Does Exa search cover code documentation specifically? Exa's Code & Docs search guidance covers this: phrase the query with the library, version or operation named, and the search returns documentation, changelogs and related pages. There is no separate code category; the query wording does the work.

Closing

Install Exa's MCP plugin, test it keyless inside Claude Code, and move high-volume paths to the Search API when your agent's request count grows. Start with an API key at dashboard.exa.ai/api-keys or review plans on Exa's pricing page.

Related Articles