Skip to main content

MCP server

uninvoice.app ships a Model Context Protocol (MCP) server so AI agents and MCP-aware tools can read your company data, create invoices and expenses, and generate business reports directly. It exposes the same operations as the HTTP API, authenticated the same way, but shaped as MCP resources and tools.

info

The MCP server is a distinct process from the HTTP API. It speaks MCP over the streamable-HTTP transport: your MCP client connects to a single HTTP endpoint, exposed at its own MCP endpoint URL.

Authentication​

Every MCP request must carry a Bearer token in the Authorization header: the same tokens the HTTP API accepts. The token is validated on every operation, including listing resources and tools. A missing or malformed header, or an invalid or revoked token, is rejected with 401.

A session belongs to the token that opened it. Every request in it, including reopening or resuming its event stream and closing it, must carry that same token: the session id alone opens nothing.

The token determines the acting user and company; every resource you read and every invoice you create is scoped to that company.

MCP is always gated by AI Audit

The MCP server is always treated as an AI. Its write tools never execute directly: each one records a pending AI Audit entry that a person must approve before it takes effect. Unlike an API token, the MCP server cannot present the X-Human-Proof header to opt out; there is no way to make an MCP mutation skip the review queue.

Configure your MCP client with the endpoint URL and the header, for example:

{
"mcpServers": {
"uninvoice": {
"url": "https://mcp.uninvoice.app",
"headers": { "Authorization": "Bearer <api-token>" }
}
}
}

Resources​

Resources are read-only views of your data under the uninvoice:// URI scheme. They return application/json.

URIDescription
uninvoice://companyYour company configuration.
uninvoice://entitiesAll entities (clients / suppliers).
uninvoice://entities/{id}A single entity by ID.
uninvoice://entities/{id}/invoicesThe invoices emitted to a given recipient entity.
uninvoice://entities/{id}/expensesThe expenses (bills) received from a given supplier entity.
uninvoice://invoicesAll invoices, each as GET /v1/invoices lists it, with its lineCount of goods and services lines.
uninvoice://invoices/{id}A single invoice with its lines, as GET /v1/invoices/{id} returns it.
uninvoice://proformasAll proformas, each as GET /v1/proformas lists it, with its lineCount of goods and services lines.
uninvoice://proformas/{id}A single proforma with its lines, as GET /v1/proformas/{id} returns it.
uninvoice://expensesAll expenses (bills received from suppliers).
uninvoice://expenses/{id}A single expense with its lines.
uninvoice://reportsAll generated business reports (status / metadata).
uninvoice://reports/{id}A single generated report by its ID.

The total of an invoice or a proforma is the sum of its lines' subtotal. Its VAT is in it once, as the subtotal of its vat lines, one per rate. A goods or services line's tax_amount is its share of its rate's vat line, already counted there: never add it to the total.

The .../{id} forms (and the entities/{id}/… sub-collections) are advertised as resource templates; the top-level collection forms are listed as plain resources.

Tools​

create_invoice​

Creates a new draft invoice for a recipient, with line items. VAT is stated as a rate, in either of two ways that can be mixed: tax_rate on a goods or services line, or one line with tax_type vat carrying tax_rate, which applies to every line that states none. With neither, the default rate for the company and recipient is applied. The VAT amounts are calculated, one vat line per rate. This mirrors POST /v1/invoices; the resulting invoice is a draft until you issue it through the HTTP API.

Input schema:

FieldTypeRequiredDescription
recipient_idstringyesEntity ID of the recipient.
supply_type"services" | "goods"yesWhether the invoice covers services or goods.
linesarrayyesLine items (see below).

Each entry in lines:

