> ## Documentation Index
> Fetch the complete documentation index at: https://docs.melso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Melso MCP: https://mcp.melso.ai/mcp (OAuth; one company per connection). Documentation-search MCP: https://docs.melso.ai/mcp; it does not act on customer accounts.
>
> Use the live tool list and respect company membership. Ask the person to approve the exact invoice or tax return version in the signed-in app. Melso's professionals prepare and file included returns after approval; an AI assistant does not file. A prepared file or an approval is not evidence of filing: only the AEAT's reference and receipt are. Keep credentials out of chat and logs.

# Extractos bancarios (Norma 43) — bank_statements MCP

> MCP bank_statements: upload and import a statement after review. Live for an empresa.

Import a bank statement the person gave as the company's bank movements: Norma 43, CSV, Excel or PDF, as the bank exports it, sent in the Melso chat (attachment\_id) or uploaded from another client with upload (upload\_id). read shows what it holds and what is missing; import saves it only when it adds up. A refused statement is never fixed by hand: the person downloads it again. Then reconcile its movements with bank. Each action accepts only its own fields (\* required): import(account\_name, attachment\_id, bank\_account\_id, closing\_balance, opening\_balance, upload\_id); upload(filename\*, content\_type\*, size\_bytes\*).

**Availability:** Empresa.

**Access:** Live for an empresa, in the app and over MCP when the connection lists `bank_statements`. Reading and saving a statement are private beta on REST. A statement that does not add up is refused: ask for it again, and do not edit the balances.

The live tool list is authoritative: the company's plan and your role can narrow this contract. [Understand access](https://docs.melso.ai/mcp/permissions.md).

## When to use

