n8n integration
AI Context by MCP Studio is the MCP Studio community node for n8n. It gives the AI in your workflows persistent context: point it at your documentation, code repositories, PDFs, written specs, runbooks, or another MCP server, and it returns a live MCP endpoint that agents consult before they act.
| Audience | Anyone running AI agents in n8n, plus automation builders, engineering teams, and developer-experience teams |
|---|---|
| Prerequisites | An MCP Studio account, an API key, and n8n 1.x (self-hosted, or Cloud for verified community nodes) |
Why use it
An agent is only as good as what it knows when it runs. Without grounding it answers from training data plus whatever happens to be in the prompt, which is how the same agent ends up confidently wrong about your own API, your own conventions, and your own processes.
Persistent context is the alternative. You publish your sources once, and the agent reads them on every run instead of being reminded in each prompt. In n8n this matters more than anywhere else, because an agent inside a workflow acts on what it retrieves — grounding it changes what it does, not just what it says.
The node makes that context something you automate: create a server when a project starts, add and remove sources as things change, adjust which tools it exposes, refresh it the moment content ships, read its metrics, and hand the endpoint to whatever consumes it.
What you can connect
A source is anything an agent should read before answering. Documentation is the obvious one; it is not the most valuable one.
| Source | Why teams connect it |
|---|---|
| Code repositories | The agent writes code matching your real conventions and helpers instead of inventing plausible ones. Public repos work immediately; private repos need a GitHub account linked once in the dashboard |
| Written specs and runbooks | A page describing how something should be done becomes an instruction the agent follows every time, not a prompt someone has to remember to paste |
| PDFs | Contracts, policies, compliance documents, vendor manuals, exported reports — content that usually lives outside anything searchable |
| Documentation sites | Product docs, internal wikis, help centres |
| API references | The agent gets your parameters and response shapes right rather than approximating them |
| Another MCP server | Federate an existing MCP endpoint in as a source, so several context sources sit behind one URL and one credential |
| Any website | Changelogs, status pages, partner documentation, public research |
They mix freely. One server can hold a docs site, two repositories, and a PDF, and answer across all of them in a single query.
Patterns worth building
Agents that follow your conventions. Write down how you want work done — how workflows should be structured, which internal tools to call, what to never do — and connect it alongside the repositories that demonstrate it. Every AI Agent node pointed at the endpoint now works from your rules rather than generic best practice.
Internal knowledge your automations act on. Connect the runbooks, policies, and PDFs your team works from, then let a workflow answer questions, triage tickets, or draft replies against them.
A docs MCP for your product. Publish an endpoint alongside your documentation so your users' AI tools answer accurately about your product, and refresh it from CI when you ship.
Context per client or per project. Provision one server per engagement as a repeatable workflow step instead of a manual setup each time.
Observability you can route on. Read a server's metrics in a workflow and act on them: post weekly numbers to Slack, email a client their usage, or alert when the success rate drops.
How it relates to n8n's MCP Client
They sit on opposite ends of the same pipe, and most workflows end up using both.
| AI Context by MCP Studio | MCP Client tool | |
|---|---|---|
| Purpose | Builds and maintains the MCP server | Consumes an MCP server |
| Typical use | Create the context server, refresh it when content changes | Let an AI Agent query that context |
| Runs | On a schedule, webhook, or manual trigger | Inside an agent's reasoning loop |
A common pairing: this node creates the server and returns its URL, and an MCP Client tool attached to an AI Agent node queries it.
Install
In n8n, open Settings > Community nodes > Install and enter n8n-nodes-mcp-studio. On self-hosted n8n you can instead run npm install n8n-nodes-mcp-studio in ~/.n8n and restart. The node appears as AI Context by MCP Studio.
Create an API key
- In MCP Studio, go to Account > API Keys.
- Create a key and set Used from to n8n.
- Copy it immediately. Keys start with
msk_live_and are shown exactly once — only a hash is stored, so a lost key can be replaced but never recovered. - In n8n, create an AI Context by MCP Studio API credential, paste the key, and leave Base URL at its default.
- Click Test. Success returns your current plan and usage.
A key acts on your account with your plan's limits. Revoke it from the same screen if it leaks.
Operations
| Resource | Operation | What it does |
|---|---|---|
| Server | Create | Creates a server from one or more sources, queues indexing, returns the endpoint URL and a client config snippet |
| Server | Get | Returns a server with per-source indexing progress, the endpoint URL, and the config snippet |
| Server | Get Many | Lists every server on the account |
| Server | Refresh | Queues a re-index, for the whole server or a single source |
| Server | Delete | Soft-deletes a server, restorable for 7 days |
| Source | Add | Adds a source to an existing server and queues indexing |
| Source | Remove | Removes a source and its indexed content, by source ID or URL |
| Tool | Get Many | Returns the tools a server exposes today, plus the full catalogue it can choose from |
| Tool | Add | Enables more tools. Tools already enabled are left alone |
| Tool | Remove | Disables tools. At least 3 have to remain |
| Tool | Replace | Sets the exact tool list, whatever was enabled before |
| Analytics | Get | Returns one server's request metrics |
| Account | Get Usage | Returns plan, request usage, and server and source limits |
| Account | Get Entitlements | Returns trial state, analytics tier, and per-server source limits |
Every operation that takes a server accepts either its ID or its slug.
Changing tools after creation
You pick 3 to 10 tools when you create a server, and the Tool resource changes that afterwards without recreating anything. A change reaches connected agents on their next request: no re-index, and the endpoint URL does not change.
Add and Remove are both no-ops when there is nothing to do, so a workflow that enforces a standard tool set can run on a schedule without special-casing servers that already comply. Removing below 3 tools is refused and leaves the selection untouched.
See the tools reference for what each tool does.
Reading metrics in a workflow
Analytics > Get returns the metrics included on every plan, and returns the same fields at every plan level — so a workflow that routes on successRate keeps working whatever happens to the subscription.
| Field | What it tells you |
|---|---|
totalCalls, failedCalls, successRate | Whether agents are getting answers |
avgDurationMs | How fast they get them |
activeSources, citedSources | How many of your sources are actually being quoted. A source that is never cited is either badly targeted or badly written |
toolUsage | Which tools agents reach for, and how often each succeeds |
sourceUsage | Which sources answer the most questions |
clientUsage | Which clients are connecting |
callsOverTime | Daily volume and errors for the last 30 days |
Per-request detail — the exact passage returned for a given question, content gaps, source grades, and forecasts — is part of Action and Predictive analytics and is read on the dashboard rather than through the node.
A first workflow
The package ships an importable template, workflows/mcp-studio-fast-start.json, that runs the whole path: read the plan, branch if the account is at its server limit, create a server, wait, then read back the endpoint and progress.
Built by hand it is four steps:
- Account > Get Usage — confirm there is room for another server.
- Server > Create — a name, one or more sources, and between 3 and 10 tools.
- Wait, then Server > Get — poll until every source reports
crawlStatus: "complete". - Use the returned
url, or pasteconfigSnippetinto an MCP client.
What to expect
Create and Refresh return when the work is queued, not when it finishes. See Indexing for timings, status meanings, and error reasons. The short version: poll Server > Get and watch each source's crawlStatus move pending → crawling → complete, with indexing.pagesIndexed climbing while it runs.
The endpoint is queryable before indexing completes — it simply has less content to search.
Tool changes are immediate; content changes take as long as indexing takes.
Usage counts MCP requests, not node executions. Running the node does not consume request quota; querying the finished server does.
Plan limits in a workflow
Rather than letting a workflow discover a limit by failing, read it. Account > Get Usage returns serversUsed, serversLimit, mcpCallsUsed, mcpCallsLimit, and sourcesLimitPerServer, so an IF node can branch, alert, or queue for later. See Billing for what each tier includes.
The same response carries an upgradeUrl, as does every limit error, so a workflow that detects a cap can include a working link in whatever it sends rather than telling someone to go and find Billing. Source limits also return a purchaseUrl that goes straight to checkout. On the MCP call limit, which is a JSON-RPC error, the link is on error.data.upgradeUrl.
Private GitHub repositories
A private repository needs a linked GitHub account, and that link is a browser OAuth step that cannot happen over an API. Link it once in the dashboard, then add the source. Without it, adding a private repository returns 422 with auth_required, because there is no token to read the repository with.
Common errors
| Response | Meaning |
|---|---|
401 | Key is wrong, truncated on paste, or revoked |
400 Select between 3 and 10 tools | Tool count is outside the allowed range |
400 An MCP server needs at least 3 tools | A Tool > Remove would drop the server below the minimum |
400 Unknown tool name | A tool name is not in the catalogue; the response lists the valid names |
402 source_limit | More sources than the tier allows; the message states the limit |
403 enterprise_limit | Server count cap reached |
404 Server not found | Wrong ID or slug, or the server belongs to another account |
409 Source already exists | That URL is already on the server |
422 auth_required | Private GitHub repo with no linked GitHub account |
429 | Rate limited. Server creation is capped at 10 per hour |
Enable Always Output Data on a node to see the full error body rather than only the status code.