Skip to main content
Glama

social-research-mcp

MCP server for social media research — scrape, search, and analyze across 7 platforms with an AI-powered timeline.

Works with Claude Code, Claude Desktop, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible client.

Features

  • 7 Platform Scrapers — Twitter/X, Instagram, TikTok, YouTube, LinkedIn, Facebook, Reddit (powered by Apify)

  • AI Timeline — All scraped data is stored in a local LanceDB database with OpenAI embeddings for semantic search

  • Trend Detection — Identify trending topics, sentiment shifts, and engagement spikes across platforms

  • Profile Analysis — Engagement rates, posting frequency, content themes, peak hours

  • Sentiment Analysis — Rule-based sentiment scoring with emoji support

  • Cross-Platform Comparison — Compare profiles, hashtags, or topics side-by-side

Quick Start

# Run with npx (no install needed)
APIFY_TOKEN=your-token npx social-research-mcp

# With timeline/embeddings support
APIFY_TOKEN=your-token OPENAI_API_KEY=your-key npx social-research-mcp

Installation

npm install -g social-research-mcp

Configuration

Environment Variable

Required

Description

APIFY_TOKEN

Yes

Apify API token for scraping

OPENAI_API_KEY

No

OpenAI API key for timeline embeddings (semantic search)

SOCIAL_RESEARCH_DATA_DIR

No

Data directory (default: ~/.social-research-mcp/data/)

SOCIAL_RESEARCH_PORT

No

HTTP port (default: 3847)

Get your Apify token here and OpenAI key here.

Usage with MCP Clients

Claude Code

Add to your project's .mcp.json:

{
  "mcpServers": {
    "social-research": {
      "command": "npx",
      "args": ["social-research-mcp"],
      "env": {
        "APIFY_TOKEN": "your-token",
        "OPENAI_API_KEY": "your-key"
      }
    }
  }
}

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "social-research": {
      "command": "npx",
      "args": ["social-research-mcp"],
      "env": {
        "APIFY_TOKEN": "your-token",
        "OPENAI_API_KEY": "your-key"
      }
    }
  }
}

HTTP Mode

For clients that support HTTP/SSE transport:

social-research-mcp --http          # Port 3847
social-research-mcp --http 8080     # Custom port

Tools

Scrape Tools (7)

Each scraper pulls data from its platform via Apify and automatically saves results to the local timeline database.

Tool

Description

scrape_twitter

Search tweets by query, hashtag, or user timeline

scrape_instagram

Scrape posts by URL, hashtag, or search

scrape_tiktok

Scrape videos by profile, hashtag, or search

scrape_youtube

Scrape videos by search or channel URL

scrape_linkedin

Scrape posts by profile, company, or search

scrape_facebook

Scrape page posts by URL or search

scrape_reddit

Scrape posts by subreddit, search, or URL

Timeline Tools (4)

Query and analyze your locally stored timeline data.

Tool

Description

timeline_search

Semantic search using AI embeddings (requires OPENAI_API_KEY)

timeline_query

Structured filtering by platform, date, engagement, author, hashtags

timeline_trends

Detect trending topics with growth rates and sentiment

timeline_stats

Aggregate stats: post counts, top authors, top hashtags

Analysis Tools (3)

Tool

Description

analyze_profile

Full profile analysis with engagement benchmarks

analyze_sentiment

Sentiment scoring on timeline data or direct text

compare

Side-by-side comparison of profiles, hashtags, or topics

Architecture

src/
├── index.ts            # CLI entry point
├── server.ts           # MCP server (registers all tools)
├── config.ts           # Environment configuration
├── types.ts            # Shared types (UnifiedPost, Platform, etc.)
├── transport/
│   ├── stdio.ts        # MCP stdio transport (default)
│   └── http.ts         # HTTP/SSE transport
├── platforms/
│   ├── base.ts         # Abstract platform class
│   ├── index.ts        # Platform registry
│   └── [7 platforms]   # Platform-specific scrapers
├── tools/
│   ├── scrape.ts       # Scrape tool handlers
│   ├── timeline.ts     # Timeline tool handlers
│   └── analysis.ts     # Analysis tool handlers
├── db/
│   ├── lance.ts        # LanceDB connection and queries
│   ├── schema.ts       # Post row schema and converters
│   └── embeddings.ts   # OpenAI embedding wrapper
└── analysis/
    ├── sentiment.ts    # Rule-based sentiment analysis
    ├── trends.ts       # Trend detection and topic clustering
    └── engagement.ts   # Platform-specific engagement formulas

