x-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@x-mcp show me my timeline"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
x-mcp
A Model Context Protocol (MCP) server for the X (Twitter) API. Built with the official @xdevplatform/xdk SDK and OAuth 2.0 PKCE authentication.
Features
23 tools across users, posts, bookmarks, likes, and lists
OAuth 2.0 PKCE with automatic token refresh
Dual output: markdown (human-readable) or JSON (structured)
MCP tool annotations:
readOnlyHint,destructiveHint,idempotentHint
Related MCP server: TwitGhost
Prerequisites
Node.js v18+
pnpm
X API OAuth 2.0 credentials (Client ID and Secret)
Setup
Install dependencies:
pnpm installConfigure environment:
cp .env.example .envEdit
.env:X_CLIENT_ID=your_oauth2_client_id X_CLIENT_SECRET=your_oauth2_client_secret X_REDIRECT_URI=http://localhost:3000/callbackAuthenticate:
pnpm run setup-authBuild:
pnpm run build
Getting X API Credentials
Go to the X Developer Portal
Create a Project and App
Enable OAuth 2.0 in app settings
Set app type to Web App
Add callback URL:
http://localhost:3000/callbackCopy Client ID and Client Secret from the OAuth 2.0 section
Claude Desktop Integration
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"x-mcp": {
"command": "node",
"args": ["/path/to/x-mcp/dist/index.js"],
"env": {
"X_TOKENS_PATH": "/path/to/x-mcp/.tokens.json",
"X_CLIENT_ID": "your_client_id",
"X_CLIENT_SECRET": "your_client_secret",
"X_REDIRECT_URI": "http://localhost:3000/callback"
}
}
}
}Tools
Users
Tool | Description | Parameters |
| Fetch a user profile by username |
|
| Get the authenticated user's profile |
|
| Get a user's followers |
|
| Get accounts a user follows |
|
Posts
Tool | Description | Parameters |
| Fetch recent posts from a user (excludes retweets/replies) |
|
| Get your home timeline (reverse chronological) |
|
| Search recent posts (last 7 days) |
|
Bookmarks
Tool | Description | Parameters |
| Fetch your bookmarked posts |
|
| Bookmark a post |
|
| Remove a bookmark |
|
Likes
Tool | Description | Parameters |
| Fetch your liked posts |
|
| Like a post |
|
| Unlike a post |
|
Lists
Tool | Description | Parameters |
| Get your owned lists |
|
| Get list details by ID |
|
| Get posts from a list |
|
| Get members of a list |
|
| Create a new list |
|
| Update a list |
|
| Delete a list |
|
| Add a user to a list |
|
| Remove a user from a list |
|
Project Structure
src/
├── index.ts # MCP server entry point
├── constants.ts # Shared constants
├── types.ts # TypeScript interfaces
├── setup-auth.ts # OAuth 2.0 setup flow
├── schemas/
│ └── common.ts # Shared Zod schemas
├── services/
│ ├── auth-manager.ts # OAuth 2.0 token management
│ └── x-client.ts # X API client wrapper
├── tools/
│ ├── users.ts # User profile tools
│ ├── tweets.ts # Post/timeline tools
│ ├── bookmarks.ts # Bookmark tools
│ ├── likes.ts # Like tools
│ └── lists.ts # List management tools
└── utils/
└── formatting.ts # Response formatting helpersScripts
Command | Description |
| Compile TypeScript |
| Run in development mode |
| Run compiled server |
| Authenticate with X |
| Reset saved tokens |
API Access Tiers
Tier | What works |
Free | Post creation, basic read access |
Basic ($200/mo) | All read/write endpoints, followers/following |
Pro ($5,000/mo) | Higher rate limits, full search |
License
MIT
Available Tools
22 toolsx_add_bookmarkBookmark PostAIdempotent
Add a post to the authenticated user's bookmarks by its ID.
Inputs: tweet_id (required).
x_add_list_memberAdd List MemberBIdempotent
Add a user to a list by their username and the list ID.
Inputs: list_id (required), username (required).
x_create_listCreate ListA
Create a new X list with a name, optional description, and privacy setting.
Inputs: name (required), private, description.
x_delete_listDelete ListADestructive
Permanently delete a list by its ID. This cannot be undone.
Inputs: list_id (required).
x_get_followersGet X User FollowersARead-onlyIdempotent
Get a list of users who follow a specified account. Returns usernames, bios, and follower counts.
Inputs: username (required), limit, response_format.
x_get_followingGet X User FollowingARead-onlyIdempotent
Get a list of users that a specified account follows. Returns usernames, bios, and follower counts.
Inputs: username (required), limit, response_format.
x_get_listGet List DetailsARead-onlyIdempotent
Get details of a specific list by its ID. Returns name, description, member/follower counts, and privacy.
Inputs: list_id (required), response_format.
x_get_list_membersGet List MembersBRead-onlyIdempotent
Get members of a specific list by its ID.
Inputs: list_id (required), limit, response_format.
x_get_list_postsGet List PostsARead-only
Get recent posts from a specific list by its ID.
Inputs: list_id (required), limit, response_format.
x_get_my_bookmarksGet My BookmarksARead-onlyIdempotent
Fetch posts bookmarked by the authenticated user. Returns post text, engagement metrics, and timestamps.
Inputs: limit, response_format.
x_get_my_likesGet My Liked PostsARead-onlyIdempotent
Fetch posts liked by the authenticated user. Returns post text, engagement metrics, and timestamps.
Inputs: limit, response_format.
x_get_my_listsGet My ListsARead-onlyIdempotent
Get lists owned by the authenticated user. Returns list name, description, member/follower counts, and privacy.
Inputs: response_format.
x_get_my_profileGet My X ProfileARead-onlyIdempotent
Get the authenticated user's X profile including bio, metrics, and account info.
Inputs: response_format.
x_get_my_timelineGet My TimelineARead-only
Get the authenticated user's home timeline (reverse chronological). Includes posts from accounts you follow.
Inputs: limit, response_format.
x_get_user_postsGet User PostsARead-onlyIdempotent
Fetch recent posts from a user's timeline by username. Excludes retweets and replies.
Inputs: username (required), limit, response_format.
x_get_user_profileGet X User ProfileARead-onlyIdempotent
Fetch an X user profile by username. Returns bio, follower/following counts, post count, and account creation date.
Inputs: username (required), response_format.
x_like_postLike PostAIdempotent
Like a post by its ID on behalf of the authenticated user.
Inputs: tweet_id (required).
x_remove_bookmarkRemove BookmarkADestructiveIdempotent
Remove a post from the authenticated user's bookmarks by its ID.
Inputs: tweet_id (required).
x_remove_list_memberRemove List MemberADestructiveIdempotent
Remove a user from a list by their username and the list ID.
Inputs: list_id (required), username (required).
x_search_postsSearch PostsARead-onlyIdempotent
Search for recent posts (last 7 days) matching a query. Supports keywords, hashtags, and X search operators.
Inputs: query (required), limit, response_format.
x_unlike_postUnlike PostADestructiveIdempotent
Remove a like from a post by its ID on behalf of the authenticated user.
Inputs: tweet_id (required).
x_update_listUpdate ListAIdempotent
Update an existing list's name, description, or privacy. Provide at least one field to change.
Inputs: list_id (required), name, private, description.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Every tool targets a distinct resource and action. For example, x_get_user_profile vs x_get_my_profile clearly separate public vs authenticated profiles, and x_get_user_posts vs x_get_my_timeline distinguish a user's own posts from the home feed. No two tools have overlapping or ambiguous purposes.
All tools follow a consistent x_ prefix with an action_noun pattern. Actions (get, search, add, remove, like, unlike, create, update, delete) are used uniformly, and the resource nouns are clear. The consistent style makes it easy to predict tool names.
With 22 tools, the set falls into the 16-25 range, which feels heavy. While each tool serves a distinct purpose and covers many X features, the count is above the typical well-scoped 3-15 range, making it borderline. The abundance of list-related tools (7) contributes to the heaviness.
The server covers read operations, bookmarks, likes, and full list management, but it lacks core X actions like creating posts, replying, retweeting, and following/unfollowing users. This is a significant gap that would prevent agents from performing fundamental social media interactions, limiting the server's usefulness.
Maintenance
Related MCP Connectors
Official twitterapi.io hosted MCP: Twitter/X tweets, users, followers, trends. OAuth or API key.
Hosted MCP server from TwitterAPI.io that gives AI agents read-only access to Twitter/X data. 12 tools: tweet search with X operators, user profiles, a user's latest tweets, followers and followings, replies, quotes, retweeters, mentions and trends. Connect at https://mcp.twitterapi.io/mcp with a TwitterAPI.io API key or account sign-in; usage is paid per result returned.
Search, label, and manage your X (Twitter) bookmarks from any MCP client via Tweetsmash
Official MCP server for twitterapis.com. Twitter/X search, users, DMs, Grok, monitoring and writes.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides programmatic X (Twitter) engagement via MCP, offering 24 tools for search, timelines, notifications, bookmarks, profiles, and tweet actions through a headless browser.MIT
- AlicenseBqualityDmaintenanceEnables interacting with Twitter/X through natural language, including searching tweets, posting, sending DMs, and managing timelines via any MCP client.8MIT
- AlicenseNot gradedqualityCmaintenanceProvides MCP tools for social media, including publishing posts and retrieving analytics via X (Twitter) API v2, with OAuth token management and rate-limit handling.38 npmApache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables MCP-based interaction with the X (Twitter) API v2, supporting reads like timeline, mentions, and search, and writes through a two-step draft-and-confirm process that ensures human-visible previews before any public post.-