Skip to main content

Social Media Plugin

The social media plugin adds support for searching and fetching content from popular social platforms to Viben. This page provides detailed documentation for each supported data source.

Installation

pip install browse-mcp-plugin-social-media

Supported Platforms

Data SourceDescriptionStatus
githubGitHub repositories and codeAvailable
twitterTwitter/X postsRequires API
zhihuZhihu Q&A articlesReference implementation
xiaohongshuXiaohongshu postsReference implementation

:::note Implementation Status This plugin is a reference implementation demonstrating the plugin architecture. The GitHub searcher uses the public API. Other data sources have placeholder implementations that require completion of actual API integration. :::

GitHub

Search GitHub repositories, code, and issues.

Configuration

VariableRequiredDescription
GITHUB_TOKENOptionalPersonal access token for higher rate limits

Without a token, GitHub allows 60 requests per hour. With a token, you get 5,000 requests per hour.

To create a token:

  1. Go to GitHub Settings > Developer Settings > Personal Access Tokens
  2. Generate a new token with repo permissions
  3. Set the environment variable

Usage

# Search repositories
browse_search([
{"searcher": "github", "query": "machine learning python", "max_results": 10}
])

# Search with specific filters
browse_search([
{"searcher": "github", "query": "language:python stars:>1000", "max_results": 5}
])

Response Format

Platform: github
Post ID: owner/repo-name
Title: Repository Name
Author: owner
Content: Repository description...
Published: 2024-01-15 10:30:00
URL: https://github.com/owner/repo-name
Engagement: 1234 likes, 56 comments
Tags: python, machine-learning, deep-learning

GitHub Search Syntax

GitHub supports advanced search syntax:

QueryDescription
language:pythonFilter by language
stars:>1000Minimum star count
forks:>100Minimum fork count
created:>2023-01-01Created after date
pushed:>2023-01-01Last pushed after date
topic:machine-learningFilter by topic

Example:

browse_search([{
"searcher": "github",
"query": "transformer language:python stars:>500 topic:nlp",
"max_results": 10
}])

Twitter/X

Search Twitter posts and topics.

Configuration

VariableRequiredDescription
TWITTER_BEARER_TOKENYesTwitter API v2 Bearer Token

To obtain a token:

  1. Apply for a Twitter Developer Account
  2. Create a project and app
  3. Generate a Bearer Token

Usage

# Search tweets
browse_search([
{"searcher": "twitter", "query": "#MachineLearning", "max_results": 20}
])

# Search with operators
browse_search([
{"searcher": "twitter", "query": "from:OpenAI GPT", "max_results": 10}
])

Response Format

Platform: twitter
Post ID: 1234567890
Title: Tweet Preview...
Author: @username
Content: Full tweet content...
Published: 2024-01-15 10:30:00
URL: https://twitter.com/username/status/1234567890
Engagement: 500 likes, 100 comments, 50 shares
Tags: #MachineLearning, #AI

Twitter Search Operators

OperatorDescription
from:usernameTweets from user
to:usernameReplies to user
#hashtagContains hashtag
@mentionMentions user
lang:enLanguage filter
is:retweetInclude retweets
-is:retweetExclude retweets

Zhihu

Search Zhihu questions, answers, and articles.

Configuration

VariableRequiredDescription
ZHIHU_API_KEYOptionalAPI key for higher rate limits

Usage

# Search Zhihu content
browse_search([
{"searcher": "zhihu", "query": "机器学习", "max_results": 10}
])

# Search Chinese content
browse_search([
{"searcher": "zhihu", "query": "深度学习入门", "max_results": 5}
])

Response Format

Platform: zhihu
Post ID: 123456789
Title: Question Title
Author: Author Name
Content: Answer or article content...
Published: 2024-01-15 10:30:00
URL: https://www.zhihu.com/question/123456789
Engagement: 1000 likes, 50 comments
Tags: machine-learning, artificial-intelligence

Xiaohongshu

Search Xiaohongshu notes and posts.

Configuration

VariableRequiredDescription
XIAOHONGSHU_API_KEYOptionalAPI key for access

Usage

# Search Xiaohongshu content
browse_search([
{"searcher": "xiaohongshu", "query": "科技测评", "max_results": 10}
])

Response Format

Platform: xiaohongshu
Post ID: 123456789
Title: Post Title
Author: @username
Content: Post content...
Published: 2024-01-15 10:30:00
URL: https://www.xiaohongshu.com/explore/123456789
Engagement: 500 likes, 30 comments
Tags: Tech, Review, Digital
Media: 3 attachment(s)

SocialPost Type

All social media data sources return SocialPost objects:

@dataclass
class SocialPost:
# Core fields
post_id: str # Unique identifier
title: str # Post title or preview
content: str # Main content
author: str # Author name/username
platform: str # Platform name
url: str # Direct link
published_date: datetime

# Engagement metrics
likes: int = 0
comments: int = 0
shares: int = 0

# Optional fields
tags: List[str]
media_urls: List[str]
extra: Dict

Enabling/Disabling Data Sources

Control which social media data sources are active:

# Enable only specific data sources
export BROWSE_MCP_ENABLED_SOURCES="arxiv,github,twitter"

# Or disable specific data sources
export BROWSE_MCP_DISABLED_SOURCES="zhihu,xiaohongshu"

Rate Limits

Each platform has different rate limits:

PlatformUnauthenticatedAuthenticated
GitHub60/hour5,000/hour
TwitterNot availableVaries by tier
ZhihuDepends on implementationDepends on implementation
XiaohongshuDepends on implementationDepends on implementation

The plugin handles rate limiting internally. If you hit limits, consider:

  • Adding API keys for higher limits
  • Reducing max_results per query
  • Adding delays between searches

Contributing

The social media plugin is open source. To contribute:

  1. Fork the repository
  2. Implement or improve searchers
  3. Add tests
  4. Submit a Pull Request

Priority areas:

  • Complete Twitter API integration
  • Add Zhihu API integration
  • Add Xiaohongshu API integration
  • Add new platforms (LinkedIn, Reddit, etc.)

Next Steps