twitter-follower-mcp
v1.0.0
Published
MCP server for fetching Twitter followers and following data
Maintainers
Readme
Twitter Follower/Following MCP Server
このMCP (Model Control Protocol) サーバーは、クッキーベースの認証を使用してTwitterのフォロワーとフォローデータを取得することができます。
機能
- ブラウザクッキーを使ったTwitter認証
- 任意のTwitterユーザーのフォロワーリスト取得
- 任意のTwitterユーザーのフォローリスト取得
- 一回のリクエストでフォロワーとフォローの両方を取得
- 認証状態の確認
インストール
NPMパッケージとして使用
npm install -g twitter-follower-mcpローカルでインストール
- リポジトリをクローン
- 依存関係をインストール:
npm install - サーバーを起動:
npm start
使用方法
Claude Desktop設定での使用方法
claude_desktop_config.jsonファイルに以下のエントリを追加します:
"twitter-follower-mcp": {
"command": "npx",
"args": [
"twitter-follower-mcp",
"--cookies='{\"auth_token\":\"YOUR_AUTH_TOKEN\",\"ct0\":\"YOUR_CT0_TOKEN\",\"twid\":\"YOUR_TWID_TOKEN\"}'"
]
}または、クッキーファイルを指定する場合:
"twitter-follower-mcp": {
"command": "npx",
"args": [
"twitter-follower-mcp",
"--cookie-file=/path/to/twitter-cookies.json"
]
}コマンドラインでの使用方法
クッキーをJSON文字列として直接指定:
twitter-follower-mcp --cookies='{"auth_token":"YOUR_AUTH_TOKEN","ct0":"YOUR_CT0_TOKEN"}'クッキーファイルを指定:
twitter-follower-mcp --cookie-file=./twitter-cookies.jsonポートを指定:
twitter-follower-mcp --cookie-file=./twitter-cookies.json --port=3001MCPプロトコルでの使用
サーバーはJSONメッセージをMCPプロトコル経由で受け取ります。以下のような操作がサポートされています:
1. 認証クッキーの設定
まず、Twitter認証用のクッキーを提供する必要があります:
{
"cookies": {
"auth_token": "your_auth_token",
"ct0": "your_ct0_token",
... (その他必要なTwitterクッキー)
}
}2. 認証の確認
認証が機能するかを確認:
{
"action": "verify_auth"
}3. フォロワーの取得
特定のユーザーのフォロワーを取得:
{
"action": "get_followers",
"username": "twitterのユーザー名",
"limit": 100
}4. フォローの取得
ユーザーがフォローしているアカウントを取得:
{
"action": "get_following",
"username": "twitterのユーザー名",
"limit": 100
}5. フォロワーとフォローの両方を取得
一回のリクエストで両方を取得:
{
"action": "get_both",
"username": "twitterのユーザー名",
"limit": 100
}レスポンス形式
サーバーは以下の構造を持つJSONレスポンスを返します:
{
"status": "success",
"data": [...], // ユーザーオブジェクトの配列
"type": "followers", // または "following"
"username": "twitterのユーザー名",
"count": 100
}各ユーザーオブジェクトには以下の情報が含まれます:
{
"id": "12345678901234567",
"username": "user",
"name": "User Name",
"description": "User bio...",
"created_at": "2020-01-01T00:00:00.000Z",
"followers_count": 1000,
"following_count": 500,
"tweet_count": 5000,
"profile_image_url": "https://...",
"profile_url": "https://twitter.com/user",
"type": "follower", // または "following"
"related_to": "twitterのユーザー名"
}Twitterクッキーの取得方法
- ブラウザでTwitterにログイン
- Developer Tools(F12または右クリック > 検証)を開く
- Applicationタブ > Storage > Cookies > https://twitter.comに移動
- 最低限以下のクッキーを探す:
auth_tokenct0twid
- これらの値をMCPサーバーで使用する
注意事項
- このサーバーには有効なTwitter認証クッキーが必要です
- レート制限はTwitter APIクライアントによって自動的に処理されます
- 大きなアカウントの場合は、ページネーションや適切な制限を使用してタイムアウトを回避してください
