Skip to main content
Glama
Twitter/X MCP Server

Twitter/X MCP Server

Twitter/X MCP Server

An MCP (Model Context Protocol) server that lets AI assistants interact with your Twitter/X account. No API key required - uses browser cookie authentication via twikit.

Read the blog post: I built an MCP server so Claude can use my Twitter account

Why?

Twitter's API free tier has been deprecated. The paid tiers start at $200/month. This MCP server bypasses that by using browser cookies to authenticate, giving you full access to your account through any MCP-compatible client (Claude Code, Claude Desktop, etc).

Related MCP server: agent-twitter-client-mcp

Tools

Tool

Description

get_me

Get your profile info

get_my_timeline

Get your home timeline

get_my_recent_tweets

Get your recent tweets

post_tweet

Post a tweet (with optional reply)

get_tweet

Get a tweet with inline images and video keyframes

delete_tweet

Delete a tweet by ID

search_tweets

Search recent tweets

get_user

Look up any user's profile

get_user_tweets

Get a user's recent tweets

like_tweet

Like a tweet

unlike_tweet

Unlike a tweet

retweet

Retweet a tweet

follow_user

Follow a user

unfollow_user

Unfollow a user

get_trending

Get trending topics

get_bookmarks

Get your saved/bookmarked tweets

get_bookmark_context

Get a bookmark with inline images and video keyframes

bookmark_tweet

Bookmark a tweet

unbookmark_tweet

Remove a bookmark

Setup

Prerequisites

1. Clone and install

git clone https://github.com/shubhank-saxena/twitter-account-mcp.git
cd twitter-account-mcp
uv sync

2. Export your Twitter cookies

  1. Install the Cookie-Editor extension in your browser

  2. Log in to x.com

  3. Click the Cookie-Editor icon

  4. Click Export (copies JSON to clipboard)

  5. Save the exported JSON as cookies.json in the project root

3. Set your username

cp .env.example .env

Edit .env and set your Twitter username:

TWITTER_USERNAME=your_username

4. Add to your MCP client

Claude Code:

claude mcp add twitter -- uv run --directory /path/to/twitter-account-mcp python main.py

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "twitter": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/twitter-account-mcp", "python", "main.py"]
    }
  }
}

5. Verify

uv run python -c "
import asyncio, main
async def test():
    r = await main.get_me()
    print(f'Connected as @{r[\"username\"]}')
asyncio.run(test())
"

Browser cookies expire periodically. When you start seeing auth errors, re-export your cookies from Cookie-Editor and overwrite cookies.json.

Disclaimer

This project uses an unofficial method to access Twitter. It is not affiliated with or endorsed by Twitter/X. Use at your own risk - your account could potentially be restricted if Twitter detects unusual activity. Keep request rates reasonable.

License

MIT

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

    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Connects AI assistants to Twitter/X using cookie-based authentication to read timelines, search tweets, and perform actions like posting and liking. It leverages Twitter's internal GraphQL API to provide full functionality without requiring a developer account.
      19 npm
      -
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI models to interact with Twitter, including posting tweets, searching, following users, and chatting with Grok, using cookie or credential authentication.
      14
      1
      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
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to interact with Twitter/X using session cookies. Supports posting, searching, managing tweets, viewing trends, and user profiles.
      -