X (Twitter) MCP Server
X (Twitter) MCP サーバー
この MCP サーバーにより、クライアントは X (旧 Twitter) と対話できるようになり、ツイートの投稿、コンテンツの検索、アカウントの管理、リストの整理などの包括的なプラットフォーム操作が可能になります。
クイックスタート
X 開発者アカウントを作成し、 X 開発者ポータルから API キーを取得します。
必要なAPIキーをすべて環境変数に設定する
このリポジトリをクローンします:
git clone https://github.com/Dishant27/twitter-mcp.git依存関係をインストール:
npm installサーバーを実行します。
環境変数を使用する場合:
TWITTER_API_KEY=your_api_key \
TWITTER_API_SECRET=your_api_secret \
TWITTER_ACCESS_TOKEN=your_access_token \
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret \
npm start.envファイルの使用:
# Create a .env file with your X API keys
echo "TWITTER_API_KEY=your_api_key
TWITTER_API_SECRET=your_api_secret
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret" > .env
# Start the server
npm startClaude などの MCP クライアントで使用します。
Related MCP server: Twitter MCP Server
クロード・コンフィグレーション
このサーバーをClaudeで使用するには、MCP設定を行う必要があります。設定例を以下に示します。
{
"name": "x",
"display_name": "X",
"description": "X MCP allows Claude to interact with X (formerly Twitter)",
"path": "path/to/twitter-mcp/dist/index.js",
"startup": {
"env": {
"TWITTER_API_KEY": "your_api_key",
"TWITTER_API_SECRET": "your_api_secret",
"TWITTER_ACCESS_TOKEN": "your_access_token",
"TWITTER_ACCESS_TOKEN_SECRET": "your_access_token_secret"
}
},
"transport": "stdio"
}この構成を、通常次の場所にある Claude MCP 構成ディレクトリに保存します。
Windows:
%APPDATA%\AnthropicClaude\mcp-serversmacOS:
~/Library/Application Support/AnthropicClaude/mcp-serversLinux:
~/.config/AnthropicClaude/mcp-servers
特徴
ポストオペレーション
投稿内容(最大280文字)
カスタマイズ可能な結果件数でクエリによる投稿を検索
アカウント管理
任意のユーザーまたは認証されたアカウントのプロフィール情報を取得する
プロフィールの詳細(名前、経歴、所在地、ウェブサイトの URL)を更新します
ユーザーのフォローとフォロー解除
任意のユーザーまたは認証されたアカウントのフォロワーを一覧表示します
ユーザーがフォローしているアカウントを一覧表示する
リスト管理
新しいリストを作成する(公開または非公開)
特定のリストに関する情報を取得する
認証されたユーザーが所有するすべてのリストを取得する
利用可能なMCPツール
ツール名 | 説明 |
| Xに新しいコンテンツを投稿する |
| Xでコンテンツを検索 |
| ユーザーまたは認証されたアカウントのプロフィール情報を取得する |
| 認証されたユーザーのプロフィールを更新する |
| ユーザーをフォローする |
| ユーザーのフォローを解除する |
| ユーザーまたは認証されたアカウントのフォロワーを一覧表示する |
| ユーザーまたは認証されたアカウントがフォローしているアカウントを一覧表示する |
| 新しいリストを作成する |
| リストに関する情報を取得する |
| 認証されたユーザーが所有するすべてのリストを取得する |
要件
Node.js 18.x 以上
X APIキー付き開発者アカウント
API v1およびv2アクセス
環境変数
変数 | 説明 |
| APIキー |
| APIシークレット |
| アクセストークン |
| アクセストークンシークレット |
リポジトリ構造
twitter-mcp/
├── .github/
│ └── workflows/
│ ├── publish.yml
│ └── release.yml
├── code/
│ ├── account_management.py # Sample Python code for account management
│ ├── post_tweet.py # Sample Python code for posting content
│ └── retrieve_tweets.py # Sample Python code for retrieving content
├── src/
│ ├── index.ts # Main entry point
│ ├── twitter-api.ts # X API client
│ ├── formatter.ts # Response formatter
│ └── types.ts # Type definitions
├── .env.example
├── .gitignore
├── Dockerfile
├── LICENSE
├── package.json
├── README.md
└── tsconfig.jsonライセンス
マサチューセッツ工科大学
This server cannot be deployed
Maintenance
Related MCP Connectors
X (Twitter) data for AI agents: tweets, profiles, followers, search, trends + social listening.
X (formerly Twitter): X (formerly Twitter) public and private data API for search, posts (Tweets).
X/Twitter user/post search, suggestions, details, comments/replies, user posts and transcripts.
Live X/Twitter data: profiles, tweets, search, followers, lists and trends. 29 read-only tools.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables users to interact with X (Twitter) through the X API. Supports posting tweets, retrieving user timelines, searching tweets, and replying to tweets with comprehensive error handling.39 npm-
- FlicenseNot gradedqualityDmaintenanceEnables LLM agents to interact with Twitter (X) for searching tweets, posting content with images, analyzing engagement, and extracting topics using the Twitter API.-
- AlicenseNot gradedqualityDmaintenanceEnables interaction with X (Twitter) to post tweets, threads, and replies while retrieving tweet metrics and account information. It supports core management tasks like deleting tweets and verifying authentication through the Twitter API.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.29 PyPIMIT
Appeared in Searches
- A search for the social media handle '@@x7ton'
- Search for posts related to X
- A search for strategies to promote a directory website and generate ideas for solopreneur SAAS businesses
- Managing Social Media Content Creation Using Monday
- A guide to researching LinkedIn profiles and personalizing outreach based on customer persona and company signals