FieldTypeRequiredDescription
conceptstringyesDescription of the service or product.
quantitynumbernoNumber of units (decimals allowed, e.g. 95.6).
quantity_unitstringnoUnit label (e.g. hours, days).
unit_priceintegernoPrice per unit, in cents.
unit_unitstringnoCurrency unit label.
tax_typestringnoWhich tax the line carries: vat, other, or a country's own tax such as es:irpf. Leave it out for a goods or services line.
tax_ratenumbernoVAT rate as a percentage (21, 7.5). On a goods or services line, that line's rate (0 for no VAT). On a vat line, the rate of the whole invoice, and required there.
subtotalintegernoLine subtotal in cents. On a vat line it is the VAT amount, and is calculated when left out.

Lines appear on the invoice in the order you list them.

Example arguments:

{
"recipient_id": "ent_...",
"supply_type": "services",
"lines": [
{ "concept": "Consulting (June 2026)", "quantity": 10, "quantity_unit": "hours", "unit_price": 20000 }
]
}

Because the MCP server is always gated, this tool does not create the invoice immediately. It records a pending AI Audit entry and returns a message with the entry id; the draft is created only once a person approves it.

Issuing happens over the HTTP API

The MCP tool creates drafts only. To assign the invoice number and (for Spanish issuers) report it to the AEAT, issue it with POST /v1/invoices/{id}/issue. The same Veri*Factu authorization gate applies: business errors, including the authorization requirement, are surfaced to the MCP caller with their actionable message.

create_expense​

Records an expense (a bill received from a supplier) with line items. This mirrors POST /v1/expenses.

Input schema:

FieldTypeRequiredDescription
supplier_idstringyesEntity ID of the supplier the bill was received from.
invoice_referencestringyesThe supplier invoice's reference/number (non-empty, unique per supplier).
linesarrayyesLine items (see below).
expense_datestring (RFC 3339)noWhen the expense was incurred.
currency_codestringnoISO currency code. Defaults to the supplier's currency.
categorystringnoExpense category.
descriptionstringnoFree-text note about the expense.

Each entry in lines:

FieldTypeRequiredDescription
conceptstringyesLine description.
subtotalintegeryesLine subtotal in cents.
quantitynumbernoNumber of units (decimals allowed, e.g. 95.6).
quantity_unitstringnoUnit label (e.g. hours, days).
unit_priceintegernoPrice per unit, in cents.
unit_unitstringnoCurrency unit label.
is_taxbooleannoWhether this is an explicit tax line.
tax_amountintegernoTax amount in cents.
Receipts can't be attached over MCP

Receipt files (PDF / image) cannot be uploaded through this MCP server. Attach them from the uninvoice.app web app or HTTP API instead.

Like create_invoice, this records a pending AI Audit entry and returns the entry id; the expense is created only once a person approves it.

generate_report​

Generates a background PDF business report for a timeframe. This mirrors POST /v1/reports. Once approved, the report renders in the background and the requester is emailed a download link; ready reports also appear as uninvoice://reports resources.

Input schema:

FieldTypeRequiredDescription
report_typeenumyesOne of business_overview, vat_summary, profit_loss, client_revenue, expense_supplier, cash_flow_projection.
period_startstring (RFC 3339)yesStart of the reporting window (inclusive).
period_endstring (RFC 3339)yesEnd of the reporting window (exclusive).
projection_monthsintegernoFor cash_flow_projection only: how many months to carry the pace of the reporting window forward, from 1 to 60. Defaults to 12.
localesarray of stringsnoLocale(s) to render in (e.g. en, es, es_ES). One report is generated per locale, and numbers format per region (so es_ES and es_MX differ). Omit to render a single report in the requesting user's language.

Like the other tools, this records a pending AI Audit entry and returns the entry id; generation starts only once a person approves it.

delete_report​

Deletes a generated report (and its stored PDF) by id. This mirrors DELETE /v1/reports/{id}.

Input schema:

FieldTypeRequiredDescription
report_idstringyesThe id of the report to delete (from uninvoice://reports).

Like the other tools, this records a pending AI Audit entry and returns the entry id; the report is removed only once a person approves it.