> ## Agent Instructions
>
> Base URL: https://api.anysite.io
> Authentication: send the `access-token` header. Do NOT use `Authorization: Bearer`.
> Full endpoint catalog: https://app.anysite.io/docs
# Claude Code MCP Tool Examples

Practical examples and workflows using Anysite MCP in Claude Code

## Overview

This guide demonstrates practical workflows and examples for using Anysite MCP tools with Claude Code. These examples show how to leverage the CLI-based integration for development, automation, and team collaboration.

## Basic Usage

### Starting a Session with MCP

Once configured, simply start Claude Code and the MCP server connects automatically:

```bash
claude
```

Your Anysite tools are immediately available. Try:

```
What MCP tools do I have access to?
```

Claude will list all available Anysite tools from the connected MCP server.

### Quick Data Extraction

**Example: LinkedIn Profile Analysis**

```
Extract information from this LinkedIn profile:
https://linkedin.com/in/satyanadella

Focus on:
- Current role and company
- Career progression
- Education background
```

Claude will use the `linkedin_user` MCP tool to fetch and analyze the data.

---

## Scope Management Examples

### Example 1: Personal User-Scoped Setup

For tools you use across all your projects:

```bash
# Add to user scope (available everywhere)
claude mcp add --transport http --scope user anysite "https://mcp.anysite.io/mcp?api_key=YOUR_KEY"
```

**Use case:** You're a researcher who frequently extracts LinkedIn data across multiple projects.

**Benefits:**
- Configure once, use everywhere
- No per-project setup needed
- Personal API key stays private

### Example 2: Team Project-Scoped Setup

For shared team projects with version-controlled config:

```bash
# Navigate to project directory
cd my-team-project

# Add with project scope
claude mcp add --scope project anysite "https://mcp.anysite.io/mcp" \
  --env API_KEY=$ANYSITE_API_KEY

# Commit .mcp.json to git
git add .mcp.json
git commit -m "Add Anysite MCP configuration"
```

**Team members then:**
```bash
# Pull the project
git pull

# Set their own API key
export ANYSITE_API_KEY="their_key_here"

# Claude Code automatically uses project config
claude
```

**Benefits:**
- Shared configuration
- Individual API keys (not committed)
- Consistent team setup

### Example 3: Temporary Local Setup

For quick tests or temporary work:

```bash
# Add with local scope (default)
claude mcp add --transport http anysite "https://mcp.anysite.io/mcp?api_key=TEMP_KEY"

# Use for this session
claude

# Remove when done
claude mcp remove anysite
```

**Use case:** Testing with a trial API key or working on a temporary proof-of-concept.

---

## Development Workflows

### Workflow 1: Competitive Intelligence Research

**Setup:**
```bash
# Create research project
mkdir competitor-research
cd competitor-research

# Add Anysite with project scope
claude mcp add --scope project anysite "YOUR_URL"
```

**Usage in Claude Code:**
```
I'm researching competitors in the CRM space. For each company, get:

1. LinkedIn company pages:
   - https://linkedin.com/company/salesforce
   - https://linkedin.com/company/hubspot
   - https://linkedin.com/company/zoho

2. Extract:
   - Company size
   - Growth trends
   - Recent updates
   - Key executives

3. Create a comparison table
```

**Automated with script:**
```bash
#!/bin/bash
# research.sh

companies=(
  "salesforce"
  "hubspot"
  "zoho"
)

for company in "${companies[@]}"; do
  echo "Researching $company..." >> research.log
  claude <> enrich_data >> load_db
```

---

## Multi-Workspace Management

### Managing Multiple Projects

**Scenario:** You work on different projects with different MCP needs.

```bash
# Project A: Marketing research
cd ~/projects/marketing-research
claude mcp add --scope project anysite-marketing "URL1"

# Project B: Sales intelligence
cd ~/projects/sales-intel
claude mcp add --scope project anysite-sales "URL2"

# Personal utilities (available everywhere)
claude mcp add --scope user anysite-personal "URL3"
```

**Check current configuration:**

```bash
# In any project
claude mcp list

# Output shows:
# anysite-personal (user scope) ✔ connected
# anysite-marketing (project scope, if in marketing-research/) ✔ connected
```

### Switching Contexts

```bash
# Work on marketing project
cd ~/projects/marketing-research
claude  # Uses marketing-research/.mcp.json + user scope

# Switch to sales project
cd ~/projects/sales-intel
claude  # Uses sales-intel/.mcp.json + user scope

# Personal work
cd ~/documents
claude  # Uses only user scope
```

---

## Advanced Techniques

### Batch Processing with Scripts

**Process multiple LinkedIn profiles:**

