> ## 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 MCP Tool Examples

> Real-world workflow examples using Anysite MCP in n8n

## Overview

These examples demonstrate how to use the Anysite MCP Tool in n8n workflows to extract and process social media data.

## Example 1: LinkedIn Profile Enrichment

Automatically enrich contact data with LinkedIn profile information.

### Workflow Structure

```mermaid theme={null}
graph LR
    A[Webhook Trigger] --> B[MCP Client]
    B --> C[AI Agent]
    C --> D[Process Data]
    D --> E[Store in Database]
```

### Configuration

<Steps>
  <Step title="Setup Webhook Trigger">
    Configure a webhook that accepts LinkedIn profile URLs:

    ```json theme={null}
    {
      "linkedin_url": "https://linkedin.com/in/username"
    }
    ```
  </Step>

  <Step title="Configure MCP Client">
    * Add MCP Client node
    * Set endpoint to your Anysite Direct URL
    * Include `linkedin_user` tool
  </Step>

  <Step title="Add AI Agent Node">
    Configure the AI agent to use the MCP tool:

    ```
    Extract detailed profile information from: {{ $json.linkedin_url }}

    Use the linkedin_user tool to get:
    - Full name and headline
    - Current position and company
    - Experience history
    - Education
    - Skills
    ```
  </Step>

  <Step title="Process Results">
    Use a Code node to structure the extracted data:

    ```javascript theme={null}
    const profile = $input.item.json;

    return {
      name: profile.full_name,
      headline: profile.headline,
      current_company: profile.current_position?.company,
      location: profile.location,
      skills: profile.skills,
      profile_url: profile.linkedin_url
    };
    ```
  </Step>
</Steps>

### Use Cases

* CRM data enrichment
* Lead qualification
* Candidate screening
* Contact database updates

***

## Example 2: Reddit Content Monitoring

Monitor Reddit posts and extract detailed information for content analysis.

### Workflow Structure

```mermaid theme={null}
graph LR
    A[Schedule Trigger] --> B[Reddit URLs]
    B --> C[MCP Client]
    C --> D[AI Agent]
    D --> E[Sentiment Analysis]
    E --> F[Send Alert]
```

### Configuration

<Steps>
  <Step title="Setup Schedule Trigger">
    Run every hour to check new Reddit posts:

    ```
    Cron: 0 * * * *
    ```
  </Step>

  <Step title="Provide Reddit URLs">
    Use a Set node with target post URLs or feed from a database.
  </Step>

  <Step title="Configure MCP Client">
    * Include `reddit_post` tool
    * Set for processing multiple items
  </Step>

  <Step title="Extract Post Data">
    AI agent prompt:

    ```
    Analyze this Reddit post: {{ $json.reddit_url }}

    Extract:
    - Post title and content
    - Author information
    - Upvotes and comments count
    - Top comments
    - Post timestamp
    ```
  </Step>

  <Step title="Analyze Sentiment">
    Add another AI node to analyze sentiment:

    ```
    Analyze the sentiment of this post and its top comments.
    Classify as: Positive, Negative, or Neutral
    Extract key topics and themes.
    ```
  </Step>
</Steps>

### Use Cases

* Brand mention monitoring
* Community sentiment tracking
* Competitor analysis
* Trend identification

***

## Example 3: Instagram Profile Analysis

Extract and compare Instagram profiles for influencer research.

### Workflow Configuration

<Steps>
  <Step title="Input Instagram URLs">
    Webhook or manual trigger with profile URLs:

    ```json theme={null}
    {
      "profiles": [
        "https://instagram.com/influencer1",
        "https://instagram.com/influencer2"
      ]
    }
    ```
  </Step>

  <Step title="MCP Client Setup">
    * Include `instagram_profile` tool
    * Enable batch processing
  </Step>

  <Step title="Extract Profile Data">
    AI agent instruction:

    ```
    For each Instagram profile, extract:
    - Username and full name
    - Follower count and engagement rate
    - Bio and contact information
    - Recent posts count
    - Account type (business/personal)
    ```
  </Step>

  <Step title="Compare and Rank">
    Use Code node to compare profiles:

    ```javascript theme={null}
    const profiles = $input.all().map(item => item.json);

    // Calculate engagement scores
    profiles.forEach(profile => {
      profile.engagement_score =
        (profile.avg_likes + profile.avg_comments) /
        profile.followers * 100;
    });

    // Sort by engagement
    profiles.sort((a, b) =>
      b.engagement_score - a.engagement_score
    );

    return profiles;
    ```
  </Step>
</Steps>

### Use Cases

* Influencer selection
* Campaign planning
* Competitive analysis
* Audience research

***

## Example 4: Multi-Platform Data Aggregation

Collect data from multiple social platforms for comprehensive analysis.

