Skip the install. Get this working in under 2 minutes.
Start a free trial on cloud.anythingmcp.com, add the X (Twitter) in one click, then point your AI client (Claude, ChatGPT, Copilot or Cursor) at the generated MCP endpoint. No Docker, no git clone, zero engineering experience required.
Summary
Let your AI work with X (formerly Twitter): read and search posts, your timeline, mentions, bookmarks, Lists and direct messages, look up accounts and followers, and publish posts, replies and quotes, like, repost and send DMs after your confirmation.
Try asking
Example prompts for X (Twitter)
Click any prompt to copy it. Paste into Claude, ChatGPT, Cursor, Gemini, Copilot or OpenClaw to run it against this connector.
Claude is AI and can make mistakes. Please double-check responses.
💡 No install? Use cloud.anythingmcp.com directly. Sign in, click Connectors → X (Twitter), paste your credentials, mint an MCP API key and you're done. No Docker, no
git clone, no local server.
X (Twitter)
Let your AI work with X (formerly Twitter): read and search posts, your timeline, mentions, bookmarks, Lists and direct messages, look up accounts and followers, and publish posts, replies and quotes, like, repost and send DMs after your confirmation.
Setup
- Open the X Developer Console at
https://console.x.com, sign in with the X account that will own the app and click Create App. - Add API credits under billing. The X API is pay-per-use with prepaid credits, and new developers get no free plan: without credits, X refuses every call.
- Open the app's User authentication settings and click Set up. Choose the app permissions Read and write and Direct message (Read and write is enough if you leave out the DM tools), the type of app Web App, Automated App or Bot, a website URL, and the callback URI
https://cloud.anythingmcp.com/api/mcp-oauth/callback. If you host AnythingMCP yourself, it is<your AnythingMCP URL>/api/mcp-oauth/callback. X compares it character for character, trailing slash included. For a local setup use127.0.0.1, notlocalhost:http://127.0.0.1:<port>/api/mcp-oauth/callback. - Copy the OAuth 2.0 Client ID and Client Secret into
X_CLIENT_IDandX_CLIENT_SECRET. X shows the secret only once. The app's API Key, API Secret and Bearer Token belong to other sign-in methods and are not used here. - Install the connector, click Authorize with Provider and allow access on X. The sign-in uses OAuth 2.0, so AnythingMCP never sees your X password, and it renews the access tokens (valid for two hours) on its own.
- Start with
x_get_me: it returns your account and the numeric user id that the timeline, like, repost, bookmark and follow tools need.x_get_user_by_usernameturns any @username into its id.
What it costs: X bills every read and every post from your credit balance. Publishing costs more than reading, and a post with a link costs much more. Reads of your own data are cheaper when the account you sign in with also owns the developer app, and the same item read twice in one UTC day is billed once. Set a spending limit in the Developer Console and check X's current prices at https://docs.x.com/x-api/getting-started/pricing. Asking for fewer results keeps the bill down, because every item returned counts.
Confirm first: posts, replies, quotes, reposts and direct messages (x_create_post, x_reply_to_post, x_quote_post, x_repost, x_send_dm, x_send_dm_to_conversation) go out at once, so the AI shows you the exact text and the recipient and waits for your yes. Following and unfollowing accounts is confirmed too. x_delete_post and x_delete_dm are switched off at install.
Replies: X only accepts a reply sent through the API when the author of the original post mentioned or quoted your account. Replying in your own threads and to your mentions works.
Search and messages: search covers the last 7 days and understands X's operators, such as from:, to:, #hashtag, "exact phrase", -is:retweet or lang:en. x_count_recent_posts counts matching posts without reading them. Direct messages cover the last 30 days; encrypted conversations are not available through the API.
Read-only or no DMs: remove the .write scopes, or the dm. scopes, in the connector's OAuth settings, authorize again and switch off the tools that need them.
Common errors: 401 means the authorization was revoked or the client secret changed, so authorize again. 403 with client-forbidden or client-not-enrolled means the app is not on pay-per-use: in the Developer Console move it to the Pay-per-use package and the Production environment, and add credits. Calls that fail after they used to work usually mean the credits or the spending limit ran out. 429 is X's rate limit, which resets every 15 minutes.
The connector does not upload media (posts are text or polls), search the full archive, stream posts, manage Lists, mute or block accounts, or run ads.
Prerequisites: X_CLIENT_ID, X_CLIENT_SECRET
Install the connector locally
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
Open http://localhost:3000/connectors/store, pick X (Twitter) and paste in the env vars listed under Prerequisites.
Available tools
| 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) |
Example prompts
- "Show me today's mentions of my account and draft a reply to the ones that ask a question."
- "Search posts from the last 7 days about our product launch and sum up the tone."
- "How many posts mentioned #ourbrand each day this week?"
- "Draft a post announcing our new pricing page and publish it once I approve the text."
Next steps
Was this guide helpful?