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.

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 with its lineCount).
uninvoice://invoices/{id}A single invoice with its lines.
uninvoice://proformasAll proformas (each with its lineCount).
uninvoice://proformas/{id}A single proforma with its lines.
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 .../{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. Taxes are calculated automatically from the company and recipient. 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.
is_taxbooleannoWhether this is an explicit tax line.
tax_amountintegernoTax amount in cents.
subtotalintegernoLine subtotal in cents.

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.
period_startstring (RFC 3339)yesStart of the reporting window (inclusive).
period_endstring (RFC 3339)yesEnd of the reporting window (exclusive).
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.