Twitter MCP サーバー
Twitter API 統合のためのモデル コンテキスト プロトコル サーバーの実装。
設定
リポジトリをクローンする
依存関係をインストール:
npm install.env.exampleを.envにコピーし、Twitter API の認証情報を入力します。プロジェクトをビルドします:
npm run buildサーバーを起動します:
npm start
Related MCP server: MCP-Twikit
環境変数
.envに必要な Twitter API 認証情報:
利用可能なツール
ツイート操作
postTweet: 新しいツイートを投稿する{ "text": "Your tweet text here" }postTweetWithMedia: メディアを添付したツイートを投稿する{ "text": "Your tweet text", "mediaPath": "path/to/media/file", "mediaType": "image/jpeg|image/png|image/gif|video/mp4", "altText": "Optional alt text for accessibility" }getTweetById: IDで特定のツイートを取得する{ "tweetId": "tweet_id", "tweetFields": ["created_at", "public_metrics"] }replyToTweet: 既存のツイートに返信する{ "tweetId": "tweet_id", "text": "Your reply text" }deleteTweet: ツイートを削除する{ "tweetId": "tweet_id" }
検索と分析
searchTweets: ツイートを検索{ "query": "search query", "maxResults": 10, "tweetFields": ["created_at", "public_metrics"] }getHashtagAnalytics: ハッシュタグの分析情報を取得する{ "hashtag": "hashtag", "startTime": "ISO-8601 date", "endTime": "ISO-8601 date" }
ユーザー操作
getUserInfo: ユーザー情報を取得する{ "username": "twitter_username", "fields": ["description", "public_metrics"] }getUserTimeline: ユーザーのツイートを取得する{ "username": "twitter_username", "maxResults": 10, "tweetFields": ["created_at", "public_metrics"] }getFollowers: ユーザーのフォロワーを取得する{ "username": "twitter_username", "maxResults": 100, "userFields": ["description", "public_metrics"] }getFollowing: ユーザーがフォローしているアカウントを取得する{ "username": "twitter_username", "maxResults": 100, "userFields": ["description", "public_metrics"] }
婚約
likeTweet: ツイートにいいねする{ "tweetId": "tweet_id" }ツイートを
unlikeTweetしない{ "tweetId": "tweet_id" }retweet: ツイートをリツイートする{ "tweetId": "tweet_id" }undoRetweet: リツイートを元に戻す{ "tweetId": "tweet_id" }getRetweets: ツイートをリツイートしたユーザーを取得する{ "tweetId": "tweet_id", "maxResults": 100, "userFields": ["description", "public_metrics"] }getLikedTweets: ユーザーが「いいね!」したツイートを取得する{ "userId": "user_id", "maxResults": 100, "tweetFields": ["created_at", "public_metrics"] }
リスト管理
createList: 新しいリストを作成する{ "name": "List name", "description": "List description", "isPrivate": false }addUserToList: ユーザーをリストに追加する{ "listId": "list_id", "username": "twitter_username" }removeUserFromList: リストからユーザーを削除する{ "listId": "list_id", "username": "twitter_username" }getListMembers: リストのメンバーを取得する{ "listId": "list_id", "maxResults": 100, "userFields": ["description", "public_metrics"] }
エラー処理
すべてのツールは標準化されたエラー応答を返します。
不足しているパラメータ:
Missing required parameter: parameter_nameAPIエラー: Twitter APIからのエラーメッセージ
見つからないエラー: リソースに適切な「見つからない」メッセージ
応答フォーマット
すべての成功した応答は次の形式に従います。
発達
ビルド:
npm run build開始:
npm startウォッチモード:
npm run dev
ステータス: 正常に動作しています レスポンス: ツイートIDを返します 最新のテスト: 成功
ステータス: 正常に動作しています レスポンス: 完全なツイートデータを返します 最新のテスト: 成功
ステータス: 正常に動作しています 応答: アクションの確認 最新のテスト: 成功
ステータス: 正常に動作しています 応答: アクションの確認 最新のテスト: 成功
ステータス: 正常に動作しています レスポンス: 返信ツイートIDを返します 最新のテスト: 成功
ステータス: 正常に動作しています 応答: ユーザープロファイルデータが完了しました 最新のテスト: 成功
ステータス: 正常に動作しています 応答: アクションの確認 最新のテスト: 成功
ステータス: 正常に動作しています 応答: リスト作成の確認 最新のテスト: 成功
ステータス: 正常に動作しています 応答: 所有リストとメンバーリストの両方を返します 最新のテスト: 成功
ステータス: エラー 400 エラー: 無効なリクエストパラメータ 必要な修正: パラメータ検証
ステータス: エラー 400 エラー: 無効なリクエストパラメータ 必要な修正: クエリパラメータのフォーマット
ステータス: エラー 400 エラー: 無効なリクエストパラメータ 必要な修正: パラメータ検証
エラー処理: