BX

barresider/x-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

11 stars 6 forks 质量 70 趋势 18MIT

An MCP Server to interact with X/Twitter besides the official API.

概览

A Model Context Protocol (MCP) server that provides unofficial X/Twitter API access through browser automation using Playwright. This server enables AI agents and applications to interact with X/Twitter programmatically for content creation, scraping, and social media automation. - : Post single tweets or multi-tweet threads with media support - : Like, unlike, retweet, unretweet, bookmark, quote tweet, and reply to posts - : Like, unlike, reply to, and edit comments - : Upload and attach images, videos, and GIFs to tweets - : Extract posts from "For You" and "Following" timelines - : Get comprehensive user profile data and recent posts - : Advanced search with filters for viral content, specific users, and date ranges - : Extract comments and replies from specific posts - : Retrieve current trending topics and hashtags - : Works with both stdio and HTTP/SSE transports - : 20+ tools available for AI agents to interact with X/Twitter - : JSON-formatted responses with comprehensive...

README

以下为原文 README 节选,完整内容请查看原文。

X/Twitter MCP Server

A Model Context Protocol (MCP) server that provides unofficial X/Twitter API access through browser automation using Playwright. This server enables AI agents and applications to interact with X/Twitter programmatically for content creation, scraping, and social media automation.

🚀 Features

Content Creation & Interaction

  • Tweet & Thread Posting: Post single tweets or multi-tweet threads with media support
  • Post Interactions: Like, unlike, retweet, unretweet, bookmark, quote tweet, and reply to posts
  • Comment Management: Like, unlike, reply to, and edit comments
  • Media Support: Upload and attach images, videos, and GIFs to tweets

Content Scraping & Analysis

  • Timeline Scraping: Extract posts from “For You” and “Following” timelines
  • Profile Scraping: Get comprehensive user profile data and recent posts
  • Search Functionality: Advanced search with filters for viral content, specific users, and date ranges
  • Comment Scraping: Extract comments and replies from specific posts
  • Trending Topics: Retrieve current trending topics and hashtags

MCP Integration

  • Dual Transport Support: Works with both stdio and HTTP/SSE transports
  • Tool-based Interface: 20+ tools available for AI agents to interact with X/Twitter
  • Structured Responses: JSON-formatted responses with comprehensive metadata
  • Error Handling: Robust error handling with descriptive error messages

📋 Prerequisites

  • Node.js 18+
  • Valid X/Twitter account credentials
  • Docker (optional, for containerized deployment)

Quick Start

  1. Add this configuration to your Claude Desktop config file:

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "x-mcp": {
      "command": "npx",
      "args": ["-y", "@barresider/x-mcp"],
      "env": {
        "TWITTER_USERNAME": "your_twitter_username",
        "TWITTER_PASSWORD": "your_twitter_password"
      }
    }
  }
}

With proxy (optional):

{
  "mcpServers": {
    "x-mcp": {
      "command": "npx",
      "args": ["-y", "@barresider/x-mcp"],
      "env": {
        "TWITTER_USERNAME": "your_twitter_username",
        "TWITTER_PASSWORD": "your_twitter_password",
        "PROXY_URL": "http://proxy-server:port"
      }
    }
  }
}
  1. Restart Claude Desktop

That’s it! Claude can now interact with X/Twitter through 25+ powerful tools including:

  • tweet: Post a new tweet with optional media
  • thread: Post a multi-tweet thread
  • search_twitter: Search for tweets with advanced filters
  • scrape_profile: Get comprehensive user profile data
  • scrape_timeline: Extract posts from timelines
  • like_post, retweet_post, bookmark_post: Interact with posts
  • And many more for comprehensive X/Twitter automation

Example Usage

Try asking Claude:

  • “Can you post a tweet saying ‘Hello from Claude!’”
在 GitHub 查看完整 README

安装

npx -y @barresider/x-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "x-mcp": { "command": "npx", "args": ["-y", "@barresider/x-mcp"], "env": { "TWITTER_USERNAME": "your_twitter_username", "TWITTER_PASSWORD": "your_twitter_password" } } } }