> ## Documentation Index
> Fetch the complete documentation index at: https://api-doc.fidly.be/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your AI (MCP)

> Let Claude, ChatGPT or another AI assistant search, summarize and prepare your invoicing in Fidly.

Fidly has an MCP server: an AI assistant that supports MCP connectors (Claude,
ChatGPT, Claude Desktop…) can work on your company's data in plain language —
"which of Dupont's invoices are unpaid?", "how much did I invoice this quarter?",
"prepare an invoice for 3 days of consulting for Martin". Your software
integrations keep using the REST API.

The MCP connection is available to the companies that can use the Fidly API.

## Adding Fidly to your AI

In your AI assistant, add a custom connector (also called an MCP server) with this
URL:

```
https://api.fidly.be/mcp
```

No key or secret is needed: the assistant opens a Fidly page in your browser,
where you sign in and authorize it.

## Consent screen

The page shows:

* the **name the assistant gives itself** — chosen by the assistant, so not proof
  of who it is;
* the **address you will be sent back to** after your decision (`claude.ai`,
  `chatgpt.com`, `localhost` for a desktop application…). Check that it is your
  assistant's;
* a **warning** when Fidly does not recognize the assistant. Only authorize it if
  you added Fidly to that assistant yourself.

You then choose the company and the rights, and click **Authorize**. You have
**10 minutes** from the moment the assistant opened the page; past that, start the
connection again from your assistant.

Only the users who may create API credentials for a company may authorize an AI
for it. Each authorization creates a new connection: connecting the same assistant
twice gives two connections, and you can revoke the one you no longer use.

## Rights

A connection's rights work like an API client's: for each resource, each action —
create, read, update, delete — is allowed or not. The assistant only sees the tools
its rights allow.

* With **read documents** alone, a document shows its relation's name and nothing
  else of it. Finding a relation by its name needs **read relations**.
* **Update documents** allows sending a document over Peppol, which cannot be
  undone.
* Rights with no tool yet (bank accounts, journals, brandings, any deletion) have no
  effect today; they will apply when tools arrive, without reconnecting.
* A connection always works on your company's real data: there is no sandbox for
  AI connections.

## Revoking a connection

AI connections appear in your company's API access list in Fidly, with their name,
the user who authorized them and their last activity. A connection stays active
until it is revoked, even if the assistant is no longer used.

**Revoking** takes effect immediately: the assistant's next request is refused.
**Changing the rights**: a tool whose right is removed is refused from the
assistant's next call; a tool whose right is added appears once the assistant
reloads its list of tools, in practice in a new conversation. To reconnect after a
revocation, add the connection again from your assistant.

## Tools

| Tool | What it does | Rights needed |
| - | - | - |
| `find_relations` | Finds customers, suppliers and contacts by name, alias, VAT number or identifier | read relations |
| `relation_overview` | A relation's details; with read documents, also what it still owes and is owed, and its 5 latest documents | read relations (+ read documents) |
| `search_documents` | Finds invoices, credit notes and proformas, with totals over every match | read documents |
| `get_document` | The detail of one document, lines included | read documents |
| `get_document_file` | A document's PDF, or its Peppol XML | read documents |
| `summarize_documents` | Sales or purchase figures over a period, by month, relation, payment status or type | read documents |
| `create_document` | Creates an invoice, a credit note or a proforma | create documents |
| `update_document` | Corrects a document that has not been sent yet | update documents |
| `send_document` | Sends a document over Peppol | update documents |
| `create_relation` | Creates a company or a contact | create relations |
| `update_relation` | Corrects a relation | update relations |

Not available through the AI: deleting, importing documents, attachments, bank accounts, journals and brandings.

### Relations by name

Wherever a tool takes a relation, the assistant can give its id or its name. When
several relations match a name, the tool returns the candidates (id, name, VAT
number) and the assistant asks you which one.

### Totals

`search_documents`, `summarize_documents` and `relation_overview` count by
**direction**: sales (sale invoices and credit notes) and purchases (purchase
invoices and credit notes), whether issued in Fidly or received. In every total:

* credit notes are subtracted;
* proformas, other documents and documents deleted or hidden in the accounting are
  not counted;
* amounts are given per currency;
* "overdue" means past the due date with something still due.

`search_documents` returns up to 50 documents per call, newest first; its `sums`
cover every match, per direction and currency.

`summarize_documents` covers at most 366 days per call. Grouped by relation, it
returns the 20 largest relations per currency, then one row per currency adding up
the rest (`key: "others"`, label "Other relations (N)").

### Document detail

`get_document` returns the document as the API does, without its attachments. Its
relation is given by id and name only (`relation_id`, `relation_name`).

`get_document_file` returns a download link to the document's PDF, or to its
Peppol XML with `format: "xml"`. The link is valid for 15 minutes and works for
anyone holding it; after that, the assistant asks for a new one. A document just
created or corrected only has its file a few moments later.

### Creating a document

`create_document` creates a sale invoice by default, and a proforma only when you
ask for a draft or a proforma. It takes the relation, the lines (item, quantity,
unit price, VAT code…) and optionally the issue date, payment terms, journal, order
number, buyer reference and currency.

The document is **numbered at creation**. It can only be deleted while
it is the last of its sequence, has not been sent, has not gone to the accounting
and is linked to nothing; once another invoice follows it, a mistake is corrected
with a credit note. Nothing is sent, and the PDF is produced a few moments later.

### Correcting a document

`update_document` takes the document's id and only the fields to change
(`changes`), in the shape of the API's document update. The lines sent **replace**
every line: to add one, the assistant reads the document back and sends all its
lines with the new one. The amounts are recomputed, the number stays and the PDF is
regenerated a few moments later.

A document sent (mail or Peppol) or handed to the accounting can no longer be
corrected: a credit note corrects it. The type and the journal never change.

### Sending a document

`send_document` sends a document issued in Fidly over Peppol. The assistant is told
to confirm with you first, since a sent document can no longer be corrected or
deleted. The send is asynchronous: the tool answers `{"status": "handed_over",
"document": …}` once the send is accepted, and the document's Peppol status changes
once the network has processed it.

### Creating and correcting a relation

`create_relation` takes the relation in the shape of the API's relation creation
(`relation`: type, name or first name, address with its country…). A company whose
VAT number, identifier or electronic address another relation already has is
refused, with the id of that relation.

`update_relation` takes the relation (id or name) and only the fields to change
(`changes`); the relation's type cannot change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.