All scraped data is normalized to a UnifiedPost schema, embedded via OpenAI, and stored in a local LanceDB database. This enables cross-platform semantic search and trend analysis over time.

Apify Costs

Scraping costs are billed through your Apify account. Approximate costs:

Platform

Approximate Cost

Twitter

~$0.40 / 1k tweets

TikTok

~$5 / 1k results

Others

Compute-based (varies)

See Apify pricing for details.

Development

git clone https://github.com/TerminalGravity/social-research-mcp.git
cd social-research-mcp
npm install
npm run build
npm run typecheck

License

MIT

Available Tools

14 tools
analyze_profileB

Analyze a social media profile: scrape recent posts and compute engagement rate, posting frequency, content themes, peak hours, and sentiment.

Inputs: url_or_username (required), platform (required), max_posts.

analyze_sentimentB

Run sentiment analysis on posts. Provide a query to search timeline data, or pass texts directly. Returns positive/negative/neutral breakdown.

Inputs: query, platforms, texts.

compareB

Compare 2+ profiles, hashtags, or topics side-by-side across engagement, sentiment, and volume metrics.

Inputs: items (required), metric.

scrape_facebookB

Scrape posts from Facebook pages. Search by page URL or keyword. Results are saved to the local timeline database.

Inputs: page_urls, search, max_results.

scrape_instagramC

Scrape posts from Instagram. Search by URL, hashtag, or keyword. Results are saved to the local timeline database.

Inputs: urls, hashtags, search, type, +1 more.

scrape_linkedinC

Scrape posts from LinkedIn. Search by profile URL, company URL, or keyword. Results are saved to the local timeline database.

Inputs: profile_urls, company_urls, search, max_results.

scrape_redditB

Scrape posts from Reddit. Search by subreddit, keyword, or direct URL. Results are saved to the local timeline database.

Inputs: subreddits, search, urls, max_results.

scrape_tiktokB

Scrape videos from TikTok. Search by profile, hashtag, or keyword. Results are saved to the local timeline database.

Inputs: profiles, hashtags, search, max_results.

scrape_twitterB

Scrape tweets from Twitter/X. Search by query, hashtag, or user timeline. Results are saved to the local timeline database for later analysis.

Inputs: query (required), type, date_from, date_to, +1 more.

scrape_youtubeC

Scrape videos from YouTube. Search by keyword or channel URL. Results are saved to the local timeline database.

Inputs: search, channel_urls, max_results.

timeline_queryC

Structured query against the timeline database. Filter by platform, date, engagement, author, or hashtags — no AI needed.

Inputs: platforms, date_from, date_to, min_engagement, +3 more.

timeline_statsB

Get aggregate statistics from your timeline: total posts by platform, avg engagement, most active authors, top hashtags.

Inputs: platforms, date_from, date_to.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 14 tools

    Disambiguation4/5

    Most tools have distinct purposes, with clear separation between scraping (platform-specific), analysis (profile, sentiment, comparison), and timeline operations (query, search, stats, trends). However, timeline_query and timeline_search could be confused as both search the timeline database, though one is structured and the other semantic.

    Naming Consistency5/5

    Tool names follow a consistent snake_case pattern throughout, with clear verb_noun structures (e.g., analyze_profile, scrape_facebook, timeline_query). The naming is predictable and readable, with no mixing of conventions or styles.

    Tool Count5/5

    14 tools is well-scoped for a social research server covering multiple platforms and analysis types. Each tool earns its place, providing comprehensive coverage without being overwhelming, typical for a domain with diverse data sources and analytical needs.

    Completeness5/5

    The toolset offers complete coverage for social research: scraping from major platforms (Facebook, Instagram, etc.), storing data in a timeline database, and providing analysis tools (profile analysis, sentiment, comparison, stats, trends). No obvious gaps exist for the stated purpose, enabling agents to perform end-to-end research workflows.

    Related MCP Connectors