# MCP Server

Connect AI agents to Statsnet over the Model Context Protocol.

Statsnet exposes a remote MCP server (Streamable HTTP, stateless) so AI agents — Claude, Cursor, or anything MCP-compatible — can query company data directly:

```text
POST https://statsnet.co/mcp
```

Authentication uses the same `sk_live_...` API key as the REST API, created in your [account settings](https://statsnet.co/me). Billing is identical to REST: API plans are metered per call, report plans consume one report per company card with a 2-week free-reuse window.

## Tools

Without a key (anonymous):

| Tool | Description |
| --- | --- |
| `search_companies` | Search companies by name, BIN/IIN or director. Limited to 30 searches per hour per IP. |
| `get_company` | Public company card in Markdown: status, registration, management, counters, financials. |

With `Authorization: Bearer sk_live_...`:

| Tool | Description |
| --- | --- |
| `search_companies` | Same search without IP limits, up to 50 results per call. |
| `get_company` | Public company card. |
| `get_company_paid` | Full company card: shareholders, capital, full financial history, risks. Consumes plan quota. |
| `get_gov_contracts` | Government contracts: subject, customer, amount, dates. |
| `get_court_cases` | Court cases: number, type, court, parties, outcome. |
| `get_relations` | Relations graph: shareholders, officers and their other companies. |
| `check_individual` | Check a person by IIN: directorships, shareholdings, risks. Requires the Premium plan or higher. |

## Connect

**Claude Code**

```bash
claude mcp add --transport http statsnet https://statsnet.co/mcp \
  --header "Authorization: Bearer sk_live_YOUR_KEY"
```

**Claude Desktop / Cursor (mcp.json)**

```json
{
  "mcpServers": {
    "statsnet": {
      "url": "https://statsnet.co/mcp",
      "headers": { "Authorization": "Bearer sk_live_YOUR_KEY" }
    }
  }
}
```

Without the `Authorization` header the server still works in the anonymous mode with the two public tools.

## Errors

Invalid or revoked keys get HTTP `401` (never a silent downgrade to anonymous). Quota and plan problems are returned as tool errors with a human-readable explanation, so the agent can relay them — for example, that the monthly allowance is exhausted or the plan tier is too low.
