> ## 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. Melso API: https://api.melso.ai/v1, with a company API key or a partner key (early access); invoicing is live and the other operations are marked beta.
>
> 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.

# chat MCP

> MCP chat: write to Melso's agent in the person's own Melso chat and get its answer in the same call.

Talk to Melso's agent in the person's Melso chat, as their AI; it hands the team what needs a person. Waits up to 25 s for the answer (messages), else chat\_read after=id. attachment\_ids: from gestiones upload\_complete. Reuse idempotency\_key only to retry.

**Availability:** Self-employed / Company.

Listed once a self-employed person's setup is done, as for `gestiones`. The message shows in the person's chat, marked as written by their AI.

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 it when the person wants their AI to ask Melso something or hand it work, as they would in their own Melso chat: Melso's agent answers and passes to Melso's team what needs a person. The call waits up to 25 seconds for the answer; if it is not ready, read it later with `chat_read`. Send documents with `attachment_ids` from `gestiones` `upload_complete`. Use a new `idempotency_key` for each message and reuse it only to retry the same one.

## Input

```json theme={null}
{
  "additionalProperties": false,
  "properties": {
    "attachment_ids": {
      "description": "Documents to send with the message.",
      "items": {
        "description": "An attachment UUID from gestiones upload_complete, not yet sent.",
        "type": "string"
      },
      "type": "array"
    },
    "content": {
      "description": "The message, at most 20000 characters.",
      "type": "string"
    },
    "idempotency_key": {
      "description": "Unique message key, at most 196 characters. Reuse it only to retry this message.",
      "type": "string"
    }
  },
  "required": [
    "content",
    "idempotency_key"
  ],
  "type": "object"
}
```

## Output

The message's `id`, `created_at`, `queued` and the `chat_url` where the person reads the chat. `messages` are what followed it in the chat, each with `id`, `from` (`person`, `person_ai`, `melso_agent` or `melso_team`), `text` and `created_at`. `waiting` is true while Melso's agent is still answering; then `next` says to call `chat_read` with `after` set to the message `id`.

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.

### Declared output schema

```json theme={null}
{
  "properties": {
    "chat_url": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "messages": {
      "items": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "from": {
            "enum": [
              "person",
              "person_ai",
              "melso_agent",
              "melso_team"
            ],
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "from",
          "text",
          "created_at"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "next": {
      "type": "string"
    },
    "queued": {
      "type": "boolean"
    },
    "waiting": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "messages",
    "waiting"
  ],
  "type": "object"
}
```

## Example

Use an OAuth access token issued for this MCP resource and replace the example identifiers with values from your own company.

```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": "chat",
    "arguments": {
      "content": "Example content",
      "idempotency_key": "Example idempotency key"
    }
  }
}
JSON
```


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