MCP server exposing the X (Twitter) API v2 as 41 typed tools, gated by a two-axis policy model and a session credit budget aware of 2026 pay-per-use pricing.
Setup
Choose your client, copy the config, then fill in any required environment variables.
claude mcp add x-ai --env X_MCP_CLIENT_SECRET='<X_MCP_CLIENT_SECRET>' --env X_MCP_BEARER_TOKEN='<X_MCP_BEARER_TOKEN>' -- npx -y x-mcp-ai~/.codex/config.toml
[mcp_servers.x-ai]
command = "npx"
args = ["-y", "x-mcp-ai"]
env = { X_MCP_CLIENT_SECRET = "<X_MCP_CLIENT_SECRET>", X_MCP_BEARER_TOKEN = "<X_MCP_BEARER_TOKEN>" }
# codex mcp add x-ai --env X_MCP_CLIENT_SECRET='<X_MCP_CLIENT_SECRET>' --env X_MCP_BEARER_TOKEN='<X_MCP_BEARER_TOKEN>' -- npx -y x-mcp-ai~/.cursor/mcp.json
{
"mcpServers": {
"x-ai": {
"command": "npx",
"args": [
"-y",
"x-mcp-ai"
],
"env": {
"X_MCP_CLIENT_SECRET": "<X_MCP_CLIENT_SECRET>",
"X_MCP_BEARER_TOKEN": "<X_MCP_BEARER_TOKEN>"
}
}
}
}.vscode/mcp.json
{
"servers": {
"x-ai": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"x-mcp-ai"
],
"env": {
"X_MCP_CLIENT_SECRET": "<X_MCP_CLIENT_SECRET>",
"X_MCP_BEARER_TOKEN": "<X_MCP_BEARER_TOKEN>"
}
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"x-ai": {
"command": "npx",
"args": [
"-y",
"x-mcp-ai"
],
"env": {
"X_MCP_CLIENT_SECRET": "<X_MCP_CLIENT_SECRET>",
"X_MCP_BEARER_TOKEN": "<X_MCP_BEARER_TOKEN>"
}
}
}
}claude_desktop_config.json
{
"mcpServers": {
"x-ai": {
"command": "npx",
"args": [
"-y",
"x-mcp-ai"
],
"env": {
"X_MCP_CLIENT_SECRET": "<X_MCP_CLIENT_SECRET>",
"X_MCP_BEARER_TOKEN": "<X_MCP_BEARER_TOKEN>"
}
}
}
}.trae/mcp.json
{
"mcpServers": {
"x-ai": {
"command": "npx",
"args": [
"-y",
"x-mcp-ai"
],
"env": {
"X_MCP_CLIENT_SECRET": "<X_MCP_CLIENT_SECRET>",
"X_MCP_BEARER_TOKEN": "<X_MCP_BEARER_TOKEN>"
}
}
}
}Environment variables
X_MCP_CLIENT_SECRETX_MCP_BEARER_TOKEN
Replace the placeholders with your own credentials and keep them out of version control.