Skip to content

Quick Reference - Commands Fresh

The commands you need most, in one place.

Install and run XMCP

bash
# Clone and install (Python 3.9+)
git clone https://github.com/xdevplatform/xmcp && cd xmcp
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

# Configure
cp env.example .env
# edit .env: X_OAUTH_CONSUMER_KEY, X_OAUTH_CONSUMER_SECRET, X_BEARER_TOKEN

# Start the server (opens OAuth consent in the browser)
python server.py
# MCP endpoint: http://127.0.0.1:8000/mcp

MCP client configuration

json
{
  "mcpServers": {
    "xmcp": { "url": "http://127.0.0.1:8000/mcp" },
    "x-docs": { "url": "https://docs.x.com/mcp" }
  }
}

Tool allow-listing

bash
# In .env - restart the server after changing
X_API_TOOL_ALLOWLIST=getUsersByUsername,createPosts,searchPostsRecent,likePost

First API requests (cURL)

bash
# Look up a user
curl "https://api.x.com/2/users/by/username/xdevelopers" \
  -H "Authorization: Bearer $BEARER_TOKEN"

# Look up a post
curl "https://api.x.com/2/tweets/1460323737035677698?tweet.fields=created_at,public_metrics" \
  -H "Authorization: Bearer $BEARER_TOKEN"

# Recent search
curl "https://api.x.com/2/tweets/search/recent?query=from:xdevelopers&tweet.fields=created_at" \
  -H "Authorization: Bearer $BEARER_TOKEN"

Fetch the OpenAPI spec

bash
curl https://api.x.com/2/openapi.json -o openapi.json

Agent documentation access

bash
# Index of all pages
curl https://docs.x.com/llms.txt

# Entire docs as one file
curl https://docs.x.com/llms-full.txt

# Any page as clean Markdown (append .md)
curl https://docs.x.com/tools/mcp.md

# Capability summary
curl https://docs.x.com/skill.md

# Add X capabilities to a skills-capable agent
npx skills add https://docs.x.com

Optional: Grok test client

bash
# In .env
XAI_API_KEY=your_xai_key
MCP_SERVER_URL=http://127.0.0.1:8000/mcp

# Expose the local server if Grok runs elsewhere
ngrok http 8000   # then set MCP_SERVER_URL to the public /mcp URL

python test_grok_mcp.py

More reference