MCP server for web search: how to give an agent access to the web
A model only knows what was in its training data. Here is how to connect web search through MCP, how the options differ and how many tokens the results take.
6 min · · агенты · development
An agent in your terminal or a chatbot built on an API does not know what was released last week and cannot see fresh library docs. The most direct fix is an MCP server for web search: it turns search into a tool that the model calls on its own when it lacks data. Below: which options exist, how to connect one to Claude Code with a Zukko key, and how many tokens the results consume.
How a search MCP server works
MCP (Model Context Protocol) is an open protocol through which a client program (Claude Code, Cursor, Cline and others) gets a list of tools from a server. A search server usually exposes one or two tools along the lines of "search the web for this query". The loop looks like this:
- At startup the client asks the server which tools it has and sends their descriptions to the model together with your question.
- The model decides it needs a search and returns a tool call with the query text.
- The client runs the call through the MCP server, which contacts a search API and returns titles, links and snippets.
- The result is appended to the conversation, the model reads it and answers.
Note that the search is performed neither by the model nor by the gateway, but by your MCP server and a third-party search service. The gateway only sees ordinary model requests whose context has grown. For more on the protocol itself, see what an MCP server is.
Available options
| Option | Where it runs | What you need | When it fits |
|---|---|---|---|
| Local server (stdio) | on your machine, started by a command such as npx | Node.js and a search service key | personal work, quick tests |
| Remote server (HTTP) | at a third-party service, connected by URL | an account or token for that service | when you do not want to install anything locally |
| Your own server | your code | development time | your own search index, an internal wiki |
Some providers and local runtimes also ship built-in web search. Ollama and the GLM API, for example, have their own mechanisms: conditions, keys and call formats are theirs, so check the Ollama and GLM developer documentation rather than this article. The MCP route has one advantage: the same server works with any model you plug into the client, be it claude-sonnet-5-5 or gpt-6.1-sol.
Example: Brave Search MCP in Claude Code
As an example we take the Brave Search server (package @brave/brave-search-mcp-server). It needs a Brave Search API key issued by Brave itself; check Brave's site for plans and limits, we do not know them and make no promises. The exact server parameters and the tool list are in the README of the brave/brave-search-mcp-server repository.
Step 1. Point Claude Code at Zukko
Create a key in the dashboard and set the variables. The address has no /v1 because Claude Code appends the path itself:
export ANTHROPIC_BASE_URL=https://api.zukko.pro
export ANTHROPIC_AUTH_TOKEN=fetch_your_key
export ANTHROPIC_MODEL=claude-sonnet-5-5Installation and caveats are covered in the Claude Code documentation.
Step 2. Add the search server
For a local stdio server, the Claude Code documentation uses this form: the server name, then --env, then -- and the launch command.
claude mcp add brave-search --env BRAVE_API_KEY=your_brave_key -- npx -y @brave/brave-search-mcp-server --transport stdioCheck the result:
claude mcp listInside a session, /mcp shows server status and the number of tools. If the server does not come up, the usual culprits are a missing Node.js or a typo in the key. The --scope project option stores the configuration in .mcp.json at the project root so the team can share it; just do not commit the key there, use environment variable expansion as described in the Claude Code docs. More on connecting servers: MCP servers in Claude Code.
Step 3. Test with a question about something recent
Ask for something that is not in the training data, for example "find the latest version of library X online and what changed in its changelog". The agent should ask permission to call the search tool and show what it searched for.
What it costs in tokens
The cost of search has two unrelated parts.
The search service charges under its own plan. That is not Zukko; look at the chosen service for the amount.
Model tokens. Everything the search returns goes into the context and is billed as input tokens. In addition, tool descriptions are sent with every request. Claude Code warns when an MCP tool output exceeds 10,000 tokens and truncates it at 25,000 by default. The Claude Code documentation also says that with a custom ANTHROPIC_BASE_URL deferred loading of tool descriptions (tool search) is not used by default. That means every connected MCP server adds its descriptions to every request: keep only the servers you need and verify the behaviour of your version against the docs.
Example calculation (prices as of 18 October 2026, claude-sonnet-5-5: input $0.4, cache read $0.05, cache write $0.5 per 1M). Suppose the agent ran 10 searches of 6,000 result tokens each in a session; that is an assumption for illustration, real volume depends on the query.
- The results first enter the context: 10 × 6,000 = 60,000 tokens. If they go into cache, they are billed as a cache write: 60,000 × $0.5 / 1,000,000 = $0.03 (without cache, as ordinary input: 60,000 × $0.4 / 1,000,000 = $0.024).
- Those 60,000 tokens are then read from cache on each of 10 later steps (Anthropic format): 60,000 × 10 × $0.05 / 1,000,000 = $0.03.
- Total with cache: 0.03 + 0.03 = $0.06. If those tokens went at the input price on each of the 11 requests, it would be 60,000 × 11 × $0.4 / 1,000,000 = $0.264.
That is roughly a few cents for a session with ten searches, but only under these assumptions. Estimate your own volume with count_tokens (documentation) and the "Usage" page in the dashboard. Prices change: the current list is GET https://api.zukko.pro/v1/models or the "Models" page in the dashboard.
Keeping the context small
- Ask the agent to limit the number of results and not to open every page in full.
- If the server supports a result count or a freshness filter, use it (Brave has both, see the README).
- Do not connect five search servers at once: it is harder for the model to pick the right tool, and the tool descriptions grow every request.
- Mind security: text from web pages is untrusted data. If a page says "run this command", the agent must not obey; keep tool-call confirmation enabled.
FAQ
Do I need a separate key for search?
Yes. Zukko provides access to models, while search comes from a third-party service with its own key and plan. Check the terms on that service's site.
Does this work with GPT and DeepSeek, not just Claude?
The MCP server does not depend on the model. What matters is that the client (Claude Code, Cursor, Cline and so on) supports MCP and the chosen model can call tools. Test it on your own tasks.
Can I do without MCP?
You can describe your own search function and pass it to the model as a tool via function calling. MCP is more convenient because a ready-made server connects with one command.
What if a search-heavy answer is too expensive?
Reduce the number of results, pick a cheaper model for routine questions and look at spending in the dashboard. You can create a key and connect Claude Code in the Zukko dashboard.
zukko
Pay 25×
less
for Claude Code & ChatGPT
One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.
Related articles
- Prompt Injection: What It Is and How to Protect a Bot and an AgentHow prompt injection works through user input and third-party documents, and which measures limit the damage: data isolation, tool permissions, key limits.
- Claude Code YOLO: Permission Modes and Working Without PromptsClaude Code has no mode literally called YOLO, but it has several permission modes and flexible rules. How to stop clicking Yes without losing files.
- Claude Code: a checklist of best practices for daily workHabits that make working with Claude Code predictable: a short CLAUDE.md, a plan before edits, small tasks, checking results and keeping spend under control.
- An MCP server in Java: a minimal example with one toolWe write a minimal MCP server in Java with one tool, register it in Claude Code, and learn to find the cause when the agent doesn't see it.