X MCP 服务器 logo

X MCP 服务器

Community
DataWhisker

MCP 服务器,用于 X(Twitter)集成,提供读取时间线和互动推文的工具。需要通过环境变量配置 X(Twitter)API 凭据。

PublisherDataWhisker
Repositoryx-mcp-server
LanguageTypeScript
Forks
16
Stars
68
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    X MCP 服务器 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    68 stars and 16 forks from the linked repository.

X MCP Server

A Model Context Protocol (MCP) server for X (Twitter) integration. Provides 16 tools for reading timelines, posting, searching, engagement (likes, retweets, bookmarks), and user lookup. 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 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

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"
      }
    }
  }
}

Available Tools (16)

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

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

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

Installation

TypingMind
Prerequisites:

Node.js 18+

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

Use X MCP 服务器 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once X MCP 服务器 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add X MCP 服务器 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the X MCP 服务器 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "datawhisker-x-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "x-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the X MCP 服务器 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the X MCP 服务器 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use X MCP 服务器 to help me with this task?
X MCP 服务器
Sure. I read it.
Here is what I found using X MCP 服务器.

Frequently asked questions

What is the X MCP 服务器 MCP server used for?

X MCP 服务器 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use X MCP 服务器 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use X MCP 服务器 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use X MCP 服务器 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With X MCP 服务器 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect X MCP 服务器 MCP to TypingMind?

X MCP 服务器 runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does X MCP 服务器 MCP provide in TypingMind?

X MCP 服务器 exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use X MCP 服务器 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If X MCP 服务器 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