Skip to main content
Glama

Give AI agents access to X: read and search posts, publish threads, upload media, manage Lists, send DMs, and see images and video frames.

Install

Requires Node.js 22.18+.

npm install
npm run build

Add it to your MCP client (Claude Desktop, Cursor, Codex, custom agents):

{
  "mcpServers": {
    "x": {
      "command": "node",
      "args": ["/absolute/path/to/x-mcp/dist/index.mjs"],
      "env": { "X_BEARER_TOKEN": "..." }
    }
  }
}

Once published to npm: { "command": "npx", "args": ["-y", "@el4cteo/x-mcp"] }.

Or install the CLI globally:

npm install -g @el4cteo/x-mcp
x-mcp

Related MCP server: x-mcp-server

Sign in

  • Public reads — set X_BEARER_TOKEN.

  • Posting, DMs, bookmarks — run:

node dist/index.mjs auth --client-id YOUR_OAUTH2_CLIENT_ID

Set the X app callback to http://127.0.0.1:8787/callback. Tokens are stored in ~/.config/x-mcp/credentials.json and refreshed automatically. OAuth 1.0a keys (X_API_KEY, X_API_SECRET, X_ACCESS_TOKEN, X_ACCESS_TOKEN_SECRET) also work.

Tools

Ten tools. Each call takes an action plus that action's parameters:

{ "action": "search", "query": "mcp -is:retweet", "max_results": 20 }

Tool

Actions

x_posts

create, create_thread, delete, get, get_many, search, count, thread, likers, reposters, quotes, hide_reply

x_timelines

home, user, mentions, liked, bookmarks

x_users

me, get, get_many, search, followers, following, follow, unfollow, mute, unmute, block, unblock, muted, blocked

x_engagement

like, unlike, repost, unrepost, bookmark, unbookmark

x_lists

create, update, delete, get, owned, memberships, pinned, add_member, remove_member, posts, members, followers, follow, unfollow

x_spaces

search, get, get_many, posts

x_trends

by_location, personalized

x_dms

send, send_to_conversation, events, conversation, with_user, delete

x_media

upload, status, view

x_meta

auth_status, rate_limits, usage

Run node dist/index.mjs tools for descriptions.

See images and video

x_media action view returns the post's media as MCP image content.

  • Photos come back directly; carousels use media_index (0–3).

  • Videos and GIFs are sampled into 1–6 frames when ffmpeg is installed.

  • Without ffmpeg you get the preview frame plus the video URL.

Install ffmpeg: winget install Gyan.FFmpeg (Windows), brew install ffmpeg (macOS), sudo apt install ffmpeg (Linux). Or set X_MCP_FFMPEG.

Limit: 15 MB per image, 200 MB per video; raise with X_MCP_MAX_IMAGE_MB / X_MCP_MAX_VIDEO_MB.

Commands

node dist/index.mjs                 # stdio
node dist/index.mjs serve --http    # http://127.0.0.1:3333/mcp
node dist/index.mjs doctor          # credentials + connection check
node dist/index.mjs auth --logout   # remove tokens

Settings

Variable

Default

Purpose

X_BEARER_TOKEN

—

App-only token for public reads

X_MCP_READ_ONLY

false

Block all writes

X_MCP_DRY_RUN

false

Preview writes without sending

X_MCP_TOOLSETS

all

Expose only some tools, e.g. posts,users

X_MCP_MEDIA_ROOTS

cwd

Directories allowed for uploads

X_MCP_HTTP_TOKEN

—

Bearer token for HTTP mode

Full list in .env.example.

Safety

  • --read-only for research-only agents, --dry-run to preview writes.

  • Media downloads reject private addresses; uploads are restricted to media files in allowed roots.

  • HTTP mode binds to loopback by default and requires a token off-loopback.

  • Posts and DMs are public or permanent — agents are instructed to confirm first.

Development

npm run typecheck
npm test     # 85 tests, no X credentials needed
npm run build

MIT — see LICENSE.

Available Tools

10 tools
x_dmsX Direct MessagesA
Destructive

Send and read Direct Messages: send to a user or an existing conversation, read events, read a conversation, and delete an event.

