# Use Wavegrain from n8n

> Connect n8n's MCP Client Tool and MCP Client nodes to Wavegrain with an access key, and import a weekly planning workflow.

> Index of these docs: https://wavegrain.com/developers/llms.txt

n8n has two nodes that call an MCP server such as Wavegrain:

| Node | What it does | Needs a model |
| --- | --- | --- |
| **MCP Client Tool** | Gives an AI Agent node the Wavegrain tools; the model decides which to call. | Yes |
| **MCP Client** | Calls one named Wavegrain tool with fixed inputs, like any other node. | No |

This is the other direction from n8n's own "instance-level MCP", which lets AI apps call your n8n workflows.

We tested both nodes on n8n 2.44.7 against a local Wavegrain: they listed slideshows with `list_slideshows` and priced a slideshow with `estimate_cost`, which spends nothing.

## The rule: a workflow never approves or posts

An n8n workflow makes drafts and Calendar slots.
You approve each post in Wavegrain, and Wavegrain posts it.
Give the workflow's key only the permissions it needs, never more, and limit the node to the tools the workflow uses.

## 1. Make an access key

In Wavegrain, open Settings and find Connect an AI agent.
Make a key named "n8n" with:

- `read` to look at brands, slideshows and the Calendar;
- `write` only if the workflow puts slideshows on the Calendar;
- `generate` only if it makes slideshows, with a daily credit limit you are happy to spend.

## 2. Add the credential in n8n

Create a **Bearer Auth** credential and paste the key as the token.

## 3. Configure the MCP Client Tool node

Add an **AI Agent** node, attach a chat model, then attach an **MCP Client Tool** node:

| Field | Value |
| --- | --- |
| Endpoint | `https://wavegrain.com/api/mcp` |
| Server Transport | HTTP Streamable |
| Authentication | Bearer Auth, with the credential from step 2 |
| Tools to Include | Selected, then tick only the tools the workflow needs |
| Options, Timeout | 120000 (generation calls can take a minute) |

n8n names each tool after the node, so a node named "Wavegrain" gives the model `Wavegrain_list_slideshows` and so on.

To call one tool without a model, use the **MCP Client** node instead: the same endpoint, transport and credential, then pick the tool (for example `estimate_cost`) and give its input as JSON, such as `{"slideCount": 6}`.
Its output holds the tool's answer in `structuredContent`.

## 4. Import the weekly plan workflow

[Download the example workflow](/developers/n8n-weekly-plan.json) and import it in n8n (Workflows, Import from File).

Every Monday at 09:00 it asks Claude to plan five slideshows for one brand: it reads the brand brief and the Calendar, prices the work with `estimate_cost`, makes the slideshows with `generate_slideshow` within a credit limit, and puts them on the Calendar with `schedule_slideshow`.
You open Wavegrain, look at the week, and approve the posts you want.

After importing:

1. Put your brand's name in the agent's prompt, and your time zone.
2. Pick your Bearer Auth credential on the Wavegrain node, and an Anthropic credential on the Claude node.
3. If your Wavegrain address is not `https://wavegrain.com`, change the endpoint.
4. Run it once by hand and check the Calendar in Wavegrain.

The node lists only the ten tools the plan needs.
It has no tool that approves, and the key has no permission to approve.

## Troubleshooting

| Symptom | Cause |
| --- | --- |
| `401` | The key is wrong, revoked or expired, or the credential is not Bearer Auth. |
| `403` with `insufficient_scope` | The key lacks the permission the tool needs. Each tool's description names it. |
| `406` | A proxy changed the `Accept` header; the server needs `application/json, text/event-stream`. |
| A tool answers with a sentence and `isError` | Wavegrain refused, for example over `maxCredits`. The sentence says what to change. |
| A self-hosted n8n in Docker cannot reach a local Wavegrain | Use `http://host.docker.internal:<port>/api/mcp`, not `localhost`. |
