Social Media Scraper - Custom MCP Server

Social Media Scraper - Custom MCP Server

Enables scraping of LinkedIn, Facebook, Instagram profiles and Google search via a Model Context Protocol server, allowing AI assistants to fetch social media data and search results.

Category
访问服务器

README

<h1 align="center">Social Media Scraper - Custom MCP Server</h1>

<br> <p align="center"> <img src="https://img.shields.io/badge/python-FFD43B?style=for-the-badge&logo=python&logoColor=306998" alt="Python"> <img src="https://img.shields.io/badge/fastmcp-FF6B6B?style=for-the-badge&logo=python&logoColor=white" alt="FastMCP"> <img src="https://img.shields.io/badge/rapidapi-7B68EE?style=for-the-badge&logo=rapidapi&logoColor=white" alt="RapidAPI"> <img src="https://img.shields.io/badge/linkedin-20B2AA?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn API"> <img src="https://img.shields.io/badge/facebook-FF4500?style=for-the-badge&logo=facebook&logoColor=white" alt="Facebook API"> <img src="https://img.shields.io/badge/instagram-FF1493?style=for-the-badge&logo=instagram&logoColor=white" alt="Instagram API"> <img src="https://img.shields.io/badge/google_serper-32CD32?style=for-the-badge&logo=google&logoColor=white" alt="Google Serper API"> </p> <br> A comprehensive Model Context Protocol (MCP) server that provides social media scraping capabilities for LinkedIn, Facebook, Instagram, and Google search functionality.

What is MCP?

Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect with external data sources and tools. MCP servers act as bridges between AI models and various services, allowing for enhanced capabilities like real-time data access, API integrations, and custom tool execution.

Features

This server exposes the following tools for an AI assistant to use:

  • LinkedIn Profile Scraping: Extract personal and company profile data
  • Facebook Profile Scraping: Fetch public profile information
  • Instagram Profile Scraping: Get profile data and basic information
  • Google Search: Perform web searches using Google Serper API

Installation

Step 1: Adding MCP to your Python project

We recommend using uv to manage your Python projects.

If you haven't created a uv-managed project yet, create one:

uv init custom-mcp-server
cd custom-mcp-server

Step 2: Install MCP Dependencies

Then add MCP to your project dependencies:

uv add "mcp[cli]"

This will auto-generate files and folders similar to the project structure mentioned below, also create a .env file to securely store the API keys.

Step 3: Add Project Code

In the files generated look for main.py and copy paste the code given in main.py (repo).

Step 4: Install Additional Dependencies

uv add httpx python-dotenv fastmcp

Environment Configuration

Step 1: API Keys Setup

  1. RapidAPI Key:

    • Sign up at RapidAPI
    • Subscribe to the following APIs (Most Important):
      • Fresh LinkedIn Profile Data
      • Facebook Scraper3
      • Instagram Scraper Stable API
  2. Google Serper API Key:

    • Sign up at Serper.dev
    • Get your API key from the dashboard

Step 2: Environment Variables

Create .env file in your project root with the following variables:

RAPIDAPI_KEY=your_rapidapi_key_here
SERPER_API_KEY=your_serper_api_key_here

Usage

Running with Claude Desktop

Step 1: Install the Server

You can install this server in Claude Desktop and interact with it right away by running:

uv run mcp install main.py

Step 2: Verify Installation

Later, go to Claude AI (desktop version) and you will see changes in the platform similar to the screenshot shown.

Step 3: Start Using the Tools

Paste the URLs of required platform and ask the AI to provide information of the mentioned URLs.

Example Usage

Please scrape this LinkedIn profile: https://linkedin.com/in/example-profile
Get company information for: https://linkedin.com/company/example-company

Troubleshooting

If the MCP tools don't appear in Claude Desktop:

Step 1: End Claude Processes

  • Windows: Open Task Manager (Ctrl+Shift+Esc)
  • Mac: Open Activity Monitor
  • End all Claude-related processes

Step 2: Reinstall the Server

uv run mcp install main.py

Step 3: Restart Claude Desktop

Paste the URLs of required platform and ask the AI to provide information of the mentioned URLs.

Testing with MCP Inspector

Alternatively, you can test it with the MCP Inspector:

uv run mcp dev main.py

Project Structure

custom-mcp-server/
├── __pycache__/          # Python bytecode cache (auto-generated)
├── .venv/                # Virtual environment directory
├── .env                  # Environment variables (API keys)
├── .python-version       # Python version specification
├── main.py               # Main MCP server implementation
├── pyproject.toml        # Project configuration and dependencies
├── README.md             # Project documentation
└── uv.lock               # UV lock file for reproducible builds

Response Format

All tools return JSON-formatted strings containing the scraped data. Example response structure:

{
  "success": true,
  "data": {
    "profile": {
      "name": "John Doe",
      "title": "Software Engineer",
      "location": "San Francisco, CA",
      "bio": "Passionate about technology..."
    }
  },
  "timestamp": "2024-01-15T10:30:00Z"
}

But using these tools via Claudes makes it readable.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

In case of any queries, please leave a message or contact me via the email provided in my profile.

<p align="center"> ⭐ <strong>Star this repository if you found it helpful!</strong> </p>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选