```bash
#!/bin/bash
# batch_linkedin_extract.sh

input_file="linkedin_urls.txt"
output_dir="./extracted_data"
mkdir -p "$output_dir"

while IFS= read -r url; do
  # Extract profile ID from URL
  profile_id=$(echo "$url" | sed 's/.*linkedin.com\/in\///' | sed 's/\/.*//')

  echo "Processing: $profile_id"

  # Use Claude Code with MCP
  claude < "${output_dir}/${profile_id}.json"
Extract LinkedIn profile data from: $url

Output as JSON with these fields:
{
  "profile_id": "$profile_id",
  "extracted_at": "$(date -Iseconds)",
  "data": {
    "name": "",
    "headline": "",
    "location": "",
    "current_position": {},
    "experience": [],
    "education": [],
    "skills": []
  }
}
EOF

  # Rate limiting
  sleep 2

done < "$input_file"

echo "Batch processing complete. Extracted $(ls -1 "$output_dir" | wc -l) profiles."
```

### Conditional Logic Based on MCP Data

```bash
#!/bin/bash
# conditional_analysis.sh

company_url="https://linkedin.com/company/target-company"

# Extract data and analyze
result=$(claude <20% employee growth)
2. In tech industry
3. Located in US

Output only: YES or NO
EOF
)

if [ "$result" = "YES" ]; then
  echo "Company matches criteria. Generating detailed report..."

  claude <> mcp_status.log
```

**Run periodically:**
```bash
# Add to crontab
0 */4 * * * /path/to/check_mcp_status.sh
```

### Error Handling in Scripts

```bash
#!/bin/bash
# robust_extraction.sh

extract_with_retry() {
  local url=$1
  local max_attempts=3
  local attempt=1

  while [ $attempt -le $max_attempts ]; do
    echo "Attempt $attempt of $max_attempts"

    output=$(claude <&1
Extract data from: $url
Output as JSON
EOF
    )

    # Check if extraction succeeded
    if echo "$output" | jq . > /dev/null 2>&1; then
      echo "$output"
      return 0
    fi

    echo "Extraction failed, retrying..."
    attempt=$((attempt + 1))
    sleep 5
  done

  echo "ERROR: Failed after $max_attempts attempts"
  return 1
}

# Usage
if result=$(extract_with_retry "https://linkedin.com/in/profile"); then
  echo "$result" > output.json
  echo "Success"
else
  echo "Failed to extract data" >&2
  exit 1
fi
```

---

## Best Practices

### 1. Scope Selection Strategy

  
#### User Scope

    **Use for:**
    - Personal API keys
    - Tools you use everywhere
    - Cross-project utilities

    **Example:**
    ```bash
    claude mcp add --scope user \
      anysite "URL"
    ```
  

  
#### Project Scope

    **Use for:**
    - Team collaborations
    - Version-controlled configs
    - Project-specific setups

    **Example:**
    ```bash
    claude mcp add --scope project \
      anysite "URL" \
      --env API_KEY=$KEY
    ```
  

  
#### Local Scope

    **Use for:**
    - Temporary setups
    - Testing
    - Sensitive credentials

    **Example:**
    ```bash
    claude mcp add \
      anysite-test "URL"
    ```
  

### 2. Security Checklist

- ✅ Use environment variables for API keys
- ✅ Add config files to `.gitignore`
- ✅ Rotate keys regularly
- ✅ Use `--scope local` for sensitive keys
- ✅ Audit configurations with `claude mcp list`
- ✅ Remove unused servers
- ❌ Never commit API keys to version control
- ❌ Don't share Direct URLs publicly

### 3. Performance Optimization

**Rate limiting:**
```bash
# Add delays between requests
for url in "${urls[@]}"; do
  claude <<< "Extract: $url"
  sleep 2  # Respect API rate limits
done
```

**Batch similar requests:**
```bash
# Instead of multiple calls
claude < "$output_file"
fi
```

---

## Common Patterns

### Pattern 1: Daily Automated Report

```bash
#!/bin/bash
# daily_report.sh

date=$(date +%Y-%m-%d)
report_file="reports/daily_${date}.md"

claude < "$report_file"
Generate daily intelligence report:

1. Check these LinkedIn company pages for updates:
   - https://linkedin.com/company/competitor1
   - https://linkedin.com/company/competitor2

2. Monitor Reddit posts in r/industry for trending topics

3. Analyze sentiment and key themes

4. Format as executive summary in markdown
EOF

# Email the report
mail -s "Daily Intelligence Report - $date" \
  -a "$report_file" \
  executives@company.com < /dev/null
```

### Pattern 2: Interactive Research Session

```bash
# Start research session
claude

# Then interactively:
```

1. Extract target company profile
2. Get list of key employees
3. Analyze their backgrounds
4. Identify common patterns
5. Generate hiring strategy recommendations

### Pattern 3: Data Validation Pipeline

```bash
#!/bin/bash
# validate_data.sh

input_csv="leads.csv"
output_csv="validated_leads.csv"

# Validate each LinkedIn URL
while IFS=, read -r id name linkedin_url; do
  # Check if profile exists and is accessible
  status=$(claude <> "$output_csv"
done < "$input_csv"
```

---

## Resources

- [Installation Guide](/docs/mcp-server/claude-code-tool/installation)
- [View All MCP Tools](/docs/mcp-server/tools)
- [Compare with Claude Desktop](/docs/mcp-server/claude-desktop-tool/installation)
- [Official Claude Code Documentation](https://docs.claude.com/en/docs/claude-code)

## Need Help?

#### Get Support

  Contact our support team for assistance with Claude Code MCP workflows
