
tangivis/twitter-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
An MCP server that lets Claude (or any MCP-compatible AI agent) interact with Twitter/X using browser cookies. No Twitter API key needed. Free forever.
概要
An MCP server that lets Claude (or any MCP-compatible AI agent) interact with Twitter/X using browser cookies. No Twitter API key needed. Free forever. 1. Log in to x.com in your browser 2. Open DevTools (F12) → → → https://x.com 3. Copy ct0 and auth_token ct0 is the CSRF token (~160 hex chars), auth_token is your session token (40 hex chars). They are found in your browser cookies after logging in to x.com. Cookies expire — auth_token typically lasts several months, ct0 may be shorter. Re-extract from your browser when expired. — zero-install, fetches each call (slow first run, fast after; cache shared with other uv tools). Best for quick try-out. (recommended for daily use) — pinned isolated venv, instant startup, simple upgrade path. Then register with Claude Code (uses the binary on PATH — no uvx prefix): The cookies file is as for every other option: ~/.config/twitter-mcp/cookies.json (or wherever TWITTER_COOKIES env var points).
README
以下は原文 README の抜粋です。原文を見る。
English
Why twikit-mcp?
| twikit-mcp (this project) | Other Twitter MCP servers | |
|---|---|---|
| Auth | Browser cookies | Twitter API Key |
| Cost | Free | $200+/month |
| Setup | 2 steps, 2 minutes | Apply for developer account, wait for approval |
| API | twikit (reverse-engineered) | X API (official, paid) |
Quick Start
1. Create cookies.json
- Log in to x.com in your browser
- Open DevTools (F12) → Application → Cookies →
https://x.com - Copy
ct0andauth_token
mkdir -p ~/.config/twitter-mcp
cat > ~/.config/twitter-mcp/cookies.json << 'EOF'
{"ct0": "YOUR_CT0", "auth_token": "YOUR_AUTH_TOKEN"}
EOF
chmod 600 ~/.config/twitter-mcp/cookies.json
What are these?
ct0is the CSRF token (~160 hex chars),auth_tokenis your session token (40 hex chars). They are found in your browser cookies after logging in to x.com. Cookies expire —auth_tokentypically lasts several months,ct0may be shorter. Re-extract from your browser when expired.
2. Install & register
Choose one of the following methods:
Option A: uvx — zero-install, fetches each call (slow first run, fast after; cache shared with other uv tools). Best for quick try-out.
# Claude Code
claude mcp add twitter -s user \
-e "TWITTER_COOKIES=$HOME/.config/twitter-mcp/cookies.json" \
-- uvx twikit-mcp
# Or run directly
uvx twikit-mcp
Option B: uv tool install (recommended for daily use) — pinned isolated venv, instant startup, simple upgrade path.
# Install once. Drops a `twikit-mcp` binary on PATH (~/.local/bin).
uv tool install twikit-mcp
# List your installed uv tools (sanity check)
uv tool list
# Upgrade when a new version ships
uv tool upgrade twikit-mcp
# Or upgrade ALL uv-tool-managed binaries at once:
uv tool upgrade --all
# Uninstall (clean removal of the venv + binary)
uv tool uninstall twikit-mcp
Then register with Claude Code (uses the binary on PATH — no uvx prefix):
claude mcp add twitter -s user \
インストール
uvx twikit-mcp設定
{
"mcpServers": {
"twitter": {
"command": "twikit-mcp",
"env": {
"TWITTER_COOKIES": "/home/YOU/.config/twitter-mcp/cookies.json"
}
}
}
}