Giving an AI agent live answer data with the MCP server
A model answers from its training data. Through the MCP server, an agent can instead see what AI assistants show people today, as structured JSON it can reason over. This post covers connecting, the tools the agent gets, prompts that use them well, and the guardrails worth setting.
Connect
The server speaks MCP over Streamable HTTP. Take the endpoint from the MCP guide and send your API key as a bearer token, for example in Claude Code:
claude mcp add --transport http answers "$MCP_URL" --header "Authorization: Bearer $API_KEY"
$MCP_URL is that endpoint, ending in /mcp. Clients that cannot set headers can use the form with the key in the path (/<API_KEY>/mcp); treat that URL as a secret.
What the agent gets
One tool per engine your account can use, named after its endpoint (chatgpt, google_news, …), plus credits. A tool’s input schema is the API’s request schema, so its arguments are the request body: prompt and country for ChatGPT, plus options such as state or include.searchQueries. The result is the API response, with credit and rate-limit headers under _meta.
Errors come back as results marked isError with the API’s error body, so the agent can read code: CONCURRENT_LIMIT_EXCEEDED means wait for a running call, INSUFFICIENT_CREDITS means stop.
Prompts that use it well
Agents do best with a concrete comparison to run:
- “Ask ChatGPT ‘best CRM for small agencies’ in the US and in Germany. List the domains each answer cites and those cited in only one market.” Two calls and a set difference over
sources[].url. - “Run these five buyer questions through ChatGPT with search queries included, and tell me which of the searches our blog could answer.” The
searchQueriesfan-out, when the answer includes it, becomes a content brief. - “Check credits before each step and stop if fewer than 200 remain.” Give any looping agent a budget rule.
Guardrails
- Each tool call is a synchronous API call. It costs the engine’s price plus the synchronous surcharge and holds a concurrency slot while it runs, so an agent firing more parallel calls than your plan has slots gets
429s. - Calls can take minutes. A synchronous request may run up to five minutes; raise the client’s tool timeout where you can. Tool calls are streamed with keep-alives to clients that accept event streams.
- Recurring work belongs in batches. “Run these 300 prompts every Monday” is a job for async batches, which skip the surcharge and queue instead of failing.