Skip to main content
Glama
6551Team

Twitter MCP Server

by 6551Team

快速安装

首先,前往 https://6551.io/mcp 获取您的 API Token。

Claude Code

claude mcp add twitter \
  -e TWITTER_TOKEN=<your-token> \
  -- uv --directory /path/to/twitter-mcp run twitter-mcp

/path/to/twitter-mcp 替换为您的本地项目路径,并将 <your-token> 替换为您的 Token。

OpenClaw

export TWITTER_TOKEN="<your-token>"
cp -r openclaw-skill/opentwitter ~/.openclaw/skills/

让 AI 为您审查并安装

不确定此 MCP 是否安全?将以下提示词粘贴给您的 AI 助手——它会先审查源代码,如果安全则进行安装:

复制此提示词并发送给您的 AI 助手(将 <project-path><your-token> 替换为实际值):

Please review and install the twitter-mcp MCP server for me. The project is at <project-path>.

Steps:
1. Review these files for security:
   - src/twitter_mcp/api_client.py — Confirm it only connects to ai.6551.io, no data sent elsewhere
   - src/twitter_mcp/config.py — Confirm token is only read from local config.json or env vars, no hardcoded secrets or leaks
   - src/twitter_mcp/tools.py — Confirm all tools only perform API queries, no file writes, command execution, or dangerous operations
   - pyproject.toml — Confirm dependencies are only mcp, httpx, no suspicious packages
2. Tell me your conclusion: safe / risky / problematic, with specific reasons
3. If safe, run the install (get Token from https://6551.io/mcp):
   claude mcp add twitter -e TWITTER_TOKEN=<your-token> -- uv --directory <project-path> run twitter-mcp

它能做什么?

连接后,只需询问您的 AI 助手:

您说

它执行

"Show @elonmusk's Twitter profile"

获取用户资料信息

"What did @VitalikButerin tweet recently"

获取用户最近的推文

"Search Bitcoin related tweets"

关键词搜索

"Find tweets with #crypto hashtag"

标签搜索

"Popular tweets about ETH with 1000+ likes"

带互动过滤器的搜索

"Monitor @elonmusk with follower tracking"

将用户添加到监控列表(带选项)

"Who quoted this tweet"

获取某条推文的引用推文

"Who retweeted this tweet"

获取转发了某条推文的用户

"Who followed @elonmusk recently"

获取新关注者事件

"Who unfollowed @elonmusk"

获取取关事件

"What tweets did @elonmusk delete"

获取已删除的推文

"Which KOLs follow @elonmusk"

获取 KOL 关注者


可用工具

工具

描述

get_twitter_user

通过用户名获取用户资料

get_twitter_user_by_id

通过数字 ID 获取用户资料

get_twitter_user_tweets

获取用户最近的推文

search_twitter

使用基本过滤器搜索推文

search_twitter_advanced

使用多个过滤器进行高级搜索

get_twitter_follower_events

获取关注/取关事件

get_twitter_deleted_tweets

获取用户已删除的推文

get_twitter_kol_followers

获取 KOL(关键意见领袖)关注者

get_twitter_article_by_id

通过 ID 获取 Twitter 文章

get_twitter_tweet_by_id

通过 ID 获取推文(包含嵌套的回复/引用推文)

get_twitter_quote_tweets_by_id

获取引用特定推文的推文

get_twitter_retweet_users_by_id

获取转发特定推文的用户

get_twitter_watch

获取所有 Twitter 监控用户

add_twitter_watch

将 Twitter 用户添加到监控列表(带事件类型选项)

delete_twitter_watch

从监控列表中删除 Twitter 用户


配置

获取 API Token

前往 https://6551.io/mcp 获取您的 API Token。

设置环境变量:

# macOS / Linux
export TWITTER_TOKEN="<your-token>"

# Windows PowerShell
$env:TWITTER_TOKEN = "<your-token>"

变量

必需

描述

TWITTER_TOKEN

6551 API Bearer Token (从 https://6551.io/mcp 获取)

TWITTER_API_BASE

覆盖 REST API URL

TWITTER_MAX_ROWS

每次查询的最大结果数 (默认: 100)

同时也支持项目根目录下的 config.json(环境变量优先级更高):

{
  "api_base_url": "https://ai.6551.io",
  "api_token": "<your-token>",
  "max_rows": 100
}

WebSocket 实时订阅

端点: wss://ai.6551.io/open/twitter_wss?token=YOUR_TOKEN

订阅您监控的 Twitter 账号的实时事件。

订阅 Twitter 事件

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "twitter.subscribe"
}

响应:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "success": true
  }
}

