> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anysite.io/llms.txt
> Use this file to discover all available pages before exploring further.

# n8n AI Agent Integration

> Connect Anysite MCP Server to n8n AI Agents for unlimited data extraction and workflow automation

<img src="https://mintcdn.com/horizondatawave/iIhs2FDB4-ujnYka/public/images/n8n/n8n_agent.png?fit=max&auto=format&n=iIhs2FDB4-ujnYka&q=85&s=87f0965bddd36b19f6345c0a8bd6a196" alt="Anysite MCP + n8n AI Agent = Unlimited Data & Automation" width="1560" height="726" data-path="public/images/n8n/n8n_agent.png" />

## Overview

n8n AI Agents combined with Anysite MCP Server creates a powerful platform for building autonomous AI agents with unlimited access to social media data. With MCP Unlimited plan, your n8n AI Agents can extract data from LinkedIn, Instagram, Twitter, Reddit, YouTube, SEC filings, Y Combinator database, and more without any request limits - all integrated into your n8n workflows.

**Perfect for:**

* Autonomous research agents in workflows
* Lead enrichment and CRM automation
* Competitor monitoring workflows
* Multi-platform data aggregation pipelines
* Scheduled intelligence gathering with n8n cron
* AI-powered workflow automation

<Info>
  **MCP Unlimited Plan Required:** This integration requires an active MCP Unlimited subscription (\$30/month) for unlimited data extraction.
</Info>

## Download Pre-Built Workflow

<Card title="Download n8n AI Agent Workflow" icon="download" href="https://github.com/anysiteio/cookbook/blob/main/AI%20Agent%20with%20Anysite%20Unlimited%20MCP.json">
  Click to download the ready-to-use n8n AI Agent workflow with Anysite MCP integration
</Card>

**Workflow includes:**

* Pre-configured AI Agent with MCP connection
* Example prompts and use cases
* Error handling and logging
* Ready-to-customize structure

## Prerequisites

Before you begin, ensure you have:

* Self-hosted n8n instance or [n8n.cloud](https://n8n.cloud) account
* Anysite account with MCP Unlimited subscription
* Basic understanding of n8n workflows and AI Agent node

## Step 1: Get Your MCP Connection URL

First, obtain your Direct URL from the Anysite dashboard:

<Steps>
  <Step title="Log in to Anysite">
    Visit [app.anysite.io](https://app.anysite.io) and sign in to your account
  </Step>

  <Step title="Navigate to MCP Integration">
    Go to the **MCP Server Integration** section in your dashboard
  </Step>

  <Step title="Copy Direct URL">
    <img src="https://mintcdn.com/horizondatawave/WKLrMTly6uUQx_Bl/public/images/make_mcp/Screenshot8.11.27.png?fit=max&auto=format&n=WKLrMTly6uUQx_Bl&q=85&s=7bba9a17d7e21530ec0e6f6b3b20738f" alt="Anysite MCP Server Integration - Get Direct URL" width="1198" height="1026" data-path="public/images/make_mcp/Screenshot8.11.27.png" />

    You'll see two connection options:

    * **OAuth URL**: `https://mcp.anysite.io/mcp`
    * **Direct URL**: `https://mcp.anysite.io/mcp?api_key=YOUR_KEY`

    Click **Copy** next to the **Direct URL** - this includes your API key for authentication.
  </Step>
</Steps>

<Warning>
  **Security Notice:** Your Direct URL contains your API key. Keep it secure and never share it publicly or commit it to version control.
</Warning>

## Step 2: Configure MCP in n8n AI Agent

Now connect the MCP Server to your n8n AI Agent node:

<Steps>
  <Step title="Create or Open Workflow">
    Open n8n and create a new workflow or open an existing one where you want to use the AI Agent.
  </Step>

  <Step title="Add AI Agent Node">
    1. Click the **+** button to add a new node
    2. Search for **"AI Agent"** or **"@n8n/n8n-nodes-langchain.agent"**
    3. Add the AI Agent node to your canvas
  </Step>

  <Step title="Configure MCP Connection">
    <img src="https://mintcdn.com/horizondatawave/iIhs2FDB4-ujnYka/public/images/n8n/n8n_mcp.png?fit=max&auto=format&n=iIhs2FDB4-ujnYka&q=85&s=9ee719e5f1cbd93fa11fdb932958b6e0" alt="Configure MCP in n8n AI Agent" width="900" height="1030" data-path="public/images/n8n/n8n_mcp.png" />

    In the AI Agent node configuration:

    1. Go to the **Tools** section
    2. Click **Add Tool**
    3. Select **MCP Tool** from the list
    4. In the MCP Tool configuration:
       * **Server URL**: Paste your Direct URL from Step 1
         ```
         https://mcp.anysite.io/mcp?api_key=YOUR_API_KEY
         ```
       * **Name**: "Anysite MCP" (or any descriptive name)
    5. Click **Save** or **OK**
  </Step>

  <Step title="Verify Connection">
    After saving, the MCP tools should appear in your AI Agent's available tools list. You can verify by:

    * Looking at the Tools section - should show "5 tools available"
    * Testing with a simple prompt in n8n's test mode
  </Step>
</Steps>

<Check>
  **Connection successful!** Your n8n AI Agent can now use Anysite MCP tools to extract data from any supported platform within your workflows.
</Check>

## Step 3: Configure Agent Behavior

After connecting MCP, configure your AI Agent to use it effectively:

### System Prompt Example

```
You are an AI research agent integrated into an n8n workflow with access to Anysite MCP tools.
Use these tools to extract data from LinkedIn, Instagram, Twitter, Reddit, YouTube, SEC, and Y Combinator.

When the user requests information:
1. Identify the appropriate MCP tool(s) to use
2. Extract the data using the tools
3. Analyze and structure the information
4. Return JSON-formatted results for the workflow

Available platforms: LinkedIn, Instagram, Twitter, Reddit, YouTube, SEC EDGAR, Y Combinator, Web Parser

Always provide accurate, well-structured data that can be processed by subsequent workflow nodes.
```

### Available Tools

Your n8n AI Agent now has access to 70+ tools including:

**LinkedIn (27 tools)**

* Profile extraction and search
* Company research and employee data
* Post and comment analysis
* LinkedIn messaging and chat
* Job listings and groups

**Instagram (8 tools)**

* Profile data and metrics
* Posts and reels extraction
* Comments and likes analysis
* Follower/following data

**Twitter/X (5 tools)**

* Profile information
* Tweet extraction and search
* User discovery

**Reddit (5 tools)**

* Post details and search
* Comments extraction
* User posts and comments

**YouTube (5 tools)**

* Video search and metadata
* Channel videos extraction
* Video details and engagement
* Video comments analysis
* Subtitle/transcript extraction

**Y Combinator (3 tools)**

* Company profiles by slug
* Search YC companies
* Search YC founders

**SEC (2 tools)**

* Search SEC EDGAR filings
* Retrieve SEC documents

**Web Tools (3 tools)**

* Webpage parsing
* Sitemap extraction
* Web search

<Card title="View All Tools" icon="toolbox" href="/mcp-server/tools">
  Browse complete list of all 115+ available MCP endpoints
</Card>

## Use Cases & Examples

### 1. Lead Enrichment Workflow

**n8n Workflow:**

```
Webhook → AI Agent (MCP) → Enrich Contact → Save to CRM
```

**Agent Prompt:**

```
"Research {{$json.email}} on LinkedIn. Find their profile, current company,
job title, and recent activity. Return structured JSON."
```

**What the agent does:**

1. Uses `find_linkedin_user_email` to find profile
2. Uses `get_linkedin_profile` to extract details
3. Uses `get_linkedin_user_posts` for activity
4. Returns structured JSON to workflow

**Workflow Output:**

* Enriched contact data flows to next node
* Automatic CRM update
* Email personalization data ready

### 2. Competitor Monitoring Workflow

**n8n Workflow:**

```
Schedule (Daily) → AI Agent (MCP) → Format Report → Send to Slack
```

**Agent Prompt:**

```
"Monitor competitor 'TechCorp' on LinkedIn:
- Get last 7 days of posts
- Extract engagement metrics
- Identify trending topics
Return JSON with summary."
```

**Tools used:**

* `search_linkedin_companies` to find company
* `get_linkedin_company_posts` for recent posts
* Agent analyzes and structures findings

**Automation:**

* Runs daily at 9 AM
* Automatic Slack notification
* No manual intervention needed

### 3. Multi-Platform Research Pipeline

**n8n Workflow:**

```
Manual Trigger → AI Agent (MCP) → Split Data → Parallel Processing → Merge Results → Output
```

**Agent Prompt:**

```
"Find all mentions of 'AI automation tools' across:
- LinkedIn (posts from last week)
- Twitter (tweets from last week)
- Reddit (discussions from last month)
- YouTube (videos from last 3 months)

Analyze sentiment and provide summary."
```

**Tools used:**

* `search_linkedin_posts`
* `search_twitter_posts`
* `search_reddit_posts`
* `search_youtube_videos`
* Agent synthesizes multi-platform insights

### 4. SEC Financial Intelligence Workflow

**n8n Workflow:**

```
HTTP Request → AI Agent (MCP) → Extract Financial Data → Store in Database
```

**Agent Prompt:**

```
"Get latest 10-K and 10-Q filings for {{$json.company_name}}.
Extract key financial metrics, risk factors, and MD&A summary."
```

**Tools used:**

* `search_sec_companies` to find filings
* `get_sec_document` to retrieve full document
* Agent parses and extracts structured data

**Use case:** Automated financial due diligence pipeline

### 5. Y Combinator Startup Research

**n8n Workflow:**

```
Airtable Trigger → AI Agent (MCP) → YC Research → Update Airtable
```

**Agent Prompt:**

```
"Research YC company {{$json.slug}}:
- Get company profile
- Find founders and backgrounds
- Identify batch and status
Return structured data for database."
```

**Tools used:**

* `get_yc_company` for company profile
* `search_yc_founders` for team data
* Structured output for Airtable update

## Integration with n8n Workflows

### Basic Workflow Structure

**Typical n8n workflow with AI Agent:**

1. **Trigger** - Webhook, Schedule, or Manual trigger
2. **AI Agent** - Processes request using MCP tools
3. **Process Results** - Code or Set node to structure data
4. **Output** - Send to CRM, Database, Slack, or Email

### Multi-Agent Setup

For complex workflows, use multiple AI Agents:

* **Research Agent** - Gathers data using MCP tools
* **Analysis Agent** - Processes and analyzes the data
* **Merge & Report** - Combines insights and generates output

### Error Handling

Implement robust error handling:

* Use **IF node** after AI Agent to check success
* Create separate paths for success and error cases
* Log errors to database or send notifications
* Implement retry logic for failed operations

## n8n-Specific Features

### 1. Expression Integration

Access AI Agent results in n8n expressions:

```javascript theme={null}
// Get data from previous AI Agent node
{{ $json.research_results }}

// Access specific fields
{{ $json.linkedin_profile.name }}
{{ $json.company_data.employee_count }}
```

### 2. Loop Through Results

Process multiple items with AI Agent using n8n's loop functionality:

1. **Split In Batches** - Divide input data into manageable chunks
2. **AI Agent** - Process each item with MCP tools
3. **Aggregate Results** - Combine all processed data

### 3. Conditional Tool Usage

```javascript theme={null}
// In AI Agent system prompt
"If the request is about LinkedIn, use linkedin_* tools.
If it's about SEC filings, use search_sec_companies and get_sec_document.
If it's about YouTube, use youtube_* tools.
Always choose the most appropriate tool for the data source."
```

### 4. JSON Output for Workflow

Configure your agent to return structured JSON:

```
"Return your findings as JSON with this structure:
{
  'summary': 'Brief overview',
  'data': { extracted data },
  'sources': ['tool1', 'tool2'],
  'timestamp': 'ISO format'
}
"
```

This makes it easy to process results in subsequent n8n nodes.

## Workflow Templates

### Lead Enrichment Pipeline

**Download:** Use the workflow from the link above

**Flow:**

1. **Webhook** - Receives email/name/company
2. **AI Agent (MCP)** - Enriches with LinkedIn data
3. **Code Node** - Structures and validates data
4. **HubSpot/Salesforce** - Updates CRM
5. **Slack** - Notifies team

### Daily Competitor Report

**Trigger:** Schedule node (daily 9 AM)
**AI Agent Prompt:**

```
"Monitor these 3 competitors on LinkedIn:
- Company A
- Company B
- Company C

For each, get:
- Last 5 posts
- Engagement metrics
- Employee growth trends

Return JSON report."
```

**Output:** Formatted email with insights

### Social Media Intelligence

**Trigger:** Manual trigger
**AI Agent Prompt:**

```
"Research {{$json.topic}} across all platforms:
- LinkedIn posts (last week)
- Twitter mentions (last week)
- Reddit discussions (last month)
- YouTube videos (last 3 months)

Analyze sentiment and trends."
```

**Output:** Comprehensive multi-platform report

## Troubleshooting

<AccordionGroup>
  <Accordion title="MCP tools not available in AI Agent">
    **Possible causes:**

    * MCP Server URL not configured correctly
    * MCP Unlimited plan not active
    * n8n AI Agent node version too old

    **Solutions:**

    * Verify Direct URL includes `?api_key=YOUR_KEY` parameter
    * Check MCP Unlimited subscription at [app.anysite.io](https://app.anysite.io)
    * Update n8n to latest version (MCP support added in recent releases)
    * Test MCP connection outside AI Agent first
  </Accordion>

  <Accordion title="Connection fails or times out">
    **Possible causes:**

    * Invalid or expired API key
    * Network connectivity issues from n8n instance
    * Firewall blocking MCP server

    **Solutions:**

    * Regenerate Direct URL from Anysite dashboard
    * Check n8n instance can reach `mcp.anysite.io`
    * Verify no firewall rules blocking outbound HTTPS
    * Test with curl from n8n server: `curl https://mcp.anysite.io/mcp?api_key=YOUR_KEY`
  </Accordion>

  <Accordion title="Agent doesn't use MCP tools">
    **Possible causes:**

    * System prompt doesn't mention tools
    * Agent not configured to use tools
    * Tool permissions not set

    **Solutions:**

    * Update system prompt to explicitly mention MCP tools
    * Ensure "Allow Agent to use tools" is enabled in node settings
    * Test with direct tool invocation: "Use get\_linkedin\_profile tool for..."
    * Check n8n AI Agent configuration has tools enabled
  </Accordion>

  <Accordion title="Rate limits or quota errors">
    **Note:** With MCP Unlimited, you should have no rate limits for MCP requests.

    **If you see errors:**

    * Verify you're on MCP Unlimited plan (not pay-per-use)
    * Check subscription status in Anysite dashboard
    * Direct API calls (outside MCP) are billed separately
    * Contact support if issues persist
  </Accordion>

  <Accordion title="Workflow execution fails">
    **Common issues:**

    * Agent response too large for n8n memory
    * Timeout on long-running research
    * JSON parsing errors

    **Solutions:**

    * Limit data extraction in agent prompt (e.g., "Get last 10 posts, not 100")
    * Increase timeout in AI Agent node settings
    * Use n8n Code node to validate and clean JSON output
    * Split large research into multiple agent calls
  </Accordion>
</AccordionGroup>

## Security Best Practices

<CardGroup cols={2}>
  <Card title="Protect API Keys" icon="key">
    Never expose your Direct URL in:

    * Shared workflows (export anonymized versions)
    * Public n8n templates
    * Screenshots or documentation
    * Version control systems

    Use n8n credentials store for sensitive data.
  </Card>

  <Card title="Agent Access Control" icon="shield-halved">
    Limit agent permissions:

    * Only enable necessary tools
    * Use separate API keys for different workflows
    * Monitor execution logs in n8n
    * Set up error notifications
  </Card>

  <Card title="Data Privacy" icon="user-lock">
    Handle extracted data responsibly:

    * Follow GDPR and data protection laws
    * Don't store sensitive data unnecessarily
    * Implement data retention policies in workflows
    * Respect platform terms of service
  </Card>

  <Card title="Monitor Usage" icon="chart-line">
    Track your workflow activity:

    * Review n8n execution logs regularly
    * Check Anysite dashboard for usage patterns
    * Set up n8n error workflows
    * Monitor API response times
  </Card>
</CardGroup>

## Benefits of n8n + MCP Integration

<CardGroup cols={2}>
  <Card title="Unlimited Data Access" icon="infinity">
    With MCP Unlimited (\$30/month), extract as much data as you need without worrying about request limits or overage charges.
  </Card>

  <Card title="Workflow Automation" icon="diagram-project">
    Integrate AI intelligence directly into your automation workflows. Combine data extraction with processing, storage, and notifications.
  </Card>

  <Card title="Multi-Platform Intelligence" icon="globe">
    Single AI Agent can access LinkedIn, Instagram, Twitter, Reddit, YouTube, SEC, YC, and web data - unified intelligence gathering in one workflow.
  </Card>

  <Card title="Self-Hosted Control" icon="server">
    Run n8n on your infrastructure with full control over data, security, and compliance while accessing unlimited external data via MCP.
  </Card>

  <Card title="Open Source Flexibility" icon="code">
    n8n's open-source nature allows complete customization of workflows, data processing, and integration patterns.
  </Card>

  <Card title="Visual Workflow Builder" icon="sitemap">
    Build complex AI-powered workflows visually without coding. Connect MCP intelligence to 400+ n8n integrations.
  </Card>
</CardGroup>

## Advanced Integration Patterns

### 1. Multi-Agent Research Pipeline

Use multiple AI Agents in sequence, each specialized:

```
Trigger
  → Agent 1: LinkedIn Research (MCP)
  → Agent 2: Twitter Sentiment (MCP)
  → Agent 3: Synthesis & Analysis
  → Send Report
```

Each agent focuses on specific platform, final agent combines insights.

### 2. Conditional Data Enrichment

```
Input Data
  → IF node (has LinkedIn URL?)
      → Yes: AI Agent extracts LinkedIn data
      → No: AI Agent searches by email/name
  → Merge results
  → Continue workflow
```

### 3. Feedback Loop with Memory

```
Get Task
  → AI Agent (MCP): Initial Research
  → Store in n8n Database
  → IF: Need more data?
      → Yes: AI Agent (MCP): Deep Dive
      → Loop back
  → Final Output
```

Agent uses MCP tools iteratively until satisfied with data quality.

### 4. Real-Time Monitoring

```
Schedule (Every hour)
  → AI Agent: Check for new posts/filings
  → IF: Found new content?
      → Process and alert
      → Update tracking database
  → Sleep until next run
```

## n8n Workflow Best Practices

<Accordion title="Optimize Agent Prompts for n8n">
  **Do:**

  * Request JSON output format for easy processing
  * Specify exact field names needed downstream
  * Set clear data limits (e.g., "Get 10 posts, not all")
  * Include error handling instructions

  **Example:**

  ```
  "Search LinkedIn for 'data engineers' in Berlin.
  Return JSON array with exactly these fields:
  - name, title, company, profile_url
  Limit to 20 results."
  ```
</Accordion>

<Accordion title="Handle Large Datasets">
  **Strategies:**

  * Use pagination in agent prompts
  * Split large extractions into multiple agent calls
  * Process results in batches using Loop node
  * Store intermediate results in n8n database
  * Use n8n's SplitInBatches node for chunking
</Accordion>

<Accordion title="Error Recovery">
  **Implement retry logic:**

  * Wrap AI Agent in Error Trigger node
  * Retry failed executions automatically
  * Log errors to database/Slack
  * Fallback to manual review queue
  * Use n8n's built-in error workflows
</Accordion>

<Accordion title="Performance Optimization">
  **Tips:**

  * Cache frequently accessed data in n8n variables
  * Use AI Agent for intelligence, not simple lookups
  * Parallel execution for independent research tasks
  * Optimize MCP tool timeouts (default 300s often enough)
  * Use n8n Queue mode for high-volume processing
</Accordion>

## Next Steps

<CardGroup cols={2}>
  <Card title="Download Workflow Template" icon="download" href="https://github.com/anysiteio/cookbook/blob/main/AI%20Agent%20with%20Anysite%20Unlimited%20MCP.json">
    Get the pre-built n8n workflow to start immediately
  </Card>

  <Card title="View All MCP Tools" icon="toolbox" href="/mcp-server/tools">
    Explore the complete list of 70+ tools available for your agents
  </Card>

  <Card title="MCP Unlimited Plan" icon="infinity" href="/mcp-server/unlimited-plan">
    Learn more about MCP Unlimited benefits and pricing
  </Card>

  <Card title="Dashboard" icon="gauge" href="https://app.anysite.io">
    Manage your subscription and monitor usage
  </Card>

  <Card title="n8n Documentation" icon="book" href="https://docs.n8n.io">
    Learn more about n8n workflow automation
  </Card>

  <Card title="n8n Community" icon="users" href="https://community.n8n.io">
    Join n8n community for workflow ideas and support
  </Card>
</CardGroup>

## Support

Need help with n8n + MCP integration?

<CardGroup cols={2}>
  <Card title="Email Support" icon="envelope" href="mailto:support@anysite.io">
    Get technical assistance from our team
  </Card>

  <Card title="MCP Documentation" icon="book" href="/mcp-server/tools">
    Browse complete MCP documentation
  </Card>

  <Card title="n8n Nodes" icon="plug" href="/n8n-nodes/installation">
    Also check our n8n community nodes for direct API integration
  </Card>

  <Card title="GitHub" icon="github" href="https://github.com/anysiteio">
    Access workflow templates and examples
  </Card>
</CardGroup>

***

<Info>
  **Ready to supercharge your n8n workflows?** Connect Anysite MCP to your AI Agents and unlock unlimited data extraction with the power of automation!
</Info>
