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
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).
| 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 |
- Python 3.13+
- uv
- ffmpeg (for video keyframe extraction)
- A Twitter/X account
- Cookie-Editor browser extension
git clone https://github.com/shubhank-saxena/twitter-account-mcp.git
cd twitter-account-mcp
uv sync- Install the Cookie-Editor extension in your browser
- Log in to x.com
- Click the Cookie-Editor icon
- Click Export (copies JSON to clipboard)
- Save the exported JSON as
cookies.jsonin the project root
cp .env.example .envEdit .env and set your Twitter username:
TWITTER_USERNAME=your_username
Claude Code:
claude mcp add twitter -- uv run --directory /path/to/twitter-account-mcp python main.pyClaude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"twitter": {
"command": "uv",
"args": ["run", "--directory", "/path/to/twitter-account-mcp", "python", "main.py"]
}
}
}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.
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.
MIT