MCP Integration for AI Agents

AgentSearch speaks the Model Context Protocol over plain HTTP. One endpoint, four tools, the same key as the REST API.

Why MCP suits a search tool

MCP is how an AI client discovers tools: the client asks the server what it can do, the server returns a JSON schema for each tool, and the model decides which to call and with which arguments.

For search, that moves the decisions that usually live in a prompt into the schema, where the model reads them properly. "How many results should I ask for?", "should I read the whole page or the summary?" - these become fields with descriptions, not instructions you have to repeat and hope the model follows.

The endpoint

POST https://agentsearch.tech/v1/mcp Authorization: Bearer YOUR_API_KEY Content-Type: application/json

There is no separate MCP deployment, no separate key and no package to install. The MCP endpoint authenticates with the same API key as the REST API and draws on the same allowances - an agent configured for MCP can also call /v1/search directly, and both draw on one meter.

The four tools

Tool What it does Meter
agentsearch_searchSearch the web and return scored, structured resultsSearch
agentsearch_fetchRead one page and return its textFetch
agentsearch_classify_intentLabel a query: news, tech, finance, academic or general-
agentsearch_list_sourcesReport the source the search gathers from, and whether it is configured-

The two metered tools are the product. The other two are conveniences that cost nothing - one labels a query, the other reports whether the search backend is configured and working.

Configuring a client

Any MCP client that speaks HTTP transport takes three things: the URL, the transport and your key. For clients that read a JSON configuration file:

{ "mcpServers": { "agentsearch": { "url": "https://agentsearch.tech/v1/mcp", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } }

Some clients insist on starting the server themselves with a command, and want a stdio process rather than a URL. For those, the bridge is a short standard MCP proxy that forwards stdio to the HTTP endpoint - nothing AgentSearch-specific about it. There is no npm package to install, because there is nothing to install: the server is the endpoint.

The handshake

MCP is JSON-RPC 2.0 over HTTP, so you can watch the whole thing with curl:

# 1. initialize 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"} }}' # 2. list the tools 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/list"}' # 3. 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": 3, "method": "tools/call", "params": { "name": "agentsearch_search", "arguments": {"query": "agentsearch site:github.com", "limit": 5} }}'

A tool result carries the same payload the REST endpoint returns, plus the rendered Markdown an agent can paste straight into a prompt.

What the model sees

The search tool's schema is where the good behaviour is encoded:

"query": { "type": "string", "maxLength": 128, "description": "The search query in natural language, e.g. 'latest AI funding news'. It accepts the search syntax site:, -site:, -, -\"...\", \"...\", lang:, after:, before:." }, "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." }

Two descriptions do the work. The first tells the model it can use operators, which produces far better first queries - and therefore far fewer re-searches. The second tells it that the summary is the dense read, which keeps it from fetching five pages when the summaries would have answered the question.

Errors your agent can recover from

A tool call that fails comes back with isError: true and a message rather than breaking the turn:

This is the difference between a tool that demos well and one that survives production. An agent that cannot read an error will retry it forever; an agent that can read an error will change its query.

Metering

Searches and page reads are separate allowances: 100 and 20 a month on Free, 3,000 and 1,000 on Pro, 30,000 and 10,000 on Team. A call beyond the allowance is priced at $2.5 per 1,000 on each meter and still served, so an agent mid-answer is never cut off by a limit. The agentsearch_usage view - and the REST /v1/usage/ endpoint - report both meters, what is left and when each resets.

Point a client at it

The Free plan includes 100 searches and 20 page reads per month, no card.

Get a free API key

Related: the full MCP integration guide, and the API reference.

Point your client at it

One endpoint, one API key, 100 searches a month free.

Get API Key Free