Logo di X MCP 服务器

X MCP 服务器

Community
DataWhisker

A Model Context Protocol (MCP) server for X (Twitter) integration. Provides 26 tools for reading timelines, posting, searching, engagement (likes, retweets, bookmarks), user lookup, follower export,…

AutoreDataWhisker
Repositoryx-mcp-server
LinguaTypeScript
Fork
18
Stelle
79
Strumenti disponibili
0
Tipo di trasportostdio
Categorie
LicenzaMIT
Link
  • Collega gli strumenti ai flussi di lavoro IA

    X MCP 服务器 mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • 0 strumenti disponibili

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni quando forniti dal server.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse open source

    79 stelle e 18 fork nel repository collegato.

X MCP Server

A Model Context Protocol (MCP) server for X (Twitter) integration. Provides 26 tools for reading timelines, posting, searching, engagement (likes, retweets, bookmarks), user lookup, follower export, mentions, likes, articles, and lists. Designed for use with Claude desktop and other MCP-compatible clients.

Features

  • Timeline & Search - Home timeline, search recent posts (7-day window)
  • Post Management - Create, reply, quote, delete posts with optional media
  • Engagement - Like/unlike, retweet/undo, bookmark/unbookmark
  • User Data - Mentions, liked posts, followers, following, blocks, mutes, owned lists, followed lists, and list memberships
  • User Lookup - Get user profiles and their recent posts
  • Media Upload - Images (PNG, JPEG, GIF, WEBP) and videos (MP4, MOV, AVI, WEBM, M4V) via v2 upload API
  • Dual Auth - OAuth 1.0a for post operations, OAuth 2.0 for media upload (v1.1 upload was sunset June 2025)
  • Rate Limiting - Automatic per-endpoint rate limit tracking with clear error messages
  • TypeScript - Full type safety, modular file structure

Prerequisites

  • Node.js >= 18.0.0
  • X (Twitter) Developer Account
  • Claude desktop app (or any MCP-compatible client)

X API Access & Pricing

TierCostPost ReadsPost WritesNotes
Free$0~100/month~500/monthNo likes/follows; media upload requires OAuth 2.0
Basic$200/month10,000/month3,000/monthSearch, limited read access
Pro$5,000/month1,000,000/month300,000/monthFull search, filtered stream
Pay-Per-UseCredit-based~$0.005/readVariesLaunched Feb 2026, 2M reads cap

Like and Follow endpoints were removed from the Free tier in August 2025. Follows/Blocks endpoints are Enterprise-only as of 2025.

Installation

bash
git clone https://github.com/DataWhisker/x-mcp-server.git
cd x-mcp-server
npm install
npm run build

Authentication

The server supports two authentication methods. You need at least one configured.

OAuth 1.0a (Required for basic operations)

Works for all post/engagement/search/user operations.

Environment VariableDescription
TWITTER_API_KEYConsumer Key (API Key)
TWITTER_API_SECRETConsumer Secret (API Key Secret)
TWITTER_ACCESS_TOKENUser Access Token
TWITTER_ACCESS_SECRETUser Access Token Secret

Setup: In the X Developer Portal:

  1. Create a project and app
  2. Enable OAuth 1.0a under "User authentication settings"
  3. Set permissions to "Read and Write"
  4. Generate Consumer Keys and Access Tokens

OAuth 2.0 (Required for media upload)

The v1.1 media upload endpoint was sunset in June 2025. Media upload now requires OAuth 2.0 via the v2 upload API.

Option A - Direct access token:

VariableDescription
TWITTER_OAUTH2_ACCESS_TOKENOAuth 2.0 user access token (expires in 2 hours)

Option B - Auto-refresh (recommended for long-running servers):

VariableDescription
TWITTER_CLIENT_IDOAuth 2.0 Client ID
TWITTER_CLIENT_SECRETOAuth 2.0 Client Secret (optional for public clients)
TWITTER_OAUTH2_REFRESH_TOKENOAuth 2.0 Refresh Token

Tokens are auto-refreshed and persisted to ~/.x-mcp-tokens.json.

Setup: In the X Developer Portal:

  1. In your app settings, enable OAuth 2.0
  2. Set type to "Confidential client" or "Public client"
  3. Add a callback URL
  4. Request scopes: tweet.read, tweet.write, users.read, media.write, offline.access, like.read, like.write, bookmark.read, bookmark.write, follows.read, block.read, mute.read, list.read

Claude Desktop Configuration

Add to %APPDATA%/Claude/claude_desktop_config.json:

json
{
  "mcpServers": {
    "x": {
      "command": "node",
      "args": ["C:/path/to/x-mcp-server/build/index.js"],
      "env": {
        "TWITTER_API_KEY": "your-api-key",
        "TWITTER_API_SECRET": "your-api-secret",
        "TWITTER_ACCESS_TOKEN": "your-access-token",
        "TWITTER_ACCESS_SECRET": "your-access-secret",
        "TWITTER_OAUTH2_ACCESS_TOKEN": "your-oauth2-token"
      }
    }
  }
}

Optional Xquik Search Backend

search_tweets can use Xquik while the rest of the server keeps the default X API client. Set:

VariableDescription
X_MCP_SEARCH_BACKEND=xquikRoutes only search_tweets to Xquik
XQUIK_API_KEYXquik API key
XQUIK_API_BASE_URLOptional base URL, defaults to https://xquik.com/api/v1

Available Tools (26)

Timeline & Search

ToolDescriptionKey Parameters
get_home_timelineGet recent posts from home timelinelimit (1-100)
search_tweetsSearch recent posts (7-day window)query, limit

