# Use SimilarIQ with Claude Agent SDK

> To use SimilarIQ from the Claude Agent SDK, add its hosted MCP server to the mcpServers option with type http, the URL https://similariq.ai/mcp and your API key in a header, then allow the tools you want. The agent gets ten tools; a look-alike search costs one credit, $0.25, for up to 100 ranked companies.

Source: https://similariq.ai/integrations/claude-agent-sdk · Updated 2026-11-25

## What the Claude Agent SDK is

The Claude Agent SDK is Anthropic's framework for building agents in TypeScript or Python. You call `query()` with a prompt and an options object, and the SDK runs the agent loop and streams messages back to your code. Its documentation refers throughout to Claude Code as the runtime underneath, which is why the same MCP configuration format appears in both.

The SDK's MCP page lists three kinds of server: local processes over stdio, remote servers over HTTP or SSE, and in-process servers you define in code. SimilarIQ belongs to the second kind. Its [MCP server](https://similariq.ai/features/mcp-server) is hosted at `https://similariq.ai/mcp`, speaks streamable HTTP, and is stateless, so there is no local process, package or container to manage.

There is no SimilarIQ plugin for the SDK and none is needed. The whole integration is one entry in a configuration object plus a permission rule.

## Why connect it

Agents are good at planning and writing. They are unreliable as a source of company lists, because a list recalled from training is short and unscored. A look-alike tool gives the agent something to fetch instead of something to guess.

SimilarIQ takes a domain and returns up to 100 companies, each with `rank`, `company`, `domain`, `matchScore`, `type`, `confidence` and `likelyCompetitor`. Results come from a fresh research pass that is cross-validated across multiple independent intelligence sources, and the confidence score reports how much those sources agree.

For an SDK agent this means one tool call replaces a long browsing session. The agent can then spend its turns on the work around the list: filtering by relationship type, comparing against a file of existing customers, or drafting notes per account. Everything it searches is saved to your account history, where teammates can open it in the web app at no cost.

## Setup walkthrough

Start with a key. Create one in the SimilarIQ app; it begins with `sk-live-` and is shown once. Export it as an environment variable such as `SIMILARIQ_API_KEY`.

In TypeScript, the documented import is `query` from `@anthropic-ai/claude-agent-sdk`. In Python it is `query` and `ClaudeAgentOptions` from `claude_agent_sdk`. Add a server entry named `similariq` under `mcpServers` in TypeScript, or `mcp_servers` in Python, with three fields: `type` set to `"http"`, `url` set to `https://similariq.ai/mcp`, and `headers` carrying the key. SimilarIQ accepts either `X-API-Key` or `Authorization` with a `Bearer` prefix. The SDK documentation notes that `"http"` is the value to use in code for streamable HTTP.

Then grant permission. The SDK's documentation is explicit that MCP tools need it: without permission the agent can see the tools but cannot call them. Tools are named `mcp__` plus the server key plus the tool name, so the search tool is `mcp__similariq__find_similar_companies`. Add `mcp__similariq__*` to `allowedTools` (`allowed_tools` in Python) to allow all ten, or list individual names.

You can keep the same entry in a `.mcp.json` file at the project root instead. The documented file format supports `${VAR}` expansion, so the header value can be `${SIMILARIQ_API_KEY}` and the key stays out of version control.

## A note on OAuth

SimilarIQ's MCP server supports OAuth 2.1 as well as key headers, and chat assistants use the OAuth route. The Agent SDK is different. Its documentation states that the SDK does not open a browser or run an interactive OAuth flow, and that a server needing sign-in with no token available is reported as `needs-auth`.

For SDK agents, use the API key header. It is the documented path for remote servers and works in headless environments such as CI and scheduled jobs. If you have a reason to use OAuth tokens, the documentation's guidance is to complete the flow in your own application and pass the resulting access token in `headers`.

