# Use Frihet from an AI agent

Frihet is built so that an AI agent can operate it end to end. It's not an API with an AI layer bolted on top: the ERP is agent-native. An assistant can create an invoice, reconcile a bank account, prepare a Modelo 303, or check your cash position — in natural language, with structured, traceable output.

This page is the entry point. Pick the channel that fits your stack and you're up and running in two minutes.

```
You:     "Create an invoice for TechStart Ltd, 40 hours of consulting at 75 EUR/h, due March 1st"
Agent:   Done. Invoice INV-2026-089 — 3,000.00 EUR + 21% VAT = 3,630.00 EUR.
```

---

## Quickstart — MCP server

The [Model Context Protocol](https://modelcontextprotocol.io) is the open standard for connecting agents to tools. Frihet exposes **157** MCP tools — full CRUD over invoicing, expenses, clients, banking, fiscal (Modelo 303/130/390/347, VeriFactu, TicketBAI), European e-invoicing, and more.

There are two ways to connect. Pick one.

### Option A — Remote (zero install)

The `mcp.frihet.io` endpoint is always available. You install nothing; the client authenticates via OAuth in the browser or with your API key.

```json
{
  "mcpServers": {
    "frihet": {
      "url": "https://mcp.frihet.io/mcp"
    }
  }
}
```

Clients with OAuth support (Claude Desktop, Cursor, Smithery) open an authorization window the first time. If your client doesn't support OAuth, pass your API key as `Authorization: Bearer fri_...`.

### Option B — Local (stdio)

For Claude Code, Cursor, or any stdio client, install the package and export your API key.

```json
{
  "mcpServers": {
    "frihet": {
      "command": "npx",
      "args": ["-y", "@frihet/mcp-server"],
      "env": { "FRIHET_API_KEY": "fri_your_key_here" }
    }
  }
}
```

Get your API key at **app.frihet.io → Settings → Developers → API Keys**.

---

## Progressive disclosure (grouped mode)

An agent facing 157 tools all at once burns context reading descriptions it will never use. The remote, agent-facing endpoint (`mcp.frihet.io`) solves this with **progressive disclosure**: instead of the flat wall, `tools/list` returns one-line summaries plus three discovery meta-tools:

- `list_tool_groups()` — the available domains (invoicing, fiscal, banking, CRM, HR, stay, POS…) with their counts.
- `search_tools(query)` — searches tools by free text and returns only the relevant ones.
- `describe_tool(name)` — loads the full schema for a specific tool, on demand.

The agent reads the terse catalog, searches for what it needs, and loads depth only for the few tools it's going to call. Every tool is still callable by its real name — nothing is removed, the listing is just collapsed. The local npm package stays in `full` mode by default, because local clients manage their own context.

Full detail in [MCP Server](./mcp-server).

---

## SDK and CLI

If you prefer code to natural language, the official SDK and CLI wrap the same REST API.

```bash
npm install @frihet/sdk      # typed TypeScript client
npm install -g @frihet/cli   # frihet from the terminal
```

```ts
const frihet = new Frihet({ apiKey: process.env.FRIHET_API_KEY });
const invoice = await frihet.invoices.create({ clientId, lines, dueDate });
```

Full reference in [SDK and CLI](./sdk-cli).

---

## Other channels

The same engine is exposed on the platforms where your automation already lives.

- **ChatGPT** — Frihet is available as an app/GPT through the `openai-mcp.frihet.io` endpoint, with the tool surface tailored to OpenAI's policy.
- **Zapier** — connect Frihet to 7,000+ apps with no code. Triggers and actions on invoices, expenses, and clients.
- **n8n** — official node for self-hosted flows.
- **Webhooks** — 27 events with HMAC-SHA256 signing to react to changes in real time. See [Webhooks](./webhooks).

---

## AI-discoverable surface

Every Frihet subdomain is citable by an agent researching "Spanish ERP with AI". If you're building on Frihet, these routes are your discovery contract:

| Resource                 | URL                                                                                                                       |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| LLM context              | [`docs.frihet.io/llms.txt`](https://docs.frihet.io/llms.txt) · [`mcp.frihet.io/llms.txt`](https://mcp.frihet.io/llms.txt) |
| OpenAPI specification    | [`docs.frihet.io/openapi.json`](https://docs.frihet.io/openapi.json)                                                      |
| Interactive reference    | [`docs.frihet.io/api-reference`](/api-reference)                                                                          |
| MCP descriptor           | [`mcp.frihet.io/.well-known/mcp`](https://mcp.frihet.io/.well-known/mcp)                                                  |
| MCP Registry (Anthropic) | [`registry.modelcontextprotocol.io`](https://registry.modelcontextprotocol.io/?q=io.frihet)                               |

---

## See also

- [Interactive API reference](/api-reference) — explore and try every endpoint
- [MCP Server](./mcp-server) — all 157 tools in detail
- [REST API](./api-rest) — auth, pagination, idempotency, rate limiting
- [SDK and CLI](./sdk-cli)
- [Webhooks](./webhooks)