Actions (pass "action" plus that action's parameters):

  • send: Send a DM to a user, creating the 1:1 conversation if needed. [requires: text]

  • send_to_conversation: Send a message to an existing DM conversation by conversation id. [requires: conversation_id, text]

  • events: Recent Direct Message events across all conversations, newest first (1-100 per page).

  • conversation: Messages in one DM conversation, newest first (1-100 per page). [requires: conversation_id]

  • with_user: Messages exchanged with one user, newest first (1-100 per page).

  • delete: Delete a Direct Message event sent by the authenticated account. [requires: event_id]

Inputs: action (required), text, user_id, event_id, +6 more.

x_engagementX engagementA
Idempotent

Like, repost and bookmark posts, and undo those actions, as the authenticated account.

Actions (pass "action" plus that action's parameters):

  • like: Like a post as the authenticated account. [requires: tweet_id]

  • unlike: Remove a like from a post. [requires: tweet_id]

  • repost: Repost a post to your followers. [requires: tweet_id]

  • unrepost: Remove one of your reposts. [requires: tweet_id]

  • bookmark: Save a post to your bookmarks. [requires: tweet_id]

  • unbookmark: Remove a post from your bookmarks. [requires: tweet_id]

Inputs: action (required), tweet_id.

x_listsX ListsA
DestructiveIdempotent

Manage Lists and read their timelines: create, update, delete, look up, owned/memberships/pinned Lists, add/remove members, list members/followers/posts, follow/unfollow.

Actions (pass "action" plus that action's parameters):

  • create: Create a curated List. [requires: name]

  • update: Rename, re-describe or change the visibility of a List you own. [requires: list_id]

  • delete: Delete a List you own. [requires: list_id]

  • get: Fetch a List by id: name, description, owner, member/follower counts and visibility. [requires: list_id]

  • owned: Lists created by a user (defaults to the authenticated account), 1-100 per page.

  • memberships: Lists a user is a member of (defaults to the authenticated account), 1-100 per page.

  • pinned: Lists pinned to a user profile (defaults to the authenticated account).

  • add_member: Add a user to a List you manage. [requires: list_id, user_id]

  • remove_member: Remove a user from a List you manage. [requires: list_id, user_id]

  • posts: The timeline of a List, newest first (1-100 per page). [requires: list_id]

  • members: Users who belong to a List, 1-100 per page. [requires: list_id]

  • followers: Users who follow a List, 1-100 per page. [requires: list_id]

  • follow: Follow a List so its timeline appears in your Lists tab. [requires: list_id]

  • unfollow: Stop following a List. [requires: list_id]

Inputs: action (required), name, list_id, private, +5 more.

x_mediaX mediaA

Upload media, check video/GIF processing, and view attached media — photos are returned as images, videos are sampled into frames when ffmpeg is installed.

Actions (pass "action" plus that action's parameters):

  • upload: Upload an image, GIF, video or subtitle file and get a media_id to attach to x_posts action "create" or x_dms action "send".

  • status: Poll the processing state of an uploaded video or GIF. [requires: media_id]

  • view: Downloads media attached to a post and returns it as MCP image content, so vision-capable models can actually see pictures instead of only reading URLs.

Inputs: action (required), url, path, base64, +9 more.

x_metaX diagnosticsA
Read-onlyIdempotent

Check credentials, observed rate limits and billed API usage.

Actions (pass "action" plus that action's parameters):

  • auth_status: Diagnose credentials: which auth modes are configured, whether a user session can post/DM, token expiry and scopes, plus the effective server flags (read-only, dry-run, cache, API base).

  • rate_limits: Shows the last rate-limit window X reported for each endpoint (remaining requests and reset time), the in-memory cache hit/miss counters, and whether the server waits or fails when a buck…

  • usage: Current billing-period post consumption for the X project: the cap, how many posts have been consumed, and daily usage.

Inputs: action (required).

x_postsX postsA
Destructive

Create, read, search and moderate posts: publish posts and threads, fetch one or many by id, search recent or full-archive, count volume, reconstruct a conversation, list likers/reposters/quotes, hide replies, delete.

Actions (pass "action" plus that action's parameters):

  • create: Publish a post (tweet), reply or quote on X as the authenticated account. [requires: text]

  • create_thread: Publish a multi-post thread by chaining replies. [requires: posts]

  • delete: Delete a post you authored. [requires: tweet_id]

  • get: Fetch one post with its author, metrics, media, entities and (when present) the quoted or reposted post. [requires: tweet_id]

  • get_many: Fetch up to 100 posts in one request. [requires: tweet_ids]

  • search: Search X posts with the v2 search operators. [requires: query]

  • count: Get post volume for a query without retrieving the posts themselves. [requires: query]

  • thread: Reconstruct a conversation: fetches the root post and finds replies via conversation_id search. [requires: tweet_id]

  • likers: Returns up to 100 users per page who liked the post. [requires: tweet_id]

  • reposters: Returns up to 100 users per page who reposted the post. [requires: tweet_id]

  • quotes: Returns up to 100 posts that quote the given post, with authors and metrics. [requires: tweet_id]

  • hide_reply: Hide a reply to one of your posts, or unhide it. [requires: tweet_id]

Inputs: action (required), poll, text, posts, +19 more.

x_spacesX SpacesA
Read-onlyIdempotent

Search live or scheduled audio Spaces and read the posts shared in them.

Actions (pass "action" plus that action's parameters):

  • search: Find live or scheduled audio Spaces by keyword (up to 100 results). [requires: query]

  • get: Fetch one Space by id: title, state, hosts, participant count and schedule. [requires: space_id]

  • get_many: Batch lookup of up to 100 Spaces by id. [requires: space_ids]

  • posts: Posts attached to a Space, 1-100 per page. [requires: space_id]

Inputs: action (required), query, state, space_id, +3 more.

x_timelinesX timelinesA
Read-onlyIdempotent

Read home and user timelines, mentions, liked posts and your bookmarks.

Actions (pass "action" plus that action's parameters):

  • home: Reverse-chronological home timeline for the authenticated account.

  • user: Timeline of posts authored by a user (1-100 per page).

  • mentions: Posts that mention a user (1-100 per page).

  • liked: Posts liked by a user, newest first (1-100 per page).

  • bookmarks: The authenticated account's bookmarks (1-100 per page).

Inputs: action (required), exclude, user_id, end_time, +4 more.

x_usersX usersA
DestructiveIdempotent

Profiles and relationships: look up me/one/many, search users, followers, following, follow/unfollow, mute/unmute, block/unblock, muted and blocked lists.

Actions (pass "action" plus that action's parameters):

  • me: Profile of the authenticated account: id, handle, bio, follower counts and pinned post.

  • get: Look up one account by handle or numeric id.

  • get_many: Batch lookup of up to 100 accounts by handle or id in a single request.

  • search: Search accounts by keyword (name, handle, bio) with 1-100 results per page. [requires: query]

  • followers: Accounts following a user, 1-1000 per page (X caps at 1000).

  • following: Accounts a user follows, 1-1000 per page.

  • follow: Follow an account as the authenticated user.

  • unfollow: Unfollow an account as the authenticated user.

  • mute: Mute an account for the authenticated user.

  • unmute: Unmute an account for the authenticated user.

  • block: Block an account on behalf of the authenticated user.

  • unblock: Unblock an account.

  • muted: Accounts muted by the authenticated user (1-100 per page).

  • blocked: Accounts blocked by the authenticated user (1-1000 per page).

Inputs: action (required), query, user_id, user_ids, +6 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool is scoped to a distinct X resource or domain: posts, users, timelines, lists, DMs, media, Spaces, trends, engagement, and metadata. Overlaps such as reading liked posts versus liking a post are clearly separated by tool purpose and action descriptions.

    Naming Consistency5/5

    All tool names follow a consistent x_<resource> pattern and all action names use snake_case. Minor singular/plural differences such as x_engagement versus x_posts do not undermine predictability.

    Tool Count5/5

    The 10 tools are well-scoped groups for a broad API, keeping the tool surface manageable while still exposing the necessary operations. Each tool earns its place as a coherent resource bucket.

    Completeness5/5

    The set covers the core lifecycle for posts, users, lists, DMs, media, Spaces, trends, engagement actions, and operational metadata. Read/write, search, batch lookup, moderation, and relationship operations are all represented, leaving no obvious workflow dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • 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 AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.
      23 PyPI
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      Enables AI agents to search, read user profiles, timelines, media, follow threads, track trends, and manage accounts on X/Twitter via GraphQL, without browser automation or paid API keys.
      100
      11
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides 19+ tools for AI agents to interact with X/Twitter, including search, posting, analysis, and monitoring capabilities.
      17 npm
      3
      MIT