
一个让克洛德(或任何MCP相容的AI代理)使用浏览器cookie与Twitter/X交互的MCP服务器. 不需要Twitter API 密钥 。 永远自由.
概览
一个让克洛德(或任何MCP相容的AI代理)使用浏览器cookie与Twitter/X交互的MCP服务器. 不需要Twitter API 密钥 。 永远自由 1. 在您的浏览器中登录到 x.com 2. Open DevTools (F12) → → https://x.com 3. 复制 ct0 和 认证 token ct0是 CSRF 符号(~160 hex chars), auth token 是您的会话符号(40 hex chars). 在您的浏览器 cookie 登录到 x. Cookies 过期 – auth token 通常持续数月,ct0可能较短. 过期时从浏览器中取出 。 ——0-install,获取每个调用(先慢跑后快跑;缓存与其他uv工具共享). 最好的快速测试。 (推荐日常使用)——被固定隔离的venv,即时起动,简单升级路径. 然后用 Claude 代码注册( 使用 PATH 上的二进制 —— 无 uvx 前缀 ): 饼干文件与所有其他选项相同: ~/. config/twitter-mcp/cookies.json(或TWITTER COOKIES env var points).
概述(AI 翻译)
** Twitter/X MCP 服务器——不需要 API 密钥**
一个让克洛德(或任何MCP相容的AI代理)使用浏览器cookie与Twitter/X交互的MCP服务器. 不需要Twitter API 密钥 。 永远自由
** 英语** 中文 | 日本語
– – . . .
□ 英语
为什么是twikit-mcp?
Twikit-mcp(此项目) 其他Twitter MCP服务器 QQ ················································································
- ** Auth** * * * 浏览器 cookie * * Twitter API Key * *
# # 成本 # # # 免费 # # 200+/月 # # # # # #
- Setup * * 2个步骤, 2分钟 * * 申请开发者账户,等待批准 * * *
- API * twikit(逆向设计) * X API(官方,付薪) **
QQ 快速启动
-
创建 cookie.json
-
开放的DevTools(F12) → 应用 ** Cookies** →
https://x.com -
复制[[T1]和
auth_token]
** 这些是什么? **
ct0是 CSRF 标志 (~ 160 hex chars),auth_token是您的会话标志 (40 hex chars) 。 在您的浏览器 cookie 登录到 x. 饼干过期——auth_token一般持续数月,[T6]可能较短. 过期时从浏览器中取出 。
2. 安装和注册
本页由 AI 翻译,技术细节请以原文为准。
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"
}
}
}
}