MCP Search API Integration Guide for AI Agents
Four tools, one endpoint, no SDK. How to give Claude, Cursor or any other MCP client live web search and page reading in about five minutes.
What MCP buys you
The Model Context Protocol is how an AI client discovers and calls tools. The client asks the server what it can do, the server describes each tool with a JSON schema, and the model decides which to call and with which arguments. You write the tool; the client wires it up.
For a search API this is a better fit than it first looks. The awkward parts of an agent's search loop - which query should I try?, how many results are enough?, should I read the whole page? - become schema fields with descriptions the model reads. You do not prompt for them; the model infers them from the tool definitions.
The endpoint
AgentSearch speaks MCP over plain HTTP, at one POST endpoint:
POST https://agentsearch.tech/v1/mcp
Authorization: Bearer $AGENTSEARCH_API_KEY
Content-Type: application/json
There is no separate MCP deployment and no second key: the MCP endpoint authenticates with the same API key as the REST API, and it draws from the same allowances. A client configured for MCP can also call the REST API, and both draw on one meter.
The four tools
Calling tools/list returns four tools. Two of them are the product; two are conveniences.
| Tool | What it does | Meter |
|---|---|---|
agentsearch_search | Search the web and return scored, structured results | Search |
agentsearch_fetch | Read one page and return its text | Fetch |
agentsearch_classify_intent | Label a query: news, tech, finance, academic or general | - |
agentsearch_list_sources | Report the source the search gathers from, and whether it is configured | - |
The split between search and fetch is the important design decision, and the tool descriptions say so explicitly: an agent that searches and then reads three pages uses three searches and three fetches, and can see that in its own usage. The descriptions tell the model that reading a page does not consume the search allowance, so it does not have to guess whether to keep searching or start reading.
The tool schemas
The search tool takes a query, a limit and two optional fields:
{
"name": "agentsearch_search",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string",
"maxLength": 128,
"description": "The search query in natural language, e.g. 'latest AI funding news' or 'Python async best practices'. It accepts the search syntax site:, -site:, -, -\"...\", \"...\", lang:, after:, before: - e.g. 'agentsearch site:github.com after:2025'."
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 50,
"default": 10,
"description": "Maximum number of results to return"
},
"need_content": {
"type": "boolean",
"default": false,
"description": "Return the full text of every page instead of its summary. The summary is the cheaper, denser read."
},
"ori_question": {
"type": "string",
"maxLength": 128,
"description": "The user's original question, when it is longer than the query."
},
"localization": {
"type": "string",
"description": "IP address whose region the results should be localised for."
}
},
"required": ["query"]
}
}
The fetch tool is smaller - a URL and an optional length cap:
{
"name": "agentsearch_fetch",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "The address of the page to read, e.g. 'https://example.com/post'"
},
"max_chars": {
"type": "integer",
"minimum": 200,
"maximum": 100000,
"default": 20000,
"description": "How much of the text to return"
}
},
"required": ["url"]
}
}
Configuring a client
Any MCP client that speaks HTTP transport can be pointed at the endpoint. The configuration is the endpoint URL, the transport, and your key. For clients that read a JSON config file:
{
"mcpServers": {
"agentsearch": {
"url": "https://agentsearch.tech/v1/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Some clients ask for a command instead of a URL, for a server they start themselves. For those, the equivalent is a small stdio bridge that forwards to the HTTP endpoint - there is nothing AgentSearch-specific about it, it is three lines of standard MCP proxying.
Driving it by hand
MCP is JSON-RPC 2.0 over HTTP, so you can drive it with curl and see exactly what the model sees:
curl -X POST "https://agentsearch.tech/v1/mcp" \
-H "Authorization: Bearer $AGENTSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "my-client", "version": "1.0"}
}}'
Then list the tools, then call one:
curl -X POST "https://agentsearch.tech/v1/mcp" \
-H "Authorization: Bearer $AGENTSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {
"name": "agentsearch_search",
"arguments": {"query": "agentsearch site:github.com", "limit": 5}
}}'
The tool result carries the same payload the REST endpoint returns, plus the rendered Markdown that an agent can paste straight into a prompt.
What it costs, and what to watch
- One search, one fetch, one metered call each. They are separate allowances: 100 searches and 20 fetches per month on Free, 3,000 and 1,000 on Pro, 30,000 and 10,000 on Team.
- Overages are served and priced at $2.5 per 1000 on each meter, not refused.
- The rate limit is the plan's - 2, 20 or 50 requests per second. An agent that loops should hit 429 and back off.
- A tool error is a tool error. A failed call comes back with
isError: trueand a message, so the model can recover instead of the whole turn dying.
The last point is the one that separates a tool that works in a demo from a tool that works in production: an agent that cannot read an error will retry it, and an agent that can read an error will change its query.
Try it against your own agent
The Free plan includes 100 searches and 20 fetches per month, no card. Point a client at it and see what your agent does with a real search.
Get a free API keyRelated: adding search to an AI agent over plain HTTP, and putting search in production.