
# MCP

The FinCalc API is also an [MCP](https://modelcontextprotocol.io) server, so an AI assistant or agent
that speaks MCP can find and run your institution's calculators itself.

```
https://api.fincalc.com/mcp
```

It is the same API: the same keys, sent the same way (`Authorization: Bearer <key>`), the same
licensing, quota and rate limit, and the same [answers](/answers). It uses the Streamable HTTP
transport, without sessions.

## Tools

| Tool | What it does | Counts against the quota |
|---|---|---|
| `find_calculators(query?)` | Searches the calculators your key can run by name and description, best match first, and returns each one's slug. A question in a person's words works: "how much house can I afford". | No |
| `describe_calculator(slug, locale?)` | A calculator's inputs (names, types, units, ranges, defaults) and outputs, with your institution's wording when it has turned that on. | No |
| `calculate(slug, inputs, include?, locale?)` | Runs it. The structured result is the same `{result, institution, meta}` answer as `POST /v2/calculators/{slug}`. | Yes, with a live key |

Every `calculate` answer's text ends with the same line, whatever your institution has turned on:
*Estimates from the inputs given; not financial advice.* When the answer carries your institution's
disclaimer, the text asks for it to be shown with the figures.

## Connecting an agent

Give your MCP client the address above and a key in the `Authorization` header. Use a test key while
you build: it is limited to 10 calls a minute, and every MCP request counts as one, so a conversation's
`initialize` and `tools/list` use some of them.

```json
{
  "mcpServers": {
    "fincalc": {
      "type": "http",
      "url": "https://api.fincalc.com/mcp",
      "headers": { "Authorization": "Bearer ${FINCALC_KEY}" }
    }
  }
}
```

Keys are for servers. The endpoint refuses any request a browser makes, so a key can't be used from a
web page.

## When something goes wrong

- **A key that doesn't work** is refused before any tool runs, with the same 401
  [`unauthorized`](/problems/unauthorized) problem as the REST API.
- **A message the server can't take** (not JSON, not a JSON-RPC 2.0 request or notification, or a
  batch) is answered with a JSON-RPC error that says which: `-32700` for a body that isn't JSON,
  `-32600` for the rest. Send one message per request; batches aren't supported.
- **Everything else** comes back as a tool error the model can read: the problem's detail and its
  [type](/errors), or, when the calculator refuses the inputs, each input it refused with a hint
  where one helps (a percentage sent as 6.5 rather than 0.065, say). Correct the call and try again.
  A successful answer's text names any inputs that were filled in for the model
  ([`meta.filled`](/answers)), so it can send its own.

Signing in with a FinCalc console account instead of a key comes later; until then, a key is the
only way in.