取消订阅

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "twitter.unsubscribe"
}

服务器推送 - Twitter 事件

当被监控账号有活动时,服务器会推送:

{
  "jsonrpc": "2.0",
  "method": "twitter.event",
  "params": {
    "id": 123456,
    "twAccount": "elonmusk",
    "twUserName": "Elon Musk",
    "profileUrl": "https://twitter.com/elonmusk",
    "eventType": "NEW_TWEET",
    "content": "...",
    "ca": "0x1234...",
    "remark": "Custom note",
    "createdAt": "2026-03-06T10:00:00Z"
  }
}

注意: content 字段结构因事件类型而异(见下文)。


**Event Types and Content Structure**:

#### Tweet Events
- `NEW_TWEET` - New tweet posted
- `NEW_TWEET_REPLY` - New reply tweet
- `NEW_TWEET_QUOTE` - New quote tweet
- `NEW_RETWEET` - Retweeted
- `CA` - Tweet with CA address

Content structure for tweet events:
```json
{
  "id": "1234567890",
  "text": "Tweet content...",
  "createdAt": "2026-03-06T10:00:00Z",
  "language": "en",
  "retweetCount": 100,
  "favoriteCount": 500,
  "replyCount": 20,
  "quoteCount": 10,
  "viewCount": 10000,
  "userScreenName": "elonmusk",
  "userName": "Elon Musk",
  "userIdStr": "44196397",
  "userFollowers": 170000000,
  "userVerified": true,
  "conversationId": "1234567890",
  "isReply": false,
  "isQuote": false,
  "hashtags": ["crypto", "bitcoin"],
  "media": [
    {
      "type": "photo",
      "url": "https://...",
      "thumbUrl": "https://..."
    }
  ],
  "urls": [
    {
      "url": "https://...",
      "expandedUrl": "https://...",
      "displayUrl": "example.com"
    }
  ],
  "mentions": [
    {
      "username": "VitalikButerin",
      "name": "Vitalik Buterin"
    }
  ]
}

关注者事件

  • NEW_FOLLOWER - 新关注者

  • NEW_UNFOLLOWER - 取关事件

关注者事件的内容结构(数组):

[
  {
    "id": 123,
    "twId": 44196397,
    "twAccount": "elonmusk",
    "twUserName": "Elon Musk",
    "twUserLabel": "Verified",
    "description": "User bio...",
    "profileUrl": "https://...",
    "bannerUrl": "https://...",
    "followerCount": 170000000,
    "friendCount": 500,
    "createdAt": "2026-03-06T10:00:00Z"
  }
]

资料更新事件

  • UPDATE_NAME - 用户名更改 (内容: 新名称字符串)

  • UPDATE_DESCRIPTION - 简介更新 (内容: 新简介字符串)

  • UPDATE_AVATAR - 头像更改 (内容: 新头像 URL 字符串)

  • UPDATE_BANNER - 横幅图片更改 (内容: 新横幅 URL 字符串)

其他事件

  • TWEET_TOPPING - 推文置顶

  • DELETE - 推文删除

  • SYSTEM - 系统事件

  • TRANSLATE - 推文翻译

  • CA_CREATE - CA 代币创建


数据结构

Twitter 用户

{
  "userId": "44196397",
  "screenName": "elonmusk",
  "name": "Elon Musk",
  "description": "...",
  "followersCount": 170000000,
  "friendsCount": 500,
  "statusesCount": 30000,
  "verified": true
}

推文

{
  "id": "1234567890",
  "text": "Tweet content...",
  "createdAt": "2024-02-20T12:00:00Z",
  "retweetCount": 1000,
  "favoriteCount": 5000,
  "replyCount": 200,
  "userScreenName": "elonmusk",
  "hashtags": ["crypto", "bitcoin"],
  "urls": [{"url": "https://..."}]
}

在以下所有配置中,将 /path/to/twitter-mcp 替换为您的实际本地项目路径,并将 <your-token> 替换为您从 https://6551.io/mcp 获取的 Token。

Claude Desktop

编辑配置 (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json, Windows: %APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "twitter": {
      "command": "uv",
      "args": ["--directory", "/path/to/twitter-mcp", "run", "twitter-mcp"],
      "env": {
        "TWITTER_TOKEN": "<your-token>"
      }
    }
  }
}

Cursor

~/.cursor/mcp.json 或 设置 > MCP Servers:

{
  "mcpServers": {
    "twitter": {
      "command": "uv",
      "args": ["--directory", "/path/to/twitter-mcp", "run", "twitter-mcp"],
      "env": {
        "TWITTER_TOKEN": "<your-token>"
      }
    }
  }
}

Windsurf

~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "twitter": {
      "command": "uv",
      "args": ["--directory", "/path/to/twitter-mcp", "run", "twitter-mcp"],
      "env": {
        "TWITTER_TOKEN": "<your-token>"
      }
    }
  }
}

Cline

VS Code 侧边栏 > Cline > MCP Servers > Configure, 编辑 cline_mcp_settings.json:

{
  "mcpServers": {
    "twitter": {
      "command": "uv",
      "args": ["--directory", "/path/to/twitter-mcp", "run", "twitter-mcp"],
      "env": {
        "TWITTER_TOKEN": "<your-token>"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Continue.dev

~/.continue/config.yaml:

mcpServers:
  - name: twitter
    command: uv
    args:
      - --directory
      - /path/to/twitter-mcp
      - run
      - twitter-mcp
    env:
      TWITTER_TOKEN: <your-token>

Cherry Studio

设置 > MCP Servers > 添加 > 类型 stdio: 命令 uv, 参数 --directory /path/to/twitter-mcp run twitter-mcp, 环境变量 TWITTER_TOKEN

Zed Editor

~/.config/zed/settings.json:

{
  "context_servers": {
    "twitter": {
      "command": {
        "path": "uv",
        "args": ["--directory", "/path/to/twitter-mcp", "run", "twitter-mcp"],
        "env": {
          "TWITTER_TOKEN": "<your-token>"
        }
      }
    }
  }
}

任何 stdio MCP 客户端

TWITTER_TOKEN=<your-token> \
  uv --directory /path/to/twitter-mcp run twitter-mcp

兼容性

客户端

安装方式

状态

Claude Code

claude mcp add

一行命令

OpenClaw

复制技能目录

一行命令

Claude Desktop

JSON 配置

支持

Cursor

JSON 配置

支持

Windsurf

JSON 配置

支持

Cline

JSON 配置

支持

Continue.dev

YAML / JSON

支持

Cherry Studio

GUI

支持

Zed

JSON 配置

支持


开发

cd /path/to/twitter-mcp
uv sync
uv run twitter-mcp
# MCP Inspector
npx @modelcontextprotocol/inspector uv --directory /path/to/twitter-mcp run twitter-mcp

项目结构

├── README.md
├── docs/
│   ├── README_JA.md           # 日本語
│   └── README_KO.md           # 한국어
├── openclaw-skill/opentwitter/    # OpenClaw Skill
├── pyproject.toml
├── config.json
└── src/twitter_mcp/
    ├── server.py              # Entry point
    ├── app.py                 # FastMCP instance
    ├── config.py              # Config loader
    ├── api_client.py          # HTTP client
    └── tools.py               # 8 tools

许可证

MIT

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - A tier

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/6551Team/opentwitter-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server