Skip to main content

MCP server

Scribee exposes a Model Context Protocol (MCP) server on top of the partner API. An assistant or agent that speaks MCP finds ready-to-call tools there to list, create, import, move through the lifecycle and delete invoices, without automating a browser and without you writing the matching REST integration code.

The server adds no capability to the API: each tool runs one specific /api/v1 operation, with your token, and hands you that operation's HTTP status and response body. The response headers are not passed on: a header such as Idempotency-Replayed is not visible through a tool. Everything the other pages of this documentation describe (scopes, workspace access, IP allowlist, errors, request limit) therefore applies identically.

The endpoint​

POST https://app.scribee.tech/mcp

The server follows MCP's Streamable HTTP transport, in a deliberately reduced form:

  • Stateless. Each request is handled on its own: no session is opened, no Mcp-Session-Id header is issued, and a tools/call does not need a prior initialize on the same connection.
  • JSON responses only. Each JSON-RPC message the server returns is a single object, as Content-Type: application/json, including the 413 for a body over 4 MiB and the 400 or 415 for an invalid JSON body. The server opens no SSE stream and sends no notification. Not every response is a JSON-RPC message, though: as on the API, a 401 comes with no body and a 429 carries the API's error envelope (too_many_requests); a 405 and the 202 acknowledging a notification have no body. Read the HTTP status before decoding the body.
  • POST only. A GET or DELETE on /mcp first goes through the same checks as a POST, in the same order: a body over 4 MiB receives 413, before any token check; an admitted body receives 401 without a valid token, and 429 with a valid token whose application has gone over its request limit (Limits). Otherwise, it receives 405 with the Allow: POST header, and counts against that limit like any authenticated request.

Each POST must carry Content-Type: application/json (otherwise 415) and an Accept header that includes application/json or */* (otherwise 406); neither header is checked on a GET or a DELETE, which gets the responses described above. The body is a single JSON-RPC message: an array of messages (a batch) is refused with 400. A notification, such as notifications/initialized, is acknowledged with a 202 and no body.

An invalid JSON body follows the same order as any request. Without a valid token, it gets 401; with a valid token, it counts against the request limit (Limits), then goes through the transport's checks in their order (the Origin described below, the Accept header, the content type) before being refused: with 400 and the JSON-RPC error -32700 Parse error: Invalid JSON when sent as application/json, with 415 and the error -32600 Unsupported Media Type: Content-Type must be application/json with any other content type, multipart/form-data included. A GET or a DELETE gets the 405 described above.

Authentication​

The MCP server authenticates exactly like the API: obtain a client_credentials access token as described in Authentication, then send it in the Authorization: Bearer header of every request. Only that header is read: a token sent as a URL parameter or in the body gets 401. Any one of the read, write or destroy scopes opens the endpoint; each tool then requires the scope of its REST operation (see the table below).

:::caution No OAuth discovery and no browser sign-in

Many MCP clients expect to discover an authorization server and open a sign-in page (the authorization_code flow). Scribee offers neither: only the client_credentials grant is accepted on /oauth/token, and no OAuth metadata document (/.well-known/oauth-protected-resource, /.well-known/oauth-authorization-server) is published. Configure your client with the endpoint URL and a fixed Authorization header.

Like every access token, this one expires (expires_in in the /oauth/token response). The server then answers 401, with no body, as the API does (API conventions): request a new token and update your client's header.

:::

On a POST, an Origin header is checked when present: a request whose Origin names a host other than app.scribee.tech is refused with 403. This check comes after authentication and the request limit: whatever its Origin, a request receives 401 without a valid token, and 429 over the limit. A GET or DELETE is not subject to it: with a valid token, it receives the 405 described above, even with a foreign Origin. An MCP client running server-side sends no Origin and is not affected; a web page on another domain cannot call /mcp from the browser.

A complete exchange​

The access token is placed beforehand in the SCRIBEE_ACCESS_TOKEN variable and passed to curl through a configuration file read from standard input (--config -), as in Your first call: that way it appears neither in the process arguments nor in the shell history.

The initialize handshake:

printf 'header = "Authorization: Bearer %s"\n' "$SCRIBEE_ACCESS_TOKEN" \
| curl --config - -X POST https://app.scribee.tech/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-11-25", "capabilities": {}, "clientInfo": {"name": "my-agent", "version": "1.0.0"}}}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2025-11-25",
"capabilities": {
"tools": {}
},
"serverInfo": {
"name": "scribee",
"title": "Scribee",
"version": "1.0.0"
}
}
}

The server echoes the requested protocolVersion when it knows it (2025-11-25, 2025-06-18, 2025-03-26 or 2024-11-05) and answers 2025-11-25 otherwise. On the following requests, MCP clients send the agreed version in the MCP-Protocol-Version header; a value the server does not know is refused with 400. serverInfo.version follows the published version of the partner API: do not hard-code it.

tools/list returns the five tools, each with its description, its argument schema (inputSchema) and its four annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint), detailed tool by tool below.

A tool call:

printf 'header = "Authorization: Bearer %s"\n' "$SCRIBEE_ACCESS_TOKEN" \
| curl --config - -X POST https://app.scribee.tech/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2025-11-25" \
-d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "list_invoices", "arguments": {"workspace_id": 42, "per_page": 20}}}'

Here, workspace 42 is not granted to the application: the REST operation answers 403, and the tool returns that response.

{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [
{
"type": "text",
"text": "{\"status\":403,\"body\":{\"error\":\"forbidden\",\"message\":\"L'application n'a pas accès à cet espace de travail\"}}"
}
],
"isError": true,
"structuredContent": {
"status": 403,
"body": {
"error": "forbidden",
"message": "L'application n'a pas accès à cet espace de travail"
}
}
}
}

The tools​

ToolREST operationScopeMain arguments
list_invoicesGET /api/v1/workspaces/{workspace_id}/invoicesreadworkspace_id (required), page, per_page, sort_by, sort_order, include, lifecycle_status, company_ids, created_at_from, created_at_to, updated_at_from, updated_at_to, issue_date_from, issue_date_to, external_source, external_id
create_draft_invoicePOST /api/v1/workspaces/{workspace_id}/invoiceswriteworkspace_id and invoice (required), company_id
upload_invoicePOST /api/v1/workspaces/{workspace_id}/invoices/uploadwriteworkspace_id, filename and content_base64 (required), direction, company_id, lifecycle_state
transition_invoicePATCH /api/v1/invoices/{id}/transitionwriteinvoice_id and event (required), collected_amount, approved_tax_inclusive_amount, reason_code, reason, requested_action_code, requested_action, idempotency_key
delete_invoiceDELETE /api/v1/invoices/{id}destroy or writeinvoice_id (required)

The arguments carry the name and meaning of the REST operation's parameters, described on its reference page and in the invoicing guides. The differences come from the MCP form:

  • list_invoices takes include, lifecycle_status and company_ids as arrays.
  • create_draft_invoice passes on only the invoice keys the REST create accepts: an unknown key, at any depth, is dropped without an error before the call to the API, just as the REST create ignores it itself. The tool also always sets lifecycle_state: "draft" in it, replacing any value sent. The invoice therefore stays a draft; deposit it or make it available afterwards with transition_invoice (Invoice lifecycle).
  • upload_invoice receives the file encoded in strict Base64 in content_base64, with no line breaks, and its name in filename. A content_base64 that is not valid Base64 is refused by the tool itself, with no call to the API: the result carries isError: true and a text message, with no structuredContent. The type of the file passed to the operation is derived from the extension of filename. For a file that carries no structured invoice (a PDF with no embedded XML, or an image), the operation answers 202 with data.status set to "processing" and data.upload_file_id, with no invoice: the file is accepted for extraction in the background, and the invoice, if extraction succeeds, is created later and announced by the invoice.created webhook event (or found in the invoice list). Do not send the file again (An unstructured file answers 202, not 201). A lifecycle_state other than draft applies only to a structured invoice (Factur-X, UBL, CII): for a file that goes to background extraction, it is refused with 422, before anything is created. Send such a file with no lifecycle_state (or with draft), then make the transition with transition_invoice once the invoice is created (the real cause of a rejection is in details.file).
  • transition_invoice takes the event name in event (deposit, approve, collect...), and passes idempotency_key in the REST operation's Idempotency-Key header.

No tool lists the workspaces: pass the workspace_id obtained with GET /api/v1/workspaces (Your first call).

The annotations​

Each tool publishes its four MCP annotations in tools/list, all of them set. A tool can cover several effects (transition_invoice accepts every lifecycle event, upload_invoice can deposit the invoice it creates): each annotation describes the tool's most consequential case, not that of a particular call.

ToolreadOnlyHintdestructiveHintidempotentHintopenWorldHint
list_invoicestruefalsetruefalse
create_draft_invoicefalsefalsefalsetrue
upload_invoicefalsefalsefalsetrue
transition_invoicefalsetruefalsetrue
delete_invoicefalsetruetruefalse
  • readOnlyHint. Only list_invoices modifies nothing; the four other tools write to the workspace.
  • destructiveHint. delete_invoice permanently deletes a draft, and only a draft DELETE /api/v1/invoices/{id} agrees to delete: a draft already included in an accounting export, for instance, stays in place, and the tool returns an error result whose structuredContent.status is 422. transition_invoice can, with cancel, refuse or reject, move an existing invoice into a state that no event of the tool brings it back from. create_draft_invoice and upload_invoice are additive: they create a new invoice, and the state requested from upload_invoice applies to it alone.
  • idempotentHint. create_draft_invoice and upload_invoice publish false: replayed, a call can create a second document, or be refused, depending on what it sends. A sales invoice whose number the company already used receives the API's 422 duplicate_invoice_number, and nothing is created (422: invoice number already imported); a purchase file already imported is handled as a copy (A purchase invoice already imported answers 201, then goes to the trash). transition_invoice publishes false: idempotency_key is honoured for the collect event only, and another event replayed with the same key, deposit for instance, is processed again: it can receive a transition refusal instead of the original response. delete_invoice publishes true: a second call finds the invoice deleted, answers 404 and changes nothing more. Before automatically replaying a call left without a response, therefore check that the tool publishes idempotentHint: true.
  • openWorldHint. list_invoices and delete_invoice act on the workspace's data only. The three other tools can have an effect outside Scribee: a deposit (deposit with transition_invoice, or lifecycle_state: "deposited" with upload_invoice) issues the invoice (Invoice lifecycle), and both the creation of an invoice and each lifecycle event applied are notified to the workspace's subscribed webhook endpoints (invoice.created, invoice.lifecycle_event.created, see Webhooks).

The annotations inform your client; they restrict nothing. What a tool can do is limited by your token's scopes: for an agent that must only read, issue a token carrying read alone, and the four other tools receive the API's 403.

A tool's result​

The result of a tools/call carries the REST operation's HTTP response in two equivalent forms:

  • structuredContent holds status, the operation's HTTP status, and body, its JSON body as is: the data envelope of a success, or the error body (error, code, message, details...) of a refusal. body is null when the operation returns no body, such as the 204 of a successful deletion.
  • content holds a single text element, carrying the same {"status": ..., "body": ...} object serialized as JSON, for clients that do not read structuredContent.

isError is true as soon as status is greater than or equal to 400. An API error is therefore a tool result, with an HTTP 200 response on /mcp, not a JSON-RPC error: base your logic on structuredContent.status and on structuredContent.body.error or structuredContent.body.code, as you would on the API (API conventions).

Two cases are refused before any call to the API. Arguments that do not match the tool's schema, or a missing required argument, produce an isError: true result with a text message and no structuredContent. An unknown tool name receives a JSON-RPC error (code -32602).

The same behavior as the API​

The tool calls the REST operation on your behalf, with the token of the /mcp request:

  • Scopes. The required scope is the operation's. A token without write receives the API's 403 on create_draft_invoice, upload_invoice and transition_invoice.
  • Workspace access. A workspace outside your application's perimeter answers 403 on list_invoices, create_draft_invoice and upload_invoice; an invoice your application cannot reach answers 404 on transition_invoice and delete_invoice.
  • IP address. The workspace's IP allowlist applies to the address of the machine calling /mcp. If your MCP client runs on a hosted platform, it is that platform's address that is checked (Authentication).
  • Business rules and errors. Validations, transition refusals and deletion refusals are the operation's, with the same statuses, codes and messages.

Limits​

Request limit. The MCP server shares your OAuth application's counter of 300 requests per minute (API conventions). Each authenticated HTTP request sent to /mcp counts as one, whatever the JSON-RPC method (initialize, tools/list, a notification or tools/call). The API call a tool makes is not counted a second time. Beyond the limit, /mcp answers 429 directly, with the Retry-After header and the API's error body, not with a JSON-RPC message.

Request size. The body of a /mcp request is limited to 4 MiB (4,194,304 bytes), whatever the HTTP method and with or without a token. Without Transfer-Encoding, a Content-Length declared over the limit is enough for the refusal; with Transfer-Encoding, the bytes actually sent are what is measured, whatever Content-Length declares. Beyond that, the request is refused with 413 before any processing, before the token is even checked: a body that is too large receives this 413, not 401, 429 or 405, which apply only to an admitted body. This 413 carries a JSON-RPC error body, not the API error body: code -32600, message Payload too large: request body exceeds 4194304 bytes. A body under 4 MiB holding more than 500,000 JSON nodes (structural characters {, [, , and : outside strings) or more than 100,000 objects and arrays ({ and [ outside strings), that nests them more than 16 levels deep, or that holds a key path longer than 128 bytes or a number longer than 128 bytes (API conventions), gets the same 413, also before the token is checked, with the message Payload too large: request body holds more than 500000 JSON nodes or 100000 objects and arrays, nests them deeper than 16 levels, or holds an object key path longer than 128 bytes or a number longer than 128 bytes. Since Base64 grows the file by a third, a file sent with upload_invoice must stay a little under 3 MiB. For a larger file, call POST /api/v1/workspaces/{workspace_id}/invoices/upload directly (Import existing invoices).

Decimal numbers. As with the API, a tools/call request whose body holds more than 250,000 JSON numbers written with a fraction or an exponent is not read exactly: every regulated amount, quantity or price sent as a decimal number is refused, and the tool returns the API's 422 (API conventions). When such a request, past that threshold, targets an operation that honours its Idempotency-Key (transition_invoice with idempotency_key, on the collect event) and an argument it receives, collected_amount for instance, is written as a decimal number, the tool returns the API's 422 validation_failed under details.base (API conventions), before the key is stored or compared. This refusal leaves the key in its prior state: it replays no stored response, a fresh key is not reserved, and a key that has already served keeps the reservation or the stored response of its first request. A corrected body sent afterwards under that key therefore gets 409 idempotency_key_reuse if it differs from the body of that first request.