Post Management

ToolDescriptionKey Parameters
get_tweetLook up a post by IDtweet_id
create_tweetCreate a post with optional mediatext, image_path?, video_path?
reply_to_tweetReply to a post with optional mediatweet_id, text, image_path?, video_path?
quote_tweetQuote a post with commentarytweet_id, text
delete_tweetDelete your posttweet_id

Engagement

ToolDescriptionKey Parameters
like_tweetLike a post (Basic+ tier)tweet_id
unlike_tweetRemove a liketweet_id
retweetRepost to your timelinetweet_id
undo_retweetRemove a reposttweet_id
bookmark_tweetBookmark for latertweet_id
unbookmark_tweetRemove a bookmarktweet_id
get_bookmarksGet your bookmarkslimit (1-100)

Users

ToolDescriptionKey Parameters
get_userLook up user by usernameusername
get_user_tweetsGet a user's recent postsusername, limit
get_user_mentionsGet posts mentioning a userusername, limit
get_user_liked_tweetsGet a user's liked postsusername, limit
get_user_followersGet a user's followersusername, limit
get_user_followingGet accounts a user followsusername, limit
get_blocking_usersGet users blocked by the authenticated accountlimit
get_muting_usersGet users muted by the authenticated accountlimit
get_owned_listsGet lists owned by a userusername, limit
get_followed_listsGet lists followed by a userusername, limit
get_list_membershipsGet lists a user belongs tousername, limit

Articles

ToolDescriptionKey Parameters
get_articleFetch the full body content of an X Article posttweet_id

Media Support

  • Images: PNG, JPEG, GIF, WEBP (max 5MB)
  • Videos: MP4, MOV, AVI, WEBM, M4V (max 512MB, streamed chunked upload)
  • Cannot attach both image and video to the same post
  • Requires OAuth 2.0 credentials (v1.1 upload sunset June 2025)
  • Path restriction: Only files within your home directory or system temp directory can be uploaded (prevents path traversal)

Security

  • Input validation: Tweet IDs must be numeric (1-20 digits), usernames must match [A-Za-z0-9_]{1,15}
  • Media path restriction: Upload paths are validated against an allow-list (home directory, temp directory)
  • Token storage: OAuth 2.0 tokens persisted to ~/.x-mcp-tokens.json with 0o600 permissions (Unix). On Windows, file permissions are not enforced by the OS - protect the file via NTFS ACLs or use environment variables instead.
  • Error sanitization: X API error details are logged server-side only; sanitized messages are returned to MCP clients
  • Refresh mutex: Concurrent token refresh attempts are deduplicated to prevent race conditions

Development

bash
npm run build    # Compile TypeScript
npm run dev      # Watch mode
npm start        # Run the server

Project Structure

src/
  index.ts              # MCP server entry point & handler dispatch
  client.ts             # Twitter client setup (OAuth 1.0a + OAuth 2.0)
  media.ts              # v2 media upload (simple + chunked)
  rate-limit.ts         # Per-endpoint rate limiting
  tools/
    definitions.ts      # All 16 tool schemas
    handlers.ts         # Tool handler implementations

Pairing with GetXAPI for Cheaper Read Operations (Optional)

For users who need a cheaper or higher-rate-limit option for read-only Twitter (X) operations such as tweet search, profile lookup, and follower lists, this project can be paired with GetXAPI, a budget Twitter / X data API priced at $0.05 per 1K tweets versus the official X API basic tier at $200 / month.

Two integration patterns:

  1. Run side-by-side in your AI client. Keep this project for its primary workflow and add the official GetXAPI MCP server for read-heavy tasks. Each tool name routes to the backend best suited for that operation.

  2. Add a backend toggle. For a code-level reference of an optional alternative backend behind a single env variable, see the PR pattern merged into a sibling project.

GetXAPI quick start:

This pairing is fully optional. No behavior change for existing users.

License

MIT

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Installazione

TypingMind
Prerequisiti:

Node.js 18+

{
  "mcpServers": {
    "datawhisker-x-mcp-server": {
      "command": "",
      "args": []
    }
  }
}

Usa MCP X MCP 服务器 con più modelli IA

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso X MCP 服务器, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Questa integrazione MCP viene eseguita localmente sul tuo dispositivo tramite il connettore MCP di TypingMind.

Guida alla configurazione del connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura MCP.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura MCP e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con Questo dispositivo selezionato
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi X MCP 服务器 come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di X MCP 服务器.
  4. Salva l'elenco dei server.
  5. Aggiorna per verificare che il connettore sia ancora pronto.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "datawhisker-x-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "x-mcp-server"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di X MCP 服务器, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di X MCP 服务器.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare X MCP 服务器 per aiutarmi con questa attività?
X MCP 服务器
Certo. Ho letto.
Ecco cosa ho trovato con X MCP 服务器.

Domande frequenti

A cosa serve il server MCP X MCP 服务器?

X MCP 服务器 è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare X MCP 服务器 MCP con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare X MCP 服务器 con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP X MCP 服务器 con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando X MCP 服务器, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego X MCP 服务器 MCP a TypingMind?

X MCP 服务器 funziona tramite il connettore MCP locale di TypingMind. È la soluzione ideale quando il server MCP deve accedere a file locali, app desktop, strumenti da riga di comando o risorse private sul tuo computer.

Quali strumenti offre X MCP 服务器 MCP in TypingMind?

X MCP 服务器 mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare X MCP 服务器 MCP?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se X MCP 服务器 richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