Connect CNAPS.ai to n8n — MCP Integration Guide

Connect CNAPS.ai to n8n — MCP Integration Guide

CNAPS.ai exposes its entire platform as an MCP server. Point an n8n AI Agent at it and the agent can pick models, upload files, build flows, and run them — all from a single chat message, with no glue code.

This tutorial builds a working example end to end. When you finish, you'll be able to type this into an n8n chat window:

Upscale this image 4x: https://picsum.photos/id/237/320/240.jpg

and get back a finished, upscaled image.

image

Time required: about 10 minutes.

What you'll build

Four nodes:

Node
Role
When chat message received
Chat trigger — gives you a test chat window inside n8n
AI Agent
Decides what to do and which tools to call
Anthropic Chat Model (or OpenAI)
The reasoning model behind the agent
MCP Client Tool
The connection to CNAPS.ai
image

Before you start

1. A CNAPS.ai API key. Create one at cnaps.ai under API Key.

2. An LLM API key for the agent's reasoning model — an Anthropic key for Claude, or an OpenAI key.

n8n's free trial AI credits only cover OpenAI (they appear as a separate n8n free OpenAI credits credential type). To use Claude, bring your own Anthropic key.

3. n8n 1.104.0 or later. The MCP Client Tool node needs a Server Transport parameter, which arrived in that release. Open the node and look: if you only see a field named SSE Endpoint and no transport selector, your n8n is too old to connect to CNAPS.ai — upgrade first. The CNAPS.ai MCP server speaks streamable HTTP only and has no SSE endpoint, so there is nothing for an SSE-only node to connect to.

We tested this tutorial on n8n Cloud 2.34.4.

Step 1 — Create the workflow and add a chat trigger

Create a new workflow, then click Add first step.

Search for chat.

Search for chat, not chat message. Searching chat message returns only community nodes and you'll think the trigger is missing.

Pick Chat ("Runs the workflow when an n8n generated webchat is submitted"), then On new Chat event.

The node lands on the canvas labelled When chat message received, and a Chat panel opens at the bottom of the screen. That panel is how you'll test.

Step 2 — Add the AI Agent

Click the + on the right edge of the trigger, search AI Agent, and add the first result.

The agent node has three sub-connectors underneath it: Chat Model, Memory, and Tool. You'll use the first and the third.

Step 3 — Connect a chat model

Click the + under Chat Model.

Using Claude

Search Anthropic and add Anthropic Chat Model. The default model works well for this — leave it as is.

Click Set up credential and paste your Anthropic API key.

Set Allowed HTTP Request Domains to api.anthropic.com. It defaults to All, which lets any node using this credential send your key to any domain. Then save.

image

Using OpenAI

Click the + under Chat Model, choose OpenAI, and either use n8n's free trial credits or your own key.

Step 4 — Add the MCP Client Tool

Click the + under Tool, search MCP Client, and add MCP Client Tool.

Configure it exactly like this:

Endpoint:            https://mcp.cnaps.ai/mcp
Server Transport:    HTTP Streamable
Authentication:      Header Auth
Tools to Include:    Selected

Two things people get wrong here:

  • The field is just Endpoint. There's only one URL field. Server Transport should already read HTTP Streamable — confirm it does before moving on.
  • Use Header Auth, not Bearer Auth. The dropdown offers five options. CNAPS.ai API keys authenticate through a header. If you put your key in Bearer Auth you get 401 invalid token, because Bearer is reserved for OAuth tokens.

Create the credential

Click Set up credential and fill in:

Field
Value
Name
x-api-key
Value
your CNAPS.ai API key (cnaps_...)
Allowed HTTP Request Domains
mcp.cnaps.ai
image

Save. Again — narrow Allowed HTTP Request Domains from its All default. It costs one click and limits where this key can ever be sent.

Step 5 — Select your tools

Setting Tools to Include to Selected reveals a second Tools to Include dropdown. Click it.

If the tool list loads, you're connected. You'll see the full CNAPS.ai tool catalog in alphabetical order, from cancel_flow to upload_file — 33 tools at the time of writing.

image

For this tutorial, check four:

  • suggest_flow — recommends which model(s) fit a request
  • upload_file — registers an image, video, or audio file
  • create_flow — builds the flow
  • get_flow — reads status and results
image
Clear the search box between selections. The filter text stays in the box after you pick a tool. If you type the next tool name without clearing it you end up searching for get_flowupload_file and get "No matching data" — which looks like a connection failure but isn't.

Your node should now look like this:

image

Step 6 — Test it

Save the workflow. In the Chat panel at the bottom, send:

