Giving an AI agent live answer data with the MCP server
The hosted MCP server at https://mcp.answerline.dev/mcp turns ChatGPT, Gemini, Perplexity, Copilot, Grok, Google AI Mode, Google Search and Google News into tools. The tool’s arguments are the API request body and its result is the JSON response, so an agent works with answer text, sources[] and citation pills from today’s answers instead of what its model remembers.
Terms used below
An engine tool performs one synchronous POST /v1/monitor/<engine> call and returns its response.
Connect
The server speaks MCP over Streamable HTTP using POST and supports protocol revisions 2024-11-05 through 2025-11-25 and 2026-07-28 (MCP guide). Clients that accept text/event-stream get tool calls streamed with keep-alive comments, so long calls survive intermediaries that close idle connections. GET and DELETE answer 405, and requests from web origins not on the server’s allow list are refused with 403.
Claude Code
claude mcp add --transport http answerline https://mcp.answerline.dev/mcp \
--header "Authorization: Bearer $API_KEY"
Clients configured with an mcpServers JSON file
Clients that read an mcpServers JSON file and support remote servers take this shape:
{
"mcpServers": {
"answerline": {
"url": "https://mcp.answerline.dev/mcp",
"headers": { "Authorization": "Bearer sk_..." }
}
}
}
Do not commit that file with a literal key. Where the client supports variable interpolation in headers, reference an environment variable; the Cursor and Claude Code setup post shows the syntax for both.
Clients that only take a URL
Use https://mcp.answerline.dev/<API_KEY>/mcp. The URL is now a credential: keep it out of logs, tickets and shared configs, and give that client its own key so you can revoke it alone.
Tools, arguments and results
Tools
There is one tool per engine, named after its route, plus credits:
| Tool | Calls | Price per tool call (Starter) |
|---|---|---|
chatgpt |
POST /v1/monitor/chatgpt |
$0.0006 |
gemini |
POST /v1/monitor/gemini |
$0.0006 |
perplexity |
POST /v1/monitor/perplexity |
$0.0015 |
copilot |
POST /v1/monitor/copilot |
$0.00274 |
grok |
POST /v1/monitor/grok |
$0.00218 |
aimode |
POST /v1/monitor/aimode |
$0.00206 |
google |
POST /v1/monitor/google |
$0.00103 (one page) |
google_news |
POST /v1/monitor/google/news |
$0.0002 (one page) |
credits |
GET /v1/credits |
free |
Add-ons raise a call’s price; ChatGPT’s include flags and extra Google News pages are free. Google Search adds $0.00071 per extra page and $0.00071 for the AI Overview (billing).
Arguments
A tool’s input schema is the endpoint’s request schema. For chatgpt that is prompt and country (one of 213 countries), optionally include.shopping and the other flags; ChatGPT answers at country level, and a call that sends state is refused with a 400. For google it is query with country (or gl), plus pages, include.aioverview, location or uule, hl and device. For google_news it is query with country (or gl), plus hl and pages. The engine pages list every field: ChatGPT, Gemini, Perplexity, Copilot, Grok, AI Mode, Google Search, Google News.
Results
A tool result is the API’s response body as text, for example {"success": true, "result": {...}}. Fields differ by engine: entities[] exists only on ChatGPT and lists the brands and products the answer names. searchQueries[] carries Grok’s web and X searches; on ChatGPT it comes back empty on the answers served today. Google Search returns organicResults[] and Google News newsResults[] rather than an answer. Optional arrays are omitted when empty, so a missing shoppingCards is not an error.
Response headers are copied into the result’s _meta as numbers: x-credits-charged and x-credits-remaining (dollars), x-concurrent-limit, x-concurrent-current, x-concurrent-remaining, x-ratelimit-limit, x-ratelimit-remaining, x-latency-ms and, when present, retry-after. The request id is in _meta as x-request-id; quote it when reporting a problem.
Errors
API errors are not protocol errors. They come back as results marked isError: true with the API’s error body, so the model can read code and decide:
| Code | Agent action |
|---|---|
RATE_LIMIT_EXCEEDED (429) |
Check the API key; retry after retry-after seconds |
INSUFFICIENT_CREDITS (403) |
Stop the run and report |
400 “Request validation failed” |
Read details[].field and correct the arguments |
EXTERNAL_SERVICE_ERROR (502) or 500 |
Report with x-request-id; the call was not charged |
The MCP server retries a 429 up to twice with short waits before handing it to the model. A synchronous 500 or 502 is final, because the API has already retried, and it is not charged.
Prompts that work
Give the agent a concrete comparison and a stopping rule:
- “Ask ChatGPT and Gemini ‘iPhone 17 or Galaxy S26?’ in the US. List the domains each answer cites and those cited by only one engine.” One
chatgptand onegeminicall ($0.0006 + $0.0006 = $0.0012 at the Starter tier) and a set difference oversources[].url. - “Run these five buyer questions through ChatGPT with shopping included, and tell me which products it recommends and from which merchants.” Five calls at $0.0006 each (shopping is free) = $0.003.
shoppingCardscomes back empty today; the products, with price, link and merchant offers, come ininlineProducts. See ChatGPT shopping cards. - “Search Google News for our brand, then ask Gemini what it says about us and whether it cites any of those articles.” One
google_newscall ($0.0002) and onegeminicall ($0.0006) = $0.0008. Useful for brand crisis monitoring. - “Compare which brands ChatGPT names for ‘best CRM for startups’ with the sources it cites.” One call; brand names found in
textagainstsources[]separates mentions from citations.
Budget guards
An agent loop has no natural end, so give it one.
Check the balance before each step
The credits tool calls GET /v1/credits and returns remaining, the balance in dollars (perCycle and cycleResetsAt are always null). A system-prompt rule:
Before each engine call, call
credits. Ifremainingis below 0.50, stop and report what you finished. Never start a step whose worst-case cost exceedsremainingminus 0.50.
credits costs nothing but adds a call per step, so tight loops should use the next approach.
Read the meter on every result
Every engine result carries x-credits-remaining and x-credits-charged in _meta. Tell the agent to keep a running total and stop when x-credits-remaining crosses the threshold. No extra calls.
Enforce it in the host
A prompt rule can be ignored; a host-side check cannot. If you run your own agent loop, send MCP calls through a guard that refuses them once a budget is spent. This Python sketch sends plain JSON-RPC tools/call requests with requests:
import itertools
import json
import os
import requests
MCP_URL = "https://mcp.answerline.dev/mcp"
HEADERS = {
"Authorization": f"Bearer {os.environ['API_KEY']}",
"Content-Type": "application/json",
"Accept": "application/json",
}
ids = itertools.count(1)
class BudgetExceeded(Exception):
pass
class Guard:
def __init__(self, budget: float, floor: float = 0.50):
self.budget, self.floor, self.spent, self.remaining = budget, floor, 0, None
def call(self, name: str, arguments: dict) -> dict:
if self.spent >= self.budget:
raise BudgetExceeded(f"spent {self.spent} of {self.budget}")
if self.remaining is not None and self.remaining < self.floor:
raise BudgetExceeded(f"balance {self.remaining} is below {self.floor}")
message = {"jsonrpc": "2.0", "id": next(ids), "method": "tools/call",
"params": {"name": name, "arguments": arguments}}
reply = requests.post(MCP_URL, headers=HEADERS, json=message, timeout=360).json()
result = reply["result"]
meta = result.get("_meta", {})
self.spent += meta.get("x-credits-charged", 0)
self.remaining = meta.get("x-credits-remaining", self.remaining)
body = json.loads(result["content"][0]["text"]) if not result.get("isError") else None
return {"error": result.get("isError", False), "body": body, "meta": meta,
"text": result["content"][0]["text"]}
guard = Guard(budget=5.00)
answer = guard.call("chatgpt", {"prompt": "best CRM for startups", "country": "US"})
if not answer["error"]:
urls = [s["url"] for s in answer["body"]["result"].get("sources", [])]
The 360-second timeout sits above the five-minute limit of a synchronous call. A failed call has no x-credits-charged, so it adds 0. The balance check runs before the next call, so a result that crossed the floor is still returned.
Rate limits
Each engine tool call holds its connection for its whole run, up to five minutes. There is no concurrency cap and no per-account request rate limit (rate limits).
- Parallel tool calls are fine. A runaway loop is limited only by the balance, so keep the budget guard above.
- On
RATE_LIMIT_EXCEEDED, check the API key: it means one address presented too many unknown keys. Retry afterretry-afterseconds.
When to switch to async batches
MCP tools suit questions decided in the moment. Move work to async tasks and batches when any of these hold:
| Signal | Why async is better |
|---|---|
| Hundreds of prompts at once | Tasks queue (about 100,000 typical tasks pending) and the agent does not wait on each |
| Results feed a database, not a conversation | Webhooks deliver finished tasks; no agent context spent |
| Calls take minutes and the client times out | A task has five minutes from its first start and the result is fetched later |
Worked example: 300 ChatGPT prompts every Monday cost 300 × $0.0006 = $0.18 per run at the Starter tier. One POST /v1/async/task/batch takes 1 to 500 tasks.
A common split: a scheduled batch collects the data, and the agent answers questions about it, calling an engine tool only for follow-ups the batch did not cover. The rank tracking pipeline post and sync, async and webhooks cover the batch side; cost planning covers sizing.
Other guardrails
- Raise the client’s tool timeout above five minutes where it is configurable. The server streams keep-alives, but a client-side timeout still ends the call.
- Pin the market in the prompt. An agent that forgets
countrygets a validation error; one that picks a different country from yesterday gets a different answer. - Expect variation between runs. The same prompt can cite different sources an hour later (answer volatility), so ask the agent to report what it saw rather than conclude from one call.
- If your agent is code rather than a chat client, the LangChain tools add
create_async_taskandget_task_status, which the MCP server does not expose.
Tool reference and endpoint details: /docs/mcp.
Questions
What is the MCP server endpoint?
https://mcp.answerline.dev/mcp with an Authorization: Bearer header carrying your API key. Clients that cannot send headers can use https://mcp.answerline.dev/<API_KEY>/mcp, which must then be treated as a secret.
Which MCP protocol revisions are supported?
Revisions 2024-11-05 through 2025-11-25, and 2026-07-28, over Streamable HTTP with POST. GET and DELETE on the endpoint answer 405.
How can an agent stay within a budget?
Give it the credits tool and a rule: call credits before each step and stop when the balance falls below a dollar threshold. Each engine result also carries x-credits-charged and x-credits-remaining in _meta, in dollars, so the agent can track spend without extra calls.
What does RATE_LIMIT_EXCEEDED mean for an agent?
One address presented too many unknown API keys. Check the key, then retry after the Retry-After seconds. There is no per-account request rate limit and no concurrency cap, so parallel tool calls are fine.
When should an agent workload move from MCP tools to async batches?
When the work is recurring or large, such as a fixed prompt set every week. Async tasks queue with no count limit, about 100,000 typical tasks per account, and can report by webhook.