Skip to main content
Glama

MCP Twitter

by 0xhijo

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

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

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

  1. 描述
    1. 特征
      1. 安装和使用
        1. 本地安装
        2. 通过 NPX 安装
      2. 配置
        1. 通过 Twitter Scraper 进行配置
        2. 通过 Twitter API 进行配置
      3. 与克劳德整合
        1. 添加到 Claude 的 MCP 配置
        2. 与 Claude 一起使用
      4. 重要提示

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol (MCP) server for managing social media posts, currently supporting X (formerly Twitter).
          Last updated -
          3
          8
          JavaScript
          MIT License
        • -
          security
          A
          license
          -
          quality
          Enables interaction with Twitter through a Model Context Protocol, allowing large language models to post tweets, search for tweets, and reply to tweets.
          Last updated -
          25
          3
          18
          TypeScript
          MIT License
          • Apple
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that enables AI to interact with Twitter, allowing functions like searching tweets, comparing sentiments across accounts, and retrieving timeline content.
          Last updated -
          MIT License
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that enables AI agents to interact with Twitter without direct API access, supporting tweet operations, user interactions, and Grok AI integration.
          Last updated -
          15
          13
          TypeScript
          MIT License
          • Apple

        View all related MCP servers

        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/0xhijo/mcp_twitter'

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