Skip to main content
Glama
Dishant27

X (Twitter) MCP Server

by Dishant27

X (Twitter) MCP サーバー

この MCP サーバーにより、クライアントは X (旧 Twitter) と対話できるようになり、ツイートの投稿、コンテンツの検索、アカウントの管理、リストの整理などの包括的なプラットフォーム操作が可能になります。

クイックスタート

  1. X 開発者アカウントを作成し、 X 開発者ポータルから API キーを取得します。

  2. 必要なAPIキーをすべて環境変数に設定する

  3. このリポジトリをクローンします: git clone https://github.com/Dishant27/twitter-mcp.git

  4. 依存関係をインストール: npm install

  5. サーバーを実行します。

  • 環境変数を使用する場合:

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 start
  1. Claude などの 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-servers

  • macOS: ~/Library/Application Support/AnthropicClaude/mcp-servers

  • Linux: ~/.config/AnthropicClaude/mcp-servers

特徴

ポストオペレーション

  • 投稿内容(最大280文字)

  • カスタマイズ可能な結果件数でクエリによる投稿を検索

アカウント管理

  • 任意のユーザーまたは認証されたアカウントのプロフィール情報を取得する

  • プロフィールの詳細(名前、経歴、所在地、ウェブサイトの URL)を更新します

  • ユーザーのフォローとフォロー解除

  • 任意のユーザーまたは認証されたアカウントのフォロワーを一覧表示します

  • ユーザーがフォローしているアカウントを一覧表示する

リスト管理

  • 新しいリストを作成する(公開または非公開)

  • 特定のリストに関する情報を取得する

  • 認証されたユーザーが所有するすべてのリストを取得する

利用可能なMCPツール

ツール名

説明

post_tweet

Xに新しいコンテンツを投稿する

search_tweets

Xでコンテンツを検索

get_profile

ユーザーまたは認証されたアカウントのプロフィール情報を取得する

update_profile

認証されたユーザーのプロフィールを更新する

follow_user

ユーザーをフォローする

unfollow_user

ユーザーのフォローを解除する

list_followers

ユーザーまたは認証されたアカウントのフォロワーを一覧表示する

list_following

ユーザーまたは認証されたアカウントがフォローしているアカウントを一覧表示する

create_list

新しいリストを作成する

get_list_info

リストに関する情報を取得する

get_user_lists

認証されたユーザーが所有するすべてのリストを取得する

要件

  • Node.js 18.x 以上

  • X APIキー付き開発者アカウント

  • API v1およびv2アクセス

環境変数

変数

説明

TWITTER_API_KEY

APIキー

TWITTER_API_SECRET

APIシークレット

TWITTER_ACCESS_TOKEN

アクセストークン

TWITTER_ACCESS_TOKEN_SECRET

アクセストークンシークレット

リポジトリ構造

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

ライセンス

マサチューセッツ工科大学

Related MCP Connectors

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    Enables 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.
    3
    9 npm
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables LLM agents to interact with Twitter (X) for searching tweets, posting content with images, analyzing engagement, and extracting topics using the Twitter API.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables 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
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.
    29 PyPI
    MIT