### Workflow Overview

Combine LinkedIn, Instagram, and Reddit data for a person or brand.

<Steps>
  <Step title="Setup Input">
    Provide multiple social media URLs:

    ```json theme={null}
    {
      "linkedin": "https://linkedin.com/in/username",
      "instagram": "https://instagram.com/username",
      "reddit": "https://reddit.com/user/username"
    }
    ```
  </Step>

  <Step title="Parallel Processing">
    Split workflow into parallel branches:

    * Branch 1: LinkedIn data extraction
    * Branch 2: Instagram data extraction
    * Branch 3: Reddit data extraction

    Each branch uses MCP Client with appropriate tool.
  </Step>

  <Step title="Merge Results">
    Use Merge node to combine all data:

    ```
    Mode: Combine All
    Output: Single item with all social data
    ```
  </Step>

  <Step title="Generate Report">
    AI agent creates unified analysis:

    ```
    Based on the social media data from LinkedIn, Instagram, and Reddit:

    1. Summarize professional background
    2. Analyze content themes and interests
    3. Evaluate audience engagement
    4. Identify key insights and patterns
    ```
  </Step>
</Steps>

### Use Cases

* Comprehensive background checks
* Brand presence analysis
* Content strategy research
* Cross-platform insights

***

## Example 5: Automated LinkedIn Company Research

Research companies automatically from a list.

### Configuration

<Steps>
  <Step title="Input Company List">
    Provide company LinkedIn URLs via webhook or spreadsheet:

    ```json theme={null}
    {
      "companies": [
        "https://linkedin.com/company/company1",
        "https://linkedin.com/company/company2"
      ]
    }
    ```
  </Step>

  <Step title="MCP Client">
    Use `linkedin_company` tool for data extraction.
  </Step>

  <Step title="Extract Company Data">
    ```
    For each company, extract:
    - Company name and industry
    - Size and location
    - Description and specialties
    - Employee count
    - Recent updates and posts
    ```
  </Step>

  <Step title="Export Results">
    Format and export to:

    * Google Sheets
    * Airtable
    * CSV file
    * Database
  </Step>
</Steps>

### Use Cases

* Market research
* Lead generation
* Competitive intelligence
* Partnership opportunities

***

## Best Practices

<CardGroup cols={2}>
  <Card title="Error Handling" icon="shield-exclamation">
    Add Error Trigger nodes to handle API failures gracefully and implement retry logic.
  </Card>

  <Card title="Rate Limiting" icon="gauge-high">
    Use Wait nodes between MCP calls to avoid hitting API rate limits.
  </Card>

  <Card title="Data Validation" icon="check-circle">
    Validate extracted data before processing to ensure quality and completeness.
  </Card>

  <Card title="Logging" icon="file-lines">
    Log all MCP operations for debugging and audit purposes.
  </Card>
</CardGroup>

## Tips for Optimization

1. **Batch Processing**: Group multiple URLs together to reduce workflow execution time
2. **Caching**: Store frequently accessed data to minimize API calls
3. **Parallel Execution**: Use Split In Batches node for processing large datasets
4. **Error Recovery**: Implement fallback mechanisms for failed API calls
5. **Monitoring**: Set up notifications for workflow failures or data anomalies

## Advanced Patterns

### Pattern 1: Conditional Tool Selection

Use IF nodes to dynamically select which MCP tool to use based on URL type:

```javascript theme={null}
// Detect platform from URL
const url = $json.social_url;

if (url.includes('linkedin.com/in/')) {
  return { tool: 'linkedin_user' };
} else if (url.includes('linkedin.com/company/')) {
  return { tool: 'linkedin_company' };
} else if (url.includes('instagram.com')) {
  return { tool: 'instagram_profile' };
}
```

### Pattern 2: Incremental Updates

Track and update only changed data:

```javascript theme={null}
// Compare with existing data
const existing = $('Database').first().json;
const fresh = $json;

const changes = {};
if (existing.followers !== fresh.followers) {
  changes.followers = fresh.followers;
  changes.follower_growth = fresh.followers - existing.followers;
}

return changes.followers ? changes : null;
```

### Pattern 3: Data Enrichment Pipeline

Chain multiple MCP tools for comprehensive enrichment:

```
LinkedIn User → Get Company → Get Company Employees → Analyze Network
```

## Resources

* [View All Available MCP Tools](/mcp-server/tools)
* [n8n MCP Tool Installation](/mcp-server/n8n-tool/installation)
* [n8n Official Documentation](https://docs.n8n.io/)
* [Anysite API Reference](/api-reference)

## Need Help?

<Card title="Get Support" icon="headset" href="mailto:support@anysite.io">
  Contact our support team for assistance with n8n MCP integration
</Card>
