AnswerLine Start free

, MCP · Agents · Tutorials

MCP setup for Cursor and Claude Code: ask AI engines

You can ask ChatGPT and Gemini, and search Google News, from inside Cursor or Claude Code by adding one remote MCP server: https://mcp.answerline.dev/mcp, authenticated with your API key as a bearer token. Each engine then appears as a tool the editor’s agent can call mid-session, and every call returns the same structured JSON as the REST API (answer text, sources[] and citation pills).

What the MCP server is

The Model Context Protocol (MCP) server is a hosted endpoint that exposes this API’s monitor routes as tools an MCP client can list and call. It speaks Streamable HTTP over POST, and supports protocol revisions 2024-11-05 through 2025-11-25 as well as 2026-07-28 (MCP guide).

There are two endpoint forms:

Endpoint Auth Use when
https://mcp.answerline.dev/mcp Authorization: Bearer sk_... header The client can send headers. Cursor and Claude Code both can.
https://mcp.answerline.dev/<API_KEY>/mcp Key in the path The client only accepts a URL. The URL itself is then a secret.

Prefer the header form whenever the client supports it. A URL with a key in it ends up in logs, screenshots and shell history more easily than a header value.

Claude Code setup

  1. Create an API key in the dashboard and export it in the shell you start Claude Code from: export API_KEY=sk_....
  2. Add the server:
claude mcp add --transport http answerline \
  https://mcp.answerline.dev/mcp \
  --header "Authorization: Bearer $API_KEY"
  1. Start a session and ask for something that needs a tool, for example “check my AnswerLine balance”. The agent should call credits.

Two details from the Claude Code MCP documentation (code.claude.com/docs/en/mcp, checked 2026-09-17):

A project-scoped file that is safe to commit:

{
  "mcpServers": {
    "answerline": {
      "type": "http",
      "url": "https://mcp.answerline.dev/mcp",
      "headers": { "Authorization": "Bearer ${ANSWERLINE_API_KEY}" }
    }
  }
}

Cursor setup

Cursor reads MCP servers from .cursor/mcp.json in the project root or ~/.cursor/mcp.json for all projects, supports stdio, SSE and Streamable HTTP transports, and takes remote servers as a url with optional headers (cursor.com/docs/context/mcp, checked 2026-09-17).

  1. Pick the file. Use ~/.cursor/mcp.json if you want the tools everywhere; use .cursor/mcp.json if the project needs them and your teammates should get the entry too.
  2. Add the server, referencing an environment variable for the key. Cursor resolves ${env:NAME} in url and headers (same source):
{
  "mcpServers": {
    "answerline": {
      "url": "https://mcp.answerline.dev/mcp",
      "headers": { "Authorization": "Bearer ${env:ANSWERLINE_API_KEY}" }
    }
  }
}
  1. Set ANSWERLINE_API_KEY in the environment Cursor is started from; a variable exported in a terminal opened later is not visible to an editor that is already running.
  2. Confirm the server is enabled in Cursor’s MCP settings and that the tools are listed. If the server shows an error, Cursor’s Output panel has an “MCP Logs” channel with connection and authentication errors (same source).
  3. Expect an approval prompt. Cursor asks for approval before running MCP tools by default (same source). Leave that on while you learn what the calls cost; each approved engine call spends from your balance.

Other editors and agents configured with an mcpServers JSON file that supports remote servers take the same url and headers shape; check your client’s own documentation for variable interpolation before relying on it.

Testing the key and endpoint

If the editor shows no tools, test the endpoint directly. First the REST API, which isolates key problems:

curl -s https://api.answerline.dev/v1/credits \
  -H "Authorization: Bearer $API_KEY"

A valid key returns remaining, your balance in dollars. A 401 with MISSING_API_KEY, INVALID_API_KEY_FORMAT or INVALID_OR_EXPIRED_API_KEY means the key, not the MCP setup, is the problem (authentication).

Then ask the MCP server for its tool list with a plain JSON-RPC request:

curl -s https://mcp.answerline.dev/mcp \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

The response lists the tools with their input schemas. GET and DELETE on the endpoint answer 405, so a browser visit to the URL tells you nothing; use POST.

The tools and what each call costs

Tool names follow the route: /v1/monitor/google/news becomes google_news. Each engine tool’s input schema is that endpoint’s request body, so the agent passes prompt and country to chatgpt, or query and country to google_news, plus any options the endpoint accepts.

Every engine tool call is a synchronous API call. At the Starter tier:

Tool Route Cost per tool call Common add-ons
chatgpt /v1/monitor/chatgpt $0.0006 none
gemini /v1/monitor/gemini $0.0006 none
perplexity /v1/monitor/perplexity $0.0015 none
copilot /v1/monitor/copilot $0.00274 none
grok /v1/monitor/grok $0.00218 none
aimode /v1/monitor/aimode $0.00206 none
google /v1/monitor/google $0.00103 +$0.00071 per extra page; +$0.00071 once for the AI Overview
google_news /v1/monitor/google/news $0.0002 none
credits GET /v1/credits $0 none
Worked examples:

Failed calls are charged nothing, and the charged amount of each call is in the result’s _meta as x-credits-charged (in dollars), next to x-credits-remaining. See billing for the full rules.

Slots and timeouts

Two limits shape how an editor agent should use these tools.

Parallel calls

There is no concurrency cap and no per-account request rate limit (rate limits). A synchronous call that cannot start because the engine has no capacity free at that moment comes back at once with CONCURRENT_LIMIT_EXCEEDED instead of waiting. An agent that fires many tool calls in parallel should retry those after a short wait.

Duration

A synchronous call can take up to five minutes. The server streams keep-alive comments to clients that accept text/event-stream, but the client’s own tool timeout still applies. In Claude Code, MCP_TOOL_TIMEOUT controls it; in other clients, look for a tool or request timeout setting and set it above five minutes where you can.

Keep the key out of the repository

The key spends your account’s balance, so treat every place it can land as sensitive:

  1. Never commit a config file with a literal key. Reference an environment variable (${env:NAME} in Cursor, ${VAR} in Claude Code’s .mcp.json) and commit only that.
  2. Treat the key-in-path URL as a password. https://mcp.answerline.dev/<API_KEY>/mcp should never appear in a README, an issue, a chat message or a screen recording.
  3. Use a separate key for editor work. If a laptop config leaks, you can revoke that key alone; a revoked key stops working within a minute.
  4. Git-ignore any project config that holds a literal key, such as a .cursor/mcp.json you have not yet switched to a variable.
  5. Keep approvals on. Cursor’s default approval prompt is also a spending check.

Errors the agent should handle

API errors do not break the MCP session. The server returns a normal tool result with isError: true and the API’s error body as text, and puts the request id in _meta under x-request-id. The model can read the code and act:

Code Meaning What the agent should do
CONCURRENT_LIMIT_EXCEEDED The engine had no capacity free to start the call Wait a moment, then retry once
INSUFFICIENT_CREDITS Balance too low for the call Stop and tell you; do not retry
RATE_LIMIT_EXCEEDED One address presented too many unknown API keys Check the key; retry after retry-after seconds
400 “Request validation failed” with details[] A field was wrong, for example a prompt over 2,000 characters Read details[].field and fix the arguments
EXTERNAL_SERVICE_ERROR (502) The engine request failed Report it; the call was not charged

A standing instruction for the agent: “Call engine tools sequentially. If a result has isError, read the code; stop on INSUFFICIENT_CREDITS and report the x-request-id for anything else you cannot fix.”

Example session

“Before we ship this pricing page, ask ChatGPT and Gemini ‘best invoicing tool for freelancers’ in the US, list every domain each one cites, and tell me which of our competitors appear.”

The agent makes two calls, chatgpt ($0.0006) and gemini ($0.0006), $0.0012 in total at Starter. It reads sources[].url from both results, reduces them to domains, and compares the two sets. It can also match brand names in each answer’s text to see which brands were named even where no source is cited. Don’t ask it for ChatGPT’s underlying searches: include.searchQueries is free, but searchQueries[] comes back empty on the ChatGPT answers served today (search queries).

Because the JSON lands in the editor’s context, the agent can then write a monitoring script against the field names in that JSON.

When to leave the editor

Editor tools are for questions you ask now. Recurring work, such as the same 200 prompts every Monday, belongs in async tasks and batches: they queue instead of failing when an engine is busy, and can deliver results by webhook (sync, async and webhooks). For agent architecture beyond the editor, see giving an AI agent live answer data and the LangChain tools; for tracking competitors over time, see competitor AI answer monitoring.

Full tool reference: /docs/mcp.

Questions

Which tools does the MCP server give my editor?

One tool per engine your account can use: chatgpt, perplexity, gemini, copilot, grok, aimode, google and google_news, plus credits (your balance). Each engine tool takes the same arguments as the matching /v1/monitor request body.

How much does one tool call cost?

Every engine tool call is a synchronous API call. At the Starter tier a plain chatgpt call costs $0.0006 and a plain gemini call costs $0.0006; options such as extra Google News pages and ChatGPT's include.html add to that.

Where do I put the API key for Cursor?

In the headers of the server entry in .cursor/mcp.json or ~/.cursor/mcp.json. Cursor resolves ${env:NAME} in url and headers, so you can reference an environment variable instead of pasting the key into a file.

Can I use the URL with the key in the path?

Yes, https://mcp.answerline.dev/<API_KEY>/mcp exists for clients that cannot send headers. That URL is a credential: never commit it, share it in a screenshot or paste it into a ticket.

Why do parallel tool calls come back with CONCURRENT_LIMIT_EXCEEDED?

There is no concurrency cap on any account, but a synchronous call that cannot start because the engine has no capacity free at that moment fails at once with CONCURRENT_LIMIT_EXCEEDED instead of waiting. Retry it after a short wait, or move bulk work to async tasks, which queue.

How do I add the server to Claude Code?

Run claude mcp add with the http transport, the server URL and an Authorization header that reads the key from a shell variable. The default local scope and the user scope keep the key in your private config; never use the project scope with a literal key, because that file is meant to be committed.

Try it on your own prompts

100 free requests on any engine, no card. One POST returns the answer, sources and citations as JSON.

Keep reading