MCP Twitter

by 0xhijo
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Supports configuration through environment variables stored in a .env file, allowing users to securely provide Twitter authentication credentials.

  • Enables installation via cloning the GitHub repository, with the source code hosted at github.com/0xhijo/mcp_twitter.

  • Provides installation and execution through NPX, allowing users to run the server without explicit installation.

MCP 推特

描述

MCP Twitter 是一个基于模型上下文协议 (MCP) 的服务器,允许与 Twitter/X 直接交互。它通过一套标准化工具公开各种 Twitter API 功能,使 AI 模型和应用程序能够在 Twitter 上执行操作。

特征

该 MCP 服务器提供以下操作:

  • create_twitter_post :创建新的 X/Twitter 帖子
  • reply_twitter_tweet :通过 ID 回复特定的 X/Twitter 帖子
  • get_last_tweet :获取指定 X/Twitter 帐户的最新帖子
  • get_last_tweets_options :获取与搜索查询匹配的指定数量的帖子
  • create_and_post_twitter_thread :创建并发布 X/Twitter 线程
  • follow_twitter_from_username :通过用户名关注 X/Twitter 用户
  • get_twitter_profile_from_username :通过用户名获取完整的 X/Twitter 个人资料数据
  • get_twitter_user_id_from_username :从用户名获取 X/Twitter 用户 ID
  • get_last_tweet_and_replies_from_user :获取用户最近的 X/Twitter 帖子和回复
  • get_last_tweet_from_user :获取用户最近的 X/Twitter 帖子
  • get_own_twitter_account_info :获取当前帐户资料数据

安装和使用

本地安装

# Clone the repository git clone https://github.com/0xhijo/mcp_twitter.git # Install dependencies and build the project pnpm build # Launch the server node ./build/index.js

通过 NPX 安装

npx mcp_twitter

配置

通过 Twitter Scraper 进行配置

  1. 配置 .env 文件:
TWITTER_AUTH_MODE = "CREDENTIALS" # Credentials mode # Your Twitter credentials TWITTER_USERNAME="YOUR_TWITTER_USERNAME" TWITTER_PASSWORD="YOUR_TWITTER_PASSWORD" TWITTER_EMAIL="YOUR_TWITTER_EMAIL"

您需要通过创建.env文件或直接将变量添加到您的环境中来配置 Twitter 身份验证。

通过 Twitter API 进行配置

  1. 创建开发者帐户:

确保您拥有 Twitter 帐户 访问开发者平台 获取您的 API 凭证 如果您需要帮助创建开发者帐户,请遵循本指南

  1. 配置 .env 文件
TWITTER_AUTH_MODE = "API" # API mode # Your CREDENTIALS obtained from the Developer Platform TWITTER_API="YOUR_TWITTER_API" TWITTER_API_SECRET="YOUR_TWITTER_API_SECRET" TWITTER_ACCESS_TOKEN="YOUR_TWITTER_ACCESS_TOKEN" TWITTER_ACCESS_TOKEN_SECRET="YOUR_TWITTER_ACCESS_TOKEN_SECRET"

与克劳德整合

要将 MCP Twitter 与 Claude 结合使用,您需要将其添加到claude_mcp_config.json文件中。这将允许 Claude 通过 MCP 服务器与 Twitter 进行交互。

添加到 Claude 的 MCP 配置

将以下条目添加到您的claude_mcp_config.json文件:

"mcp_twitter": { "command": "npx", "args": ["mcp_twitter"], "env": { "TWITTER_AUTH_MODE": "CREDENTIALS", "TWITTER_USERNAME": "YOUR_TWITTER_USERNAME", "TWITTER_PASSWORD": "YOUR_TWITTER_PASSWORD", "TWITTER_EMAIL": "YOUR_TWITTER_EMAIL" } }

将占位符凭据替换为你的实际 Twitter 帐户信息。当 Claude 需要与 Twitter 交互时,此配置将使用 npx 启动 MCP Twitter 服务器。

与 Claude 一起使用

配置完成后,Claude 将能够使用 MCP 服务器提供的所有 Twitter 功能,例如创建帖子、检索推文等等。您只需让 Claude 执行 Twitter 操作,它就会利用 MCP 服务器来执行。

重要提示

  • 根据您的需求选择身份验证模式(API 或 CREDENTIALS)
  • 验证您的凭据是否在 .env 文件中正确配置
  • 查看官方文档以了解有关 API 限制的更多详细信息
-
security - not tested
A
license - permissive license
-
quality - not tested

模型上下文协议服务器使 AI 模型和应用程序能够直接与 Twitter/X 交互,提供创建帖子、回复推文、检索用户数据和管理帐户操作的功能。

  1. Description
    1. Features
      1. Installation and Usage
        1. Local Installation
        2. Installation via NPX
      2. Configuration
        1. Configuration via Twitter Scraper
        2. Configuration via Twitter API
      3. Integrating with Claude
        1. Adding to Claude's MCP Configuration
        2. Usage with Claude
      4. Important Notes
        ID: l6x7np7rv6