Twitter MCP Server
Twitter MCP サーバー
Twitter API 統合のためのモデル コンテキスト プロトコル サーバーの実装。
設定
リポジトリをクローンする
依存関係をインストール:
npm install.env.exampleを.envにコピーし、Twitter API の認証情報を入力します。プロジェクトをビルドします:
npm run buildサーバーを起動します:
npm start
Related MCP server: MCP-Twikit
環境変数
.envに必要な Twitter API 認証情報:
X_API_KEY=your_api_key
X_API_SECRET=your_api_secret
X_ACCESS_TOKEN=your_access_token
X_ACCESS_TOKEN_SECRET=your_access_token_secret利用可能なツール
ツイート操作
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からのエラーメッセージ
見つからないエラー: リソースに適切な「見つからない」メッセージ
応答フォーマット
すべての成功した応答は次の形式に従います。
{
"content": [
{
"type": "text",
"text": "Operation result message"
}
]
}発達
ビルド:
npm run build開始:
npm startウォッチモード:
npm run dev
Here's a comprehensive status report of all Twitter tools:
## Working Tools (✓)
1. postTweetステータス: 正常に動作しています レスポンス: ツイートIDを返します 最新のテスト: 成功
2. getTweetByIdステータス: 正常に動作しています レスポンス: 完全なツイートデータを返します 最新のテスト: 成功
3. likeTweet & unlikeTweetステータス: 正常に動作しています 応答: アクションの確認 最新のテスト: 成功
4. retweet & undoRetweetステータス: 正常に動作しています 応答: アクションの確認 最新のテスト: 成功
5. replyToTweetステータス: 正常に動作しています レスポンス: 返信ツイートIDを返します 最新のテスト: 成功
6. getUserInfoステータス: 正常に動作しています 応答: ユーザープロファイルデータが完了しました 最新のテスト: 成功
7. followUser & unfollowUserステータス: 正常に動作しています 応答: アクションの確認 最新のテスト: 成功
8. createListステータス: 正常に動作しています 応答: リスト作成の確認 最新のテスト: 成功
9. getUserListsステータス: 正常に動作しています 応答: 所有リストとメンバーリストの両方を返します 最新のテスト: 成功
## Tools with Issues (⚠️)
1. getUserTimelineステータス: エラー 400 エラー: 無効なリクエストパラメータ 必要な修正: パラメータ検証
2. searchTweetsステータス: エラー 400 エラー: 無効なリクエストパラメータ 必要な修正: クエリパラメータのフォーマット
3. getLikedTweetsステータス: エラー 400 エラー: 無効なリクエストパラメータ 必要な修正: パラメータ検証
## Missing Tools (❌)
- getHomeTimeline (not found in available tools)
- getFollowers (not available)
- getFollowing (not available)
- getHashtagAnalytics (not available)
## Priority Fixes Needed
1. Parameter Validation:
```typescript
// Implement for getUserTimeline, searchTweets, getLikedTweets
interface TwitterParamValidator {
validateTimelineParams(params: any): boolean;
validateSearchParams(params: any): boolean;
validateLikedTweetsParams(params: any): boolean;
}エラー処理:
// Enhance error handling for 400 errors
interface TwitterErrorHandler {
handle400Error(endpoint: string, params: any): void;
logErrorDetails(error: any): void;
suggestParameterFixes(params: any): string[];
}Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/crazyrabbitLTC/mcp-twitter-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server