インストール不要。2分以内に動きます。
cloud.anythingmcp.com で無料トライアルを開始し、X (Twitter) をワンクリックで追加して、AI クライアント(Claude、ChatGPT、Copilot、Cursor)を生成された MCP エンドポイントに向けるだけ。Docker も git clone も、開発経験も不要です。
概要
AI に X(旧 Twitter)で作業させます。投稿、タイムライン、メンション、ブックマーク、リスト、ダイレクトメッセージの閲覧と検索、アカウントとフォロワーの参照に加え、あなたの確認後には投稿、返信、引用の公開、いいね、リポスト、DM の送信ができます。
こう聞いてみよう
X (Twitter) のサンプルプロンプト
プロンプトをクリックでコピー。Claude / ChatGPT / Cursor / Gemini / Copilot / OpenClaw に貼り付けて、このコネクターで実行できます。
Claude は AI のため誤ることがあります。回答をご確認ください。
💡 インストール不要? cloud.anythingmcp.com を直接利用してください。 サインインし、Connectors → X (Twitter) をクリック、認証情報を貼り付け、MCP API キーを発行すれば完了です。Docker も
git cloneもローカルサーバーも不要。
X (Twitter) + Gemini
AI に X(旧 Twitter)で作業させます。投稿、タイムライン、メンション、ブックマーク、リスト、ダイレクトメッセージの閲覧と検索、アカウントとフォロワーの参照に加え、あなたの確認後には投稿、返信、引用の公開、いいね、リポスト、DM の送信ができます。
前提条件
完全なセットアップ手順はコネクタ自体に組み込まれています (ストアでコネクタを選択すると表示)。必要な環境変数:
X_CLIENT_ID, X_CLIENT_SECRET
ステップ 1 — 認証情報を取得
https://console.x.comで X Developer Console を開き、アプリの所有者となる X アカウントでサインインして、Create App をクリックします。- 請求(billing)の設定で API クレジットを追加します。X API はプリペイドクレジットによる従量課金制で、新規の開発者には無料プランがありません。クレジットがないと、X はすべての呼び出しを拒否します。
- アプリの User authentication settings を開き、Set up をクリックします。アプリの権限に Read and write and Direct message(DM ツールを使わない場合は Read and write で十分です)、アプリの種類に Web App, Automated App or Bot を選び、ウェブサイトの URL とコールバック URI
https://cloud.anythingmcp.com/api/mcp-oauth/callbackを入力します。AnythingMCP をセルフホストしている場合は<your AnythingMCP URL>/api/mcp-oauth/callbackです。X は末尾のスラッシュも含めて 1 文字ずつ照合します。ローカル環境ではlocalhostではなく127.0.0.1を使い、http://127.0.0.1:<port>/api/mcp-oauth/callbackとします。 - OAuth 2.0 Client ID と Client Secret を
X_CLIENT_IDとX_CLIENT_SECRETにコピーします。X はシークレットを一度しか表示しません。アプリの API Key、API Secret、Bearer Token は別のサインイン方式用のもので、ここでは使いません。 - コネクターをインストールし、Authorize with Provider をクリックして、X でアクセスを許可します。サインインには OAuth 2.0 を使うため、AnythingMCP が X のパスワードを目にすることはありません。アクセストークン(有効期間は 2 時間)は AnythingMCP が自動で更新します。
- まず
x_get_meを実行します。アカウント情報と数値のユーザー ID が返ります。この ID は、タイムライン、いいね、リポスト、ブックマーク、フォローの各ツールで必要です。x_get_user_by_usernameは任意の @username を ID に変換します。
料金: X は読み取りと投稿のたびにクレジット残高から課金します。公開は読み取りより高く、リンク付きの投稿はさらに大幅に高くなります。サインインに使うアカウントが開発者アプリの所有者でもある場合、自分のデータの読み取りは安くなります。また、同じ UTC 日に同じアイテムを 2 回読み取っても課金は 1 回です。Developer Console で利用上限を設定し、X の最新料金を https://docs.x.com/x-api/getting-started/pricing で確認してください。返されるアイテムはすべてカウントされるため、取得する結果を減らせば費用を抑えられます。
まず確認を: 投稿、返信、引用、リポスト、ダイレクトメッセージ(x_create_post、x_reply_to_post、x_quote_post、x_repost、x_send_dm、x_send_dm_to_conversation)はすぐに送信されるため、AI は正確な文面と宛先を示し、あなたの了承を待ちます。アカウントのフォローとフォロー解除も確認を経て行います。x_delete_post と x_delete_dm は、インストール時はオフになっています。
返信: API 経由で送った返信を X が受け付けるのは、元の投稿の作成者があなたのアカウントをメンションまたは引用している場合だけです。自分のスレッド内での返信や、自分へのメンションへの返信は可能です。
検索とメッセージ: 検索の対象は直近 7 日間で、from:、to:、#hashtag、"exact phrase"、-is:retweet、lang:en などの X の演算子に対応しています。x_count_recent_posts は、該当する投稿を読み取らずに件数だけを数えます。ダイレクトメッセージは直近 30 日分が対象です。暗号化された会話は API では利用できません。
読み取り専用または DM なしにするには: コネクターの OAuth 設定で .write スコープ、または dm. スコープを削除し、もう一度認可して、それらを必要とするツールをオフにします。
よくあるエラー: 401 は認可が取り消されたか client secret が変更されたことを示すので、もう一度認可してください。client-forbidden または client-not-enrolled を伴う 403 は、アプリが従量課金になっていないことを示します。Developer Console でアプリを Pay-per-use パッケージと Production 環境に移し、クレジットを追加してください。以前は動いていた呼び出しが失敗する場合、たいていはクレジットか利用上限を使い切っています。429 は X のレート制限で、15 分ごとにリセットされます。
このコネクターは、メディアのアップロード(投稿はテキストか投票のみ)、全アーカイブの検索、投稿のストリーミング、リストの管理、アカウントのミュートやブロック、広告の運用には対応していません。
ステップ 2 — アダプターをインストール
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
ステップ 3 — Gemini にコネクタを追加
サーバーURL: AnythingMCP で MCP Servers を開き、このコネクタがあるサーバーを選んで URL(
https://cloud.anythingmcp.com/mcp/…)をコピーします。このガイドでYOUR_SERVER_IDと表示されている箇所に使ってください。
Gemini CLI は ~/.gemini/settings.json(Windows では %USERPROFILE%\.gemini\settings.json)から MCP サーバーを読み込みます。次を追加してください:
{
"mcpServers": {
"anythingmcp": {
"httpUrl": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
"headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
}
}
}
- AnythingMCP の MCP Servers → 対象のサーバー → API keys で MCP API キーを作成し、
YOUR_MCP_API_KEYと置き換えます。 - ファイルを保存し、
geminiを再起動します。 - Gemini CLI で
/mcpを実行します(またはシェルでgemini mcp list)。anythingmcpが接続済みとして表示されるはずです。 - プロンプトを入力しましょう。Gemini CLI が
X (Twitter)のツールを呼び出せるようになりました。
利用可能なツール
| Tool | What it does |
|---|---|
x_get_me | Read the X account that authorized the connector: id, name, @username and the user fields asked for |
x_get_user_by_username | Look up one X account by its @username (without the @): id, name, bio, follower and post counts and more |
x_get_users_by_usernames | Look up up to 100 X accounts by @username in one call |
x_get_user | Look up one X account by its numeric user id: name, @username, bio, counts and the user fields asked for |
x_search_users | Find X accounts by name or @username keywords |
x_get_post | Read one post by id: text, author_id, time, metrics and the fields asked for |
x_get_posts | Read up to 100 posts by id in one call |
x_list_user_posts | List the most recent posts of an account (up to the last 3,200), newest first |
x_list_user_mentions | List the most recent posts that mention an account (up to the last 800), newest first |
x_get_home_timeline | Read your home timeline in reverse chronological order: posts and reposts from you and the accounts you follow |
x_search_recent_posts | Search posts from the last 7 days with X search operators, e.g. "anythingmcp lang:en -is:retweet", from:username, to:username, #hashtag… |
x_count_recent_posts | Count the posts of the last 7 days that match a search query, per minute, hour or day, without reading them |
x_list_quote_posts | List the posts that quote a given post, newest first, with the quoting text and author_id |
x_list_reposted_by | List the accounts that reposted a post, with the user fields asked for |
x_list_liking_users | List the accounts that liked a post |
x_create_post | Publish a new post on the authorized account, visible to everyone at once |
x_reply_to_post | Publish a reply to a post, visible to everyone at once |
x_quote_post | Publish a post that quotes another post with your comment, visible to everyone at once |
x_delete_post | Delete one of your own posts for good |
x_list_liked_posts | List the posts an account liked, newest like first |
x_like_post | Like a post as the authorized account |
x_unlike_post | Remove your like from a post you liked before |
x_repost | Repost a post to your followers, visible to everyone at once |
x_undo_repost | Take back your repost of a post; the original post stays |
x_list_bookmarks | List your bookmarked posts, most recently bookmarked first (up to the last 800) |
x_add_bookmark | Bookmark a post |
x_remove_bookmark | Remove a post from your bookmarks |
x_list_followers | List the accounts that follow an account, newest follower first |
x_list_following | List the accounts an account follows, most recently followed first |
x_follow_user | Follow an account as the authorized account; the other account is notified |
x_unfollow_user | Stop following an account as the authorized account |
x_list_owned_lists | List the X Lists an account owns: id, name, description, member and follower counts |
x_list_followed_lists | List the X Lists an account follows: id, name, description, member and follower counts |
x_get_list | Read one X List: name, description, member and follower counts, whether it is private and when it was created |
x_list_list_posts | Read the latest posts from the members of an X List, newest first |
x_list_list_members | List the accounts that are members of an X List, with the user fields asked for |
x_list_dm_events | List your recent direct messages across all conversations (the last 30 days), newest first |
x_list_dm_conversation_with_user | Read your one-to-one direct message conversation with another account (the last 30 days), newest first |
x_send_dm | Send a direct message to an account, in your one-to-one conversation with it (created when needed) |
x_send_dm_to_conversation | Send a direct message into an existing conversation (one-to-one or group) by its dm_conversation_id from x_list_dm_events |
x_delete_dm | Delete one of your direct messages, for you only (the other side keeps it) |
プロンプトの例
- 「今日の自分のアカウントへのメンションを表示して、質問しているものには返信の下書きを作成してください。」
- 「直近 7 日間の当社の製品ローンチに関する投稿を検索して、全体のトーンをまとめてください。」
- 「今週、#ourbrand に言及した投稿は 1 日あたり何件ありましたか?」
- 「新しい料金ページを告知する投稿の下書きを作成し、私が文面を承認したら公開してください。」
FAQ
Gemini CLI はどこから MCP サーバーを読み込みますか? ユーザー単位では ~/.gemini/settings.json、プロジェクト単位ではプロジェクト内の .gemini/settings.json です。gemini mcp list で各サーバーと接続状態を確認できます。
次のステップ
このガイドは役に立ちましたか?