# n8n

Source: https://smartpdf.ru/en/developers/docs/n8n

## Agent in n8n — the MCP Client Tool node

1. Add the **MCP Client Tool** tool to the **AI Agent** node.
2. **Endpoint** — `https://mcp.smartpdf.ru/mcp`, **Server Transport** — HTTP Streamable.
3. **Authentication** — Bearer Auth; put only the `sk_live_…` key in the credentials — n8n adds the word `Bearer` itself.
4. Select the SmartPDF tools the agent needs.

For a regular workflow step without an agent, there’s the **MCP Client** node with the same settings.

## Without an agent — HTTP Request

Fixed workflows are more reliable when built on the REST API with **HTTP Request** nodes:

1. `POST https://api.smartpdf.ru/v1/upload` — Form-Data body, field `file` with the binary data; `X-API-Key` header.
2. `POST https://api.smartpdf.ru/v1/pdf/<operation>` — JSON with the `file_id` from step 1.
3. Waiting: a loop with **Wait** and `GET https://api.smartpdf.ru/v1/tasks/{task_id}` until the status is `done` — or a [webhook](https://smartpdf.ru/en/developers/docs/webhooks) to a **Webhook** node.
4. `GET https://api.smartpdf.ru/v1/tasks/{task_id}/download` and download `download_url`.

Operation parameters are in the [Operations](https://smartpdf.ru/en/developers/docs/operations) section.
