Skip to main content
Glama
@m8lab/mcp-x-twitter

@m8lab/mcp-x-twitter

by lmtNoLimit

@m8lab/mcp-x-twitter

MCP server for X (Twitter) — post tweets, upload media, and manage interactions via Claude Code or Claude Desktop.

CI npm version License: MIT

Install

npx @m8lab/mcp-x-twitter

Related MCP server: Twitter MCP Server

Claude Code Configuration

Add to your .claude/mcp.json (or run claude mcp add):

{
  "mcpServers": {
    "x-twitter": {
      "command": "npx",
      "args": ["-y", "@m8lab/mcp-x-twitter"],
      "env": {
        "X_API_KEY": "your_api_key",
        "X_API_SECRET": "your_api_secret",
        "X_ACCESS_TOKEN": "your_access_token",
        "X_ACCESS_SECRET": "your_access_secret"
      }
    }
  }
}

Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "x-twitter": {
      "command": "npx",
      "args": ["-y", "@m8lab/mcp-x-twitter"],
      "env": {
        "X_API_KEY": "your_api_key",
        "X_API_SECRET": "your_api_secret",
        "X_ACCESS_TOKEN": "your_access_token",
        "X_ACCESS_SECRET": "your_access_secret"
      }
    }
  }
}

Available Tools

Tool

Description

Tier Required

post_tweet

Post a tweet with optional media and reply support

Free

delete_tweet

Delete a tweet by ID

Free

get_tweet

Fetch a tweet with full details and expansions

Free

search_tweets

Search recent tweets (last 7 days) by query

Basic+

upload_media

Upload image or video and get a media_id

Free

like_tweet

Like a tweet as the authenticated user

Free

retweet

Retweet a tweet as the authenticated user

Free

get_mentions

Retrieve recent mentions of the authenticated user

Free

Note: search_tweets requires Basic or Pro tier X API access — not available on the free tier.

Environment Variables

Variable

Required

Description

X_API_KEY

Yes

Your X app API Key (Consumer Key)

X_API_SECRET

Yes

Your X app API Secret (Consumer Secret)

X_ACCESS_TOKEN

Yes

Access Token for the authenticated user

X_ACCESS_SECRET

Yes

Access Token Secret for the authenticated user

X_BEARER_TOKEN

No

Bearer Token (optional, for app-only auth)

How to Get X API Credentials

  1. Go to developer.twitter.com and sign in

  2. Create a new Project and App (or use an existing one)

  3. Under your App settings, enable Read and Write permissions (required for posting)

  4. Generate API Key & Secret under "Keys and tokens"

  5. Generate Access Token & Secret (make sure they have Read+Write scope)

  6. Copy all four values into your MCP config or .env file

Development

# Clone the repo
git clone https://github.com/lmtNoLimit/mcp-x-twitter.git
cd mcp-x-twitter

# Install dependencies
npm install

# Copy environment template
cp .env.example .env
# Fill in your credentials in .env

# Type check
npm run typecheck

# Build
npm run build

# Run locally
node dist/index.js

License

MIT — see LICENSE

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables creating, managing, and publishing X/Twitter posts, threads, and replies directly through Claude chat. Supports draft management with the ability to create, list, publish, and delete tweet drafts.
      10
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables seamless interaction with Twitter/X platform through Claude AI, allowing users to post tweets with images, search for tweets, and engage in conversations using natural language commands.
      10
      55 npm
      27
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables users to interact with X/Twitter via Claude, allowing posting tweets, searching, liking, retweeting, and more using OAuth 2.0 PKCE authentication.
      10
      7
      MIT