Upscale this image 4x: https://picsum.photos/id/237/320/240.jpg
Use an image host that allows hotlinking. Some hosts — Wikimedia Commons among them — block non-browser user agents and return HTTP 403, which surfaces as an upload_file failure.

Watch the Logs panel. You should see the agent loop: a model call, then MCP tool calls, then more model calls. Ours made four tool calls and finished in about 40 seconds using roughly 17k tokens.

The reply includes a download URL and a link to open the generated flow in CNAPS Studio:

Input (320x240)

image

Output (1280x960)

image
image

What just happened

The agent wasn't following a script. Given one sentence, it worked out the whole sequence itself:

  1. suggest_flow — asked CNAPS.ai which model suits "upscale 4x" and got back PiSA-SR, a super-resolution model
  1. upload_file — registered the image URL with CNAPS.ai
  2. create_flow — built a three-node flow: Image Loader → PiSA-SR (ratio 4) → Image Viewer
  3. get_flow — polled until the run completed, then returned the output URL

Open the Studio link from the reply and you can see, edit, and re-run that flow like any other:

image

This is the point of the integration. You don't wire up a node per model. You describe the outcome, and the agent assembles the pipeline from the CNAPS.ai catalog.

Keep Tools to Include on Selected

An AI Agent calls tools based on text it reads. If that text can come from anywhere you don't fully control — a user message, a fetched web page, a file, an email body — then any tool you expose is a tool an attacker can try to trigger.

Setting Tools to Include to All puts every tool in that blast radius, including destructive ones like delete_flow and cancel_flow. It also makes the agent slower and less accurate: 33 tool descriptions is a lot of context to weigh for a task that needs four.

Grant only the tools the workflow actually needs. For the workflow in this tutorial, that's four.

Troubleshooting

Symptom
Cause
Fix
Tool list is empty, or the node won't connect
Server Transport set to SSE
Change it to HTTP Streamable
401 invalid token
API key entered under Bearer Auth
Use Header Auth with header name x-api-key
No Server Transport parameter on the node
n8n too old
Upgrade n8n (2.34.4 or later)
"No matching data" when searching tools
Leftover filter text in the search box
Clear the box, then type the next tool name
No results when searching for the chat trigger
Searched chat message
Search chat
upload_file fails with HTTP 403
Image host blocks bot user agents
Use a host that permits hotlinking
Invalid session ID
Client isn't preserving the MCP session header
Use the official MCP Client Tool node; a hand-rolled HTTP Request node must echo Mcp-Session-Id
Community MCP node not selectable as an agent tool
Self-hosted environment variable
Set N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true

Server reference

Endpoint
https://mcp.cnaps.ai/mcp
Transport
Streamable HTTP (no SSE endpoint)
Protocol
MCP 2025-06-18; 2024-11-05 also accepted
Auth
x-api-key header (case-insensitive), or OAuth 2.1
Sessions
Stateful — clients must preserve Mcp-Session-Id

API keys are created and revoked in the CNAPS.ai dashboard under API Key — not through MCP.

OAuth 2.1

The server supports OAuth 2.1 with dynamic client registration and PKCE (S256), advertised at /.well-known/oauth-protected-resource. The MCP Client Tool node's MCP OAuth2 authentication option uses it. This avoids pasting a long-lived key into a credential, at the cost of a more involved setup.

Available scopes: models:read, flows:read, flows:write, files:write, batches:read, batches:write, workspace:read, community:write.

Tool catalog - All 33 tools

Flowscreate_flow, get_flow, update_flow, delete_flow, duplicate_flow, restore_flow, list_flows, preview_flow, optimize_flow, suggest_flow, run_flow, cancel_flow

Batchesrun_batch, get_batch_status

Modelslist_models, get_model, get_model_parameters, find_compatible_models, list_llm_providers

Filesupload_file

Templates & communitylist_templates, fork_template, search_community, get_community_post, create_community_post, fork_community_flow

Account & workspaceget_me, get_workspace_info, get_usage, get_notifications, mark_notifications_read

Supportdiagnose_error, report_issue

Next steps

  • Swap suggest_flow for list_models or find_compatible_models if you want the agent choosing from a narrower set
  • Add run_batch and get_batch_status to process many files in one run
  • Replace the chat trigger with a webhook, schedule, or form trigger to run the same pipeline unattended
  • Add a Memory node to the agent so it can refine results across turns ("now sharpen it a bit more")

For the full tool reference and example recipes, see the CNAPS.ai MCP Server — User Guide — or connect the same server to Claude directly.