Interactive Claude Code is a separate case with its own one-line command, covered on the [Claude Code page](https://similariq.ai/claude-code).

## Example prompts and tasks

These are prompts an SDK agent can complete once the server is attached.

- "Find look-alikes for stripe.com and write the Direct results with a match score above 70 to a CSV file."
- "Check the SimilarIQ balance and stop if fewer than ten credits remain."
- "Look at recent searches. If notion.so is already there, reuse those results instead of searching again."
- "Start a bulk search for every domain in domains.txt, poll until it finishes, and summarize the job."
- "Save the top ten likely competitors from the last search to the watchlist."
- "Create a share link for that search and put it at the top of the report."
- "List My Companies and tell me which domains also appear in our customer file."

## Controlling spend

Two tools cost credits: `find_similar_companies` at one credit and `start_bulk_search` at one credit per domain. The other eight are free. Because permissions are per tool, the allow list doubles as a budget control. Allow only the eight free tools and you have an agent that can read history, saved companies and the balance but cannot spend. Add `mcp__similariq__find_similar_companies` when you are ready for it to search.

The arithmetic for planning: 20 searches cost $5.00, 200 cost $50, and a 500-domain bulk job costs $125. Tell the agent the price in its prompt. An instruction such as "each search costs $0.25, check history first" changes how often it reaches for the tool.

Account-level limits sit behind the code. With auto-refill off, the balance is the ceiling. With it on, the monthly cap is a hard limit on what your card can be charged. Failed searches are refunded automatically. The [spend controls](https://similariq.ai/features/spend-controls) page has the details, and you can disconnect or revoke access from your account at any time.

## Two end-to-end workflows

**Territory expansion from a customer file.** Give the agent a CSV of closed-won domains. For each one it checks history, runs a search if none exists, and keeps Direct and Indirect results above a threshold. It merges the lists, removes domains already in the customer file, and writes one ranked output. Ten seed customers cost $2.50. The output has company names, domains and scores only; headcount, location and contacts have to be joined from your own data or another provider.

**Diligence memo.** Give the agent one target company. It runs a single search, groups results by relationship type, flags Emerging companies with high confidence, and drafts a competitive landscape section with a share link to the raw results. One search, $0.25. The [due diligence](https://similariq.ai/use-cases/due-diligence) page explains how to read the four relationship types in that setting.

## Troubleshooting and security

The SDK reports each server's state in the `system` init message, under `mcp_servers`. The documented status values are `pending`, `connected`, `failed`, `needs-auth` and `disabled`. The documentation warns that `pending` is not a failure by itself. `needs-auth` or `failed` for `similariq` usually means the header is missing or the key was revoked; on the REST API the same condition is a 401.

If the agent sees the tools but never calls them, the allow list is missing `mcp__similariq__*`. If a search is cut off, check tool-call timeouts: the documentation names `MCP_TOOL_TIMEOUT` as the setting for how long a running tool call may take, and a search needs roughly 30 to 60 seconds. An out-of-credits error maps to 402, rate limiting to 429, and a failed search to 502, which is refunded and safe to retry.

The SDK's documentation recommends `allowedTools` over broad permission modes for MCP access, because a wildcard grants exactly one server and nothing more. Follow that. Keep the key in the environment, give each agent a separate key, and treat returned company names as data, not instructions. The [agents overview](https://similariq.ai/agents) lists every tool and its cost.

## Frequently asked questions

### How do I add SimilarIQ to a Claude Agent SDK agent?

Add an entry under `mcpServers` with type `http`, the URL `https://similariq.ai/mcp` and a header containing your API key, then add `mcp__similariq__*` to `allowedTools`. Python uses `mcp_servers` and `allowed_tools` for the same options.

### Does the Claude Agent SDK handle SimilarIQ's OAuth sign-in?

Not interactively. The SDK's documentation says it does not open a browser or run an OAuth flow, so use the API key header. OAuth is the route for chat assistants where a person is present to sign in.

### What are the tool names inside the SDK?

MCP tools follow the pattern `mcp__` server key `__` tool name. With the server registered as `similariq`, the search tool is `mcp__similariq__find_similar_companies` and the balance tool is `mcp__similariq__get_search_balance`.

### How do I make a read-only agent that cannot spend credits?

List only the eight free tools in the allow list and leave out `find_similar_companies` and `start_bulk_search`. The agent can still read history, past results, My Companies, saved companies and the balance.

### How much does it cost to run?

One search is one credit, $0.25, for up to 100 look-alikes, and bulk jobs cost one credit per domain. Reading is free. Model usage for the agent itself is billed separately by your model provider and is not part of SimilarIQ pricing.

### Is there anything to install for the MCP server?

No. The server is hosted and stateless, so there is no local process to start. You only install the Agent SDK itself and supply the URL and key.
