Connector guide8-minute read41 MCP tools7 languages

X (Twitter) to MCP: Drive X (Twitter) from any AI Agent

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.

HCBy HelpCode teamUpdated 8 min read Open-source on GitHub

No credit card · 7-day trial · Self-host alternative available

X (Twitter)

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.

tools

41

Region

INTL

Category

Social Media

Authentication

OAuth 2.0

Required env vars

X_CLIENT_IDX_CLIENT_SECRET
Install in one click on Cloud

7-day free trial · No credit card

  • 7-day free trial
    No credit card required
  • GDPR & SOC 2 ready
    EU data residency, audit logs
  • Open-source on GitHub
    Open source · AGPL-3.0
  • Works with ChatGPT, Claude, Gemini
    Any MCP-compatible client

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.

Start free trial

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.

X (Twitter) · live via MCP
Share
Opus 4.7

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

  1. 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.
  2. 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.
  3. 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 use 127.0.0.1, not localhost: http://127.0.0.1:<port>/api/mcp-oauth/callback.
  4. Copy the OAuth 2.0 Client ID and Client Secret into X_CLIENT_ID and X_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.
  5. 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.
  6. 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_username turns 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

ToolWhat it does
x_get_meRead the X account that authorized the connector: id, name, @username and the user fields asked for
x_get_user_by_usernameLook up one X account by its @username (without the @): id, name, bio, follower and post counts and more
x_get_users_by_usernamesLook up up to 100 X accounts by @username in one call
x_get_userLook up one X account by its numeric user id: name, @username, bio, counts and the user fields asked for
x_search_usersFind X accounts by name or @username keywords
x_get_postRead one post by id: text, author_id, time, metrics and the fields asked for
x_get_postsRead up to 100 posts by id in one call
x_list_user_postsList the most recent posts of an account (up to the last 3,200), newest first
x_list_user_mentionsList the most recent posts that mention an account (up to the last 800), newest first
x_get_home_timelineRead your home timeline in reverse chronological order: posts and reposts from you and the accounts you follow
x_search_recent_postsSearch 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_postsCount the posts of the last 7 days that match a search query, per minute, hour or day, without reading them
x_list_quote_postsList the posts that quote a given post, newest first, with the quoting text and author_id
x_list_reposted_byList the accounts that reposted a post, with the user fields asked for
x_list_liking_usersList the accounts that liked a post
x_create_postPublish a new post on the authorized account, visible to everyone at once
x_reply_to_postPublish a reply to a post, visible to everyone at once
x_quote_postPublish a post that quotes another post with your comment, visible to everyone at once
x_delete_postDelete one of your own posts for good
x_list_liked_postsList the posts an account liked, newest like first
x_like_postLike a post as the authorized account
x_unlike_postRemove your like from a post you liked before
x_repostRepost a post to your followers, visible to everyone at once
x_undo_repostTake back your repost of a post; the original post stays
x_list_bookmarksList your bookmarked posts, most recently bookmarked first (up to the last 800)
x_add_bookmarkBookmark a post
x_remove_bookmarkRemove a post from your bookmarks
x_list_followersList the accounts that follow an account, newest follower first
x_list_followingList the accounts an account follows, most recently followed first
x_follow_userFollow an account as the authorized account; the other account is notified
x_unfollow_userStop following an account as the authorized account
x_list_owned_listsList the X Lists an account owns: id, name, description, member and follower counts
x_list_followed_listsList the X Lists an account follows: id, name, description, member and follower counts
x_get_listRead one X List: name, description, member and follower counts, whether it is private and when it was created
x_list_list_postsRead the latest posts from the members of an X List, newest first
x_list_list_membersList the accounts that are members of an X List, with the user fields asked for
x_list_dm_eventsList your recent direct messages across all conversations (the last 30 days), newest first
x_list_dm_conversation_with_userRead your one-to-one direct message conversation with another account (the last 30 days), newest first
x_send_dmSend a direct message to an account, in your one-to-one conversation with it (created when needed)
x_send_dm_to_conversationSend a direct message into an existing conversation (one-to-one or group) by its dm_conversation_id from x_list_dm_events
x_delete_dmDelete 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?

Your X agent is one click away.

Install the connector, paste the key, prompt your AI client. Free for 7 days, no credit card.

Related guides

Connectors

How to Connect X (Twitter) to ChatGPT via MCP

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.

Connectors

How to Connect X (Twitter) to Claude via MCP

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.

Connectors

How to Connect X (Twitter) to Cursor via MCP

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.

Connectors

How to Connect X (Twitter) to Gemini via MCP

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.

Connectors

How to Connect X (Twitter) to Meta Muse via MCP

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.

Connectors

Canva to MCP: Drive Canva from any AI Agent

Let your AI work in Canva: find and read designs, create new ones, export them to PDF, PNG, PowerPoint or video with download links, organise folders, upload images from a link, read brand templates and comment on designs.