---
title: Connect an AI
project: TotalInvoice
version: Latest
section: guides
language: en
license: 
url: https://totaljs.es/docs/totalinvoice/latest/guides/connect-an-ai/
updated: 2026-12-05T18:45:29.786Z
---

# Connect an AI

> TotalInvoice has an MCP server, so an assistant on your computer (Claude, Cursor or any MCP client) can look at your customers and pro formas, prepare new pro formas and note which ones are accepted and paid.

## Turn it on

1. Open **Settings** → **AI assistants**.
2. Turn on **Let assistants connect**.
3. Copy what your client needs. The window has it ready for Claude Code, for Cursor and other MCP clients, for Claude Desktop and for code mode.

The address is `http://127.0.0.1:7260/mcp`. If that port is in use, TotalInvoice takes the next free one, up to 7269, and the window has the right address.

The server is off until you turn it on. It listens only on this computer, and only while TotalInvoice is open. It asks for a token, which is kept in the secure store of your system. With **New token**, the assistants that have the old one stop working until you give them the new one.

> Anyone with the token can see your pro formas. Give it only to your assistants.

## What it can do

It can read your details, your customers and your pro formas, prepare a pro forma, and mark one as accepted or paid. A pro forma that it prepares waits for you in **Pro formas**: you look at it and send it.

It cannot delete anything or change the settings.

## The tools

| Tool | What it does |
| --- | --- |
| `Business_info` | Your details, the defaults of your pro formas and today's date |
| `Clients_list` | Your customers, or those whose name, tax ID or email has a text |
| `Invoices_list` | Your pro formas, the newest first, with how each one stands: `proforma`, `accepted` or `paid` |
| `Invoice_get` | A pro forma in full: its lines, totals, notes, and when it was accepted and paid |
| `Proforma_create` | Prepares a pro forma for a customer, with its lines |
| `Proforma_mark_accepted` | Marks a pro forma as accepted, or takes the mark back |
| `Invoice_mark_paid` | Marks a pro forma as paid, or takes the mark back |

**What assistants did** has the last calls since you opened TotalInvoice.

## Code mode

The assistant can also write one script instead of calling the tools one by one: it costs less and goes faster. Download the client, which needs Node.js 18 or newer:

```bash
curl -H 'Authorization: Bearer YOUR_TOKEN' 'http://127.0.0.1:7260/mcp/client.js' -o totalinvoice.js
```

It has a function for each tool:

```javascript
const api = require('./totalinvoice.js')('YOUR_TOKEN');

(async function() {
	const waiting = await api.Invoices_list({ state: 'proforma' });
	console.log(waiting);
})();
```

A function that fails throws an error with the message of TotalInvoice. The window has this code with your address and your token.
