x-ai-mcp
Click on "Install 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-ai-mcpanalyze the current sentiment around AI agents on X"
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-ai-mcp
X (Twitter) MCP server with Grok-powered intelligence. Personal account access + AI analysis in one package.
20 tools: 16 X API tools for reading/writing + 4 Grok intelligence tools for real-time analysis.
Setup
1. Install
git clone https://github.com/olivier-motium/x-ai-mcp.git
cd x-ai-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e .2. Configure
Copy .env.example to .env and fill in:
# Required — X API bearer token (read-only operations)
X_BEARER_TOKEN=your_bearer_token
# Required — your X user ID
X_USER_ID=your_user_id
# Optional — OAuth for write ops (posting, DMs)
# Run: python scripts/auth_flow.py
X_CLIENT_ID=your_client_id
# Optional — xAI key for intelligence tools
XAI_API_KEY=your_xai_key3. Get OAuth tokens (for write operations)
python scripts/auth_flow.pyOpens browser, authorizes your account, saves token.json. Tokens auto-refresh.
4. Add to Claude Code
claude mcp add x-ai \
-e X_BEARER_TOKEN=xxx \
-e X_USER_ID=xxx \
-e XAI_API_KEY=xxx \
-- python -m src.serverTools
X API — Timeline & Tweets
Tool | Description |
| Your home timeline |
| A user's recent tweets |
| Get a specific tweet |
| Post a tweet (OAuth) |
| Delete your tweet (OAuth) |
| Search recent tweets (7 days) |
X API — DMs
Tool | Description |
| Recent DM messages |
| Read a DM conversation |
| Send a DM (OAuth) |
X API — Social
Tool | Description |
| Your bookmarked tweets |
| Liked tweets (you or others) |
| Like a tweet (OAuth) |
| User profile details |
| List followers |
| List following |
Intelligence — Grok-powered
Tool | Description |
| Real-time analysis of any topic on X |
| AI-powered daily briefing |
| Summarize a tweet thread |
| Deep analysis of any X account |
Daily Digest (standalone)
# Default (AI/tech focus)
python scripts/daily_digest.py
# Custom focus
python scripts/daily_digest.py --focus "crypto markets"
# Save to file
python scripts/daily_digest.py --focus "AI agents" --output digest.mdCron it for daily briefings:
0 9 * * * cd /path/to/x-ai-mcp && .venv/bin/python scripts/daily_digest.py >> ~/digests.logArchitecture
Bearer Token (read) ──┐
OAuth 2.0 PKCE (r/w) ─┤──→ X API v2 ──→ 16 MCP tools
│
xAI API Key ───────────┤──→ Grok (x_search + chat) ──→ 4 intelligence tools
│
Logfire (optional) ────┘──→ Observability dashboardX client: async httpx, auto rate-limit retry, OAuth token refresh
Grok client: Chat Completions API for analysis, Responses API with x_search for real-time X data
Output: Plain text, never raw JSON. Tweets formatted as
[date time] @user: text (metrics)
License
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/olivier-motium/x-ai-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server