ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Document n8n Workflows with Claude Code MCP
Tutorial

How to Document n8n Workflows with Claude Code MCP

Auto-generate documentation for n8n workflows using Claude Code MCP. Extract nodes, connections, and produce readable docs.

Get Free API KeyAPI Docs

Large n8n workflows become unmaintainable without documentation, but nobody documents them manually. This tutorial uses Claude Code with search MCP to parse n8n JSON exports, look up node documentation online, and generate human-readable workflow docs automatically. Each doc lookup costs $0.005.

Prerequisites

  • Claude Code installed
  • Scavio MCP configured in .mcp.json
  • n8n workflow JSON export
  • Node.js 18+ or Python 3.8+

Walkthrough

Step 1: Export and parse n8n workflow JSON

Export a workflow from n8n and parse its node structure.

Python
import json, os, requests

API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}

# Load exported n8n workflow
with open('workflow.json', 'r') as f:
    workflow = json.load(f)

nodes = workflow.get('nodes', [])
connections = workflow.get('connections', {})

print(f'Workflow: {workflow.get("name", "Untitled")}')
print(f'Nodes: {len(nodes)}')
print(f'Connections: {sum(len(v) for v in connections.values())}')
print(f'\nNode types:')
for node in nodes:
    ntype = node.get('type', 'unknown')
    name = node.get('name', 'unnamed')
    print(f'  [{ntype}] {name}')

Step 2: Look up node documentation via search

Search for documentation of each unique node type to enrich the docs.

Python
def lookup_node_docs(node_type):
    """Search for n8n node documentation."""
    query = f'n8n {node_type} node documentation site:docs.n8n.io'
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': query, 'country_code': 'us', 'num_results': 3}).json()
    results = data.get('organic_results', [])
    if results:
        return {'url': results[0].get('link', ''), 'description': results[0].get('snippet', '')[:150]}
    return {'url': '', 'description': 'No docs found'}

# Look up unique node types
node_types = list(set(n.get('type', '') for n in nodes))
node_docs = {}
for ntype in node_types:
    node_docs[ntype] = lookup_node_docs(ntype)
    print(f'{ntype}: {node_docs[ntype]["description"][:60]}...')
print(f'\nLookup cost: ${len(node_types) * 0.005:.3f}')

Step 3: Generate workflow documentation

Combine parsed structure and node docs into a readable document.

Python
def generate_docs(workflow, node_docs):
    nodes = workflow.get('nodes', [])
    connections = workflow.get('connections', {})
    doc = []
    doc.append(f'# {workflow.get("name", "Untitled Workflow")}')
    doc.append(f'\nGenerated: 2026-05-20')
    doc.append(f'Nodes: {len(nodes)} | Connections: {sum(len(v) for v in connections.values())}')
    doc.append(f'\n## Node Overview')
    for i, node in enumerate(nodes, 1):
        ntype = node.get('type', 'unknown')
        name = node.get('name', 'unnamed')
        docs = node_docs.get(ntype, {})
        doc.append(f'\n### {i}. {name}')
        doc.append(f'- Type: {ntype}')
        doc.append(f'- Purpose: {docs.get("description", "N/A")}')
        if docs.get('url'):
            doc.append(f'- Docs: {docs["url"]}')
        params = node.get('parameters', {})
        if params:
            doc.append(f'- Parameters: {json.dumps(params)[:100]}')
    doc.append(f'\n## Data Flow')
    for source, targets in connections.items():
        for target_group in targets.get('main', [[]]):
            for target in target_group:
                doc.append(f'  {source} -> {target.get("node", "?")}')
    output = '\n'.join(doc)
    print(output[:500])
    return output

docs = generate_docs(workflow, node_docs)
with open('workflow_docs.md', 'w') as f:
    f.write(docs)
print(f'\nDocs written to workflow_docs.md ({len(docs)} chars)')

Python Example

Python
import os, requests, json
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

def doc_node(node_type):
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': f'n8n {node_type} docs site:docs.n8n.io', 'country_code': 'us'}).json()
    r = data.get('organic_results', [{}])[0]
    return f'{r.get("title", "N/A")}: {r.get("snippet", "")[:80]}'

for ntype in ['n8n-nodes-base.httpRequest', 'n8n-nodes-base.if']:
    print(f'{ntype}: {doc_node(ntype)}')
print('Cost: $0.010')

JavaScript Example

JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
async function docNode(nodeType) {
  const data = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: SH,
    body: JSON.stringify({ query: `n8n ${nodeType} docs site:docs.n8n.io`, country_code: 'us' })
  }).then(r => r.json());
  const r = (data.organic_results || [])[0] || {};
  return `${r.title || 'N/A'}: ${(r.snippet || '').slice(0, 80)}`;
}
console.log(await docNode('n8n-nodes-base.httpRequest'));

Expected Output

JSON
Workflow: Lead Enrichment Pipeline
Nodes: 8
Connections: 7

Node types:
  [n8n-nodes-base.httpRequest] Fetch Company Data
  [n8n-nodes-base.if] Check Email Valid
  [n8n-nodes-base.set] Format Output

n8n-nodes-base.httpRequest: Make HTTP requests to any API or web...
n8n-nodes-base.if: Route items based on comparison operatio...

Lookup cost: $0.040

Docs written to workflow_docs.md (2340 chars)

Related Tutorials

  • How to Build an n8n Search Workflow with Scavio
  • How to Connect n8n to Scavio via MCP
  • How to Build an n8n LLM Research Pipeline with Search and Extract

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Claude Code installed. Scavio MCP configured in .mcp.json. n8n workflow JSON export. Node.js 18+ or Python 3.8+. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Comparison

n8n vs Claude Code skill

Read more
Best Of

Best Search API for Claude Code in 2026

Read more
Use Case

n8n Search Enrichment Workflow

Read more
Best Of

Best SEO Tools for Claude Code in 2026

Read more
Glossary

n8n Flow Documentation

Read more
Comparison

Perplexity Pro CLI (via Comet + MCP) vs Claude Code

Read more

Start Building

Auto-generate documentation for n8n workflows using Claude Code MCP. Extract nodes, connections, and produce readable docs.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy