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

ライセンス

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

-
security - not tested
A
license - permissive license
-
quality - not tested

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access 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/Dishant27/twitter-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server