Skip to main content
Glama
X Tools for Claude MCP

X Tools for Claude MCP

by 0xGval

Claude MCP 的 X 工具

一个轻量级的开源工具包,使 Claude 能够使用自然语言高效地搜索 Twitter,并根据用户意图显示结果。它专为查看原始数据和进行可选分析而设计。

特征

  • 自然语言搜索:让 Claude 用简单的英语搜索 Twitter

  • Twitter 搜索:使用自然语言或高级 Twitter 语法搜索推文

  • 专业格式:清晰、markdown 格式的推文显示

  • 灵活的输出:显示原始推文或根据您的要求添加分析

  • 高级过滤:按关键词、用户、日期、参与度指标等查找推文

  • 分页支持:需要时,每次搜索可检索超过默认的 20 条推文

Related MCP server: twitter-mcp

安装

先决条件

  • Node.js v16+

  • 克劳德桌面版

  • 免费的 RapidAPI 密钥,可访问“The Old Bird API”(Twitter154)端点

RapidAPI 密钥设置

  1. 访问RapidAPI 上的 The Old Bird API

  2. 如果您没有 RapidAPI 帐户,请注册一个

  3. 订阅 API(有免费套餐可用)

  4. 订阅后,从仪表板复制您的 RapidAPI 密钥

设置步骤

  1. 克隆此存储库:

    git clone https://github.com/0xGval/twitter-X-mcp-server
    cd twitter-X-mcp-tools
  2. 安装依赖项:

    npm install
  3. 创建您的配置:

    • 将mcp.json.example复制到 Claude Desktop 目录中的mcp.json

    • 编辑mcp.json以包含您的 RapidAPI 密钥和正确的文件路径

    {
      "mcpServers": {
        "x-tools": {
          "command": "node",
          "args": ["YOUR_ABSOLUTE_PATH_TO/main.js"],
          "env": {
            "RAPIDAPI_KEY": "your_rapidapi_key"
          }
        }
      }
    }
  4. 配置 Claude 桌面版:

    • 在 Windows 上:将mcp.json文件放在%APPDATA%\Claude\

    • 在 macOS 上:将mcp.json文件放在~/Library/Application Support/Claude/

    • 将claude-rules.md和knowledge/TwitterSearchSyntaxGuide.txt复制到你的 Claude 知识库目录

    • 重新启动 Claude Desktop 以使更改生效

可用工具

Twitter 搜索

该工具主要设计用于自然语言。只需让 Claude 在 Twitter 上搜索某个内容,它就会翻译你的请求。

searchTwitter(query: "keyword", section: "latest", limit: 20)

使用自然语言或高级语法搜索 Twitter:

  • query :搜索查询(支持 Twitter 的高级搜索运算符)

  • section :“最新”或“顶级”结果(默认值:“最新”)

  • limit :返回的推文数量(默认值:20)

自然语言示例

简单查询

问克劳德:

Show me recent tweets about artificial intelligence

以用户为中心的查询

问克劳德:

Find the latest tweets from Elon Musk that mention SpaceX

复杂自然查询

问克劳德:

Search for tweets about climate change with at least 100 likes from the past month

分析请求

问克劳德:

What's the sentiment around the new Bitcoin ETF based on recent tweets?

直接语法示例

对于那些喜欢直接语法的人来说:

from:elonmusk spacex since:2023-01-01
"artificial intelligence" filter:images min_faves:100
climate action min_retweets:50 -filter:retweets

所需文件

此工具包含几个必须正确设置的重要文件:

  • main.js :主应用程序文件

  • tools/twitter.js :Twitter 搜索实现

  • claude-rules.md :Claude 正确显示搜索结果的说明

  • knowledge/TwitterSearchSyntaxGuide.txt :Twitter 搜索语法参考指南

确保所有这些文件都放置在 Claude 设置中的正确位置。

搜索语法

该工具支持所有标准 Twitter 搜索运算符,Claude 可以通过您的自然语言应用这些运算符:

用户

  • from:username - 特定帐户发送的推文

  • to:username - 回复特定帐户

  • @username - 提及该帐户的推文

媒体和链接

  • filter:media - 包含任何媒体的推文

  • filter:images - 带图片的推文

  • filter:native_video - 带有视频的推文

  • filter:links - 带链接的推文

日期

  • since:YYYY-MM-DD - 此日期之后的推文

  • until:YYYY-MM-DD - 此日期之前的推文

订婚

  • min_retweets:n - 至少有 n 次转发的推文

  • min_faves:n - 至少有 n 个赞的推文

  • min_replies:n - 至少有 n 条回复的推文

故障排除

常见问题:

  • 未找到 API 密钥:确保您的 RapidAPI 密钥在mcp.json中正确设置

  • 路径错误:确保您使用完整的绝对路径,并在 Windows 中正确转义( \\ )

  • 无结果:请检查您的搜索查询是否有效且没有太多限制

  • Claude 行为问题:确保您拥有最新版本的claude-rules.md ,其中包含灵活的输出指令

  • 缺少文件:验证claude-rules.md和TwitterSearchSyntaxGuide.txt是否已正确添加到您的 Claude 规则和知识库中

发展

要修改该工具:

  1. 编辑tools/目录中的文件

  2. 如果需要,更新formatTwitterResults()函数中的格式

  3. 重新启动 Claude for Desktop 即可看到更改

执照

该项目已获得 MIT 许可。

致谢

  • Anthropic 的模型上下文协议 (MCP)

  • RapidAPI Twitter154 API

  • Axios

  • 佐德


注意:此工具旨在与 Claude AI 助手配合使用,并根据用户意图为 Twitter 搜索结果提供灵活的显示选项。

Available Tools

1 tool
searchTwitterD
NameRequiredDescriptionDefault
queryYes
sectionNolatest
limitNo

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool update
    • First observedsearchTwitter

TDQS

D1.7/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool 'searchTwitter' stands alone with no other tools to confuse it with.

Naming Consistency5/5

A single tool inherently has perfect naming consistency, as there are no other tool names to compare it against. The name 'searchTwitter' follows a clear verb_noun pattern.

Tool Count2/5

One tool is too few for a server named 'X Tools for Claude MCP', which implies multiple tools. This minimal set feels thin and incomplete for any meaningful domain coverage, indicating a mismatch between the server's implied purpose and its actual tool surface.

Completeness1/5

The server is severely incomplete with only a single search tool. For a Twitter-related domain, obvious gaps include operations like posting tweets, managing followers, or accessing user profiles, making it impossible for agents to perform basic workflows beyond simple searches.

Maintenance

ActivityInactive
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Enables seamless interaction with Twitter/X platform through Claude AI, allowing users to post tweets with images, search for tweets, and engage in conversations using natural language commands.
    10
    48 npm
    26
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A lightweight Twitter MCP server for Claude Code with 17 tools for reading and writing tweets, including search, user profiles, and media uploads, using a hybrid API approach.
    14 npm
    2
    ISC
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides AI agents and coding assistants with Twitter data access including tweets, user profiles, followers, and search functionality.
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Enables users to interact with X/Twitter via Claude, allowing posting tweets, searching, liking, retweeting, and more using OAuth 2.0 PKCE authentication.
    10
    7
    MIT