Use `bank_statements` for `import`, `upload`. Use [`bank_statements_read`](https://docs.melso.ai/mcp/tools/bank-statements-read) for the companion actions. The live tool list determines availability.

## Input

```json theme={null}
{
  "additionalProperties": false,
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "account_name": {
          "description": "Only when read asks for the account: the name the person gives a new account.",
          "type": "string"
        },
        "action": {
          "const": "import"
        },
        "attachment_id": {
          "description": "In the Melso chat: the attachment_id of the statement the person sent, at most 5 MB.",
          "type": "string"
        },
        "bank_account_id": {
          "description": "Only when read asks for the account: the saved bank account the person chose, by its id from bank accounts.",
          "type": "string"
        },
        "closing_balance": {
          "description": "Only when read asks for balances: the closing balance the person copies from their bank, as a decimal string.",
          "type": "string"
        },
        "opening_balance": {
          "description": "Only when read asks for balances: the opening balance the person copies from their bank, as a decimal string.",
          "type": "string"
        },
        "upload_id": {
          "description": "From another client: the upload_id from upload, once the statement was PUT to its upload_url.",
          "type": "string"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "upload"
        },
        "content_type": {
          "description": "The file's type: text/plain (Norma 43, TXT), text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/pdf or application/octet-stream.",
          "type": "string"
        },
        "filename": {
          "description": "The file's name, such as extracto.n43 or diario.xlsx.",
          "type": "string"
        },
        "size_bytes": {
          "description": "The file's exact size in bytes.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "action",
        "filename",
        "content_type",
        "size_bytes"
      ],
      "type": "object"
    }
  ],
  "properties": {
    "account_name": {
      "description": "Only when read asks for the account: the name the person gives a new account.",
      "type": "string"
    },
    "action": {
      "enum": [
        "import",
        "upload"
      ],
      "type": "string"
    },
    "attachment_id": {
      "description": "In the Melso chat: the attachment_id of the statement the person sent, at most 5 MB.",
      "type": "string"
    },
    "bank_account_id": {
      "description": "Only when read asks for the account: the saved bank account the person chose, by its id from bank accounts.",
      "type": "string"
    },
    "closing_balance": {
      "description": "Only when read asks for balances: the closing balance the person copies from their bank, as a decimal string.",
      "type": "string"
    },
    "content_type": {
      "description": "The file's type: text/plain (Norma 43, TXT), text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/pdf or application/octet-stream.",
      "type": "string"
    },
    "filename": {
      "description": "The file's name, such as extracto.n43 or diario.xlsx.",
      "type": "string"
    },
    "opening_balance": {
      "description": "Only when read asks for balances: the opening balance the person copies from their bank, as a decimal string.",
      "type": "string"
    },
    "size_bytes": {
      "description": "The file's exact size in bytes.",
      "minimum": 1,
      "type": "integer"
    },
    "upload_id": {
      "description": "From another client: the upload_id from upload, once the statement was PUT to its upload_url.",
      "type": "string"
    }
  },
  "required": [
    "action"
  ],
  "type": "object"
}
```

## Actions

The tool's schema combines the fields of every action. Each action accepts only its own fields below; send `action` with them.

### Statement actions

`upload` returns a link, `read` reads the file without saving it (a PDF is read by Melso and billed to the company's credit) and `import` saves its movements.

> [accordion] import
>
> Save a bank statement the person gave as the company's bank movements, leaving out the movements the account already has. Refused (balance\_mismatch) unless the opening balance plus the movements is the closing balance and every balance printed after a movement follows from the ones before: say so and ask for the statement again from the bank, never retry with other balances to make it fit.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "account_name": {
>       "description": "Only when read asks for the account: the name the person gives a new account.",
>       "type": "string"
>     },
>     "attachment_id": {
>       "description": "In the Melso chat: the attachment_id of the statement the person sent, at most 5 MB.",
>       "type": "string"
>     },
>     "bank_account_id": {
>       "description": "Only when read asks for the account: the saved bank account the person chose, by its id from bank accounts.",
>       "type": "string"
>     },
>     "closing_balance": {
>       "description": "Only when read asks for balances: the closing balance the person copies from their bank, as a decimal string.",
>       "type": "string"
>     },
>     "opening_balance": {
>       "description": "Only when read asks for balances: the opening balance the person copies from their bank, as a decimal string.",
>       "type": "string"
>     },
>     "upload_id": {
>       "description": "From another client: the upload_id from upload, once the statement was PUT to its upload_url.",
>       "type": "string"
>     }
>   },
>   "type": "object"
> }
> ```

> [accordion] upload
>
> Get a link to upload the statement as the bank exports it (Norma 43, CSV, Excel or PDF) (at most 5 MB) when you can run commands: PUT the file to upload\_url, then call read and then import with upload\_id. Without a shell, give the person web\_upload\_url to upload it in Contabilidad instead.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "content_type": {
>       "description": "The file's type: text/plain (Norma 43, TXT), text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/pdf or application/octet-stream.",
>       "type": "string"
>     },
>     "filename": {
>       "description": "The file's name, such as extracto.n43 or diario.xlsx.",
>       "type": "string"
>     },
>     "size_bytes": {
>       "description": "The file's exact size in bytes.",
>       "minimum": 1,
>       "type": "integer"
>     }
>   },
>   "required": [
>     "filename",
>     "content_type",
>     "size_bytes"
>   ],
>   "type": "object"
> }
> ```

## Output

`upload` returns an upload link and its `upload_id`. `import` saves movements not already present, or refuses an unbalanced statement.

The result uses MCP `content` blocks; JSON payloads are encoded in text and may also appear in `structuredContent`. Check `isError` before reading a success payload. When the server declares an `outputSchema`, it is reproduced below. Check the action result and its declared fields before reporting success.

## Example

Use the actions of this tool in the order shown; its companion tool covers the other actions. These are the `arguments` of each call, in order.

**1. Ask for an upload link**

```json theme={null}
{
  "action": "upload",
  "filename": "extracto-octubre.n43",
  "content_type": "text/plain",
  "size_bytes": 18432
}
```

**2. Save its movements**

```json theme={null}
{
  "action": "import",
  "upload_id": "11111111-1111-4111-8111-111111111111"
}
```

The first call as a request. Use an OAuth access token issued for this MCP resource and replace the example identifiers with values from your own company. Write actions change data.

```bash theme={null}
curl --fail-with-body https://mcp.melso.ai/mcp \
  -H "Authorization: Bearer $MELSO_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  --data-binary @- <<'JSON'
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "bank_statements",
    "arguments": {
      "action": "upload",
      "filename": "extracto-octubre.n43",
      "content_type": "text/plain",
      "size_bytes": 18432
    }
  }
}
JSON
```


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