- Home
- MCP servers
- X AI
X AI
- python
0
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"olivier-motium-x-ai-mcp": {
"command": "claude",
"args": [
"mcp",
"add",
"x-ai",
"-e",
"X_BEARER_TOKEN=xxx",
"-e",
"X_USER_ID=xxx",
"-e",
"XAI_API_KEY=xxx",
"--",
"python",
"-m",
"src.server"
],
"env": {
"X_USER_ID": "123456789",
"XAI_API_KEY": "<your-xai-key>",
"X_CLIENT_ID": "<your-client-id>",
"X_BEARER_TOKEN": "ya29.a0AfH6SM..."
}
}
}
}You deploy and run an MCP server that combines personal X account access with AI-powered analysis. It exposes 16 X API tools for reading and writing actions and 4 Grok-powered intelligence tools, enabling real-time insights and automation in a single package.
How to use
To use this MCP server, install it, configure your credentials, and connect via an MCP client. You will then access two groups of capabilities: X API tools for standard social data operations and Grok-powered intelligence tools for real-time analysis and summaries. Use the provided start command to launch the local MCP instance and grant OAuth access for write operations if needed.
How to install
Prerequisites you need before installation have Python and a virtual environment available on your system.
# Step 1: Clone the MCP server repository
git clone https://github.com/olivier-motium/x-ai-mcp.git
# Step 2: Enter the project directory
cd x-ai-mcp
# Step 3: Create and activate a virtual environment
python -m venv .venv && source .venv/bin/activate
# Step 4: Install the package in editable mode
pip install -e .
Additional configuration and startup
Configure the required credentials and optional keys before running the server. Copy the example environment file and fill in the values you obtain from X and xAI services.
# Example environment variables to fill in
X_BEARER_TOKEN=your_bearer_token # Required — X API bearer token (read-only operations)
X_USER_ID=your_user_id # Required — your X user ID
# Optional — OAuth for write operations
# Run: python scripts/auth_flow.py
X_CLIENT_ID=your_client_id
# Optional — xAI key for intelligence tools
XAI_API_KEY=your_xai_key
Starting the MCP server locally
Once you have set up environment variables, you can start the MCP server via the provided startup command configured in Claude Code. Use the following command to register the MCP under your Claude environment and launch the Python server.
claude mcp add x-ai \
-e X_BEARER_TOKEN=xxx \
-e X_USER_ID=xxx \
-e XAI_API_KEY=xxx \
-- python -m src.server
Tools
The server exposes a set of tools organized into two groups: X API tools for social data access and Grok-powered intelligence tools for analysis.
Available tools
x_home_timeline
Fetch your home timeline posts and activity.
x_user_tweets
Retrieve recent tweets from a specific user.
x_get_tweet
Get the full details of a single tweet by ID.
x_post_tweet
Post a new tweet on your account (OAuth required).
x_delete_tweet
Delete one of your tweets (OAuth required).
x_search_tweets
Search for recent tweets matching a query (last 7 days).
x_list_dms
List recent direct message conversations.
x_read_dm
Read the messages in a direct message thread.
x_send_dm
Send a direct message (OAuth required).
x_bookmarks
Retrieve your bookmarked tweets.
x_liked_tweets
List tweets you have liked.
x_like_tweet
Like a tweet (OAuth required).
x_user_info
Fetch user profile details.
x_followers
List your followers.
x_following
List accounts you are following.
x_analyze_topic
Real-time analysis of any topic on X.
x_daily_digest
AI-powered daily briefing.
x_summarize_thread
Summarize a tweet thread.
x_analyze_account
Deep analysis of any X account.