Cover image
Try Now
2025-03-26

Claude MCP的X工具:一种轻巧的工具包,使Claude能够根据用户意图搜索自然语言和显示结果的Twitter。获取原始推文数据或AI分析 - 您的选择。支持高级Twitter搜索操作员,并提供用于用户,日期和参与度指标的过滤器。通过MCP与Claude桌面无缝集成。

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

X Tools for Claude MCP

A lightweight, open-source toolkit that enables Claude to search Twitter efficiently with natural language and display results based on user intent. Designed for both raw data viewing and optional analysis.

Features

  • Natural Language Search: Ask Claude to search Twitter in plain English
  • Twitter Search: Search tweets using natural language or advanced Twitter syntax
  • Professional Formatting: Clean, markdown-formatted tweet display
  • Flexible Output: Display raw tweets or add analysis based on what you ask for
  • Advanced Filtering: Find tweets by keywords, users, dates, engagement metrics, and more
  • Pagination Support: Retrieve more than the default 20 tweets per search when needed

Installation

Prerequisites

  • Node.js v16+
  • Claude for Desktop
  • Free RapidAPI key with access to the "The Old Bird API" (Twitter154) endpoint

RapidAPI Key Setup

  1. Visit The Old Bird API on RapidAPI
  2. Sign up for a RapidAPI account if you don't have one
  3. Subscribe to the API (there is a free tier available)
  4. Once subscribed, copy your RapidAPI key from your dashboard

Setup Steps

  1. Clone this repository:

    git clone https://github.com/0xGval/twitter-X-mcp-server
    cd twitter-X-mcp-tools
    
  2. Install dependencies:

    npm install
    
  3. Create your configuration:

    • Copy mcp.json.example to mcp.json in your Claude Desktop directory
    • Edit mcp.json to include your RapidAPI key and correct file paths
    {
      "mcpServers": {
        "x-tools": {
          "command": "node",
          "args": ["YOUR_ABSOLUTE_PATH_TO/main.js"],
          "env": {
            "RAPIDAPI_KEY": "your_rapidapi_key"
          }
        }
      }
    }
    
  4. Configure Claude for Desktop:

    • On Windows: Place your mcp.json file in %APPDATA%\Claude\
    • On macOS: Place your mcp.json file in ~/Library/Application Support/Claude/
    • Copy claude-rules.md and knowledge/TwitterSearchSyntaxGuide.txt to your Claude knowledge base directory
    • Restart Claude Desktop for the changes to take effect

Available Tools

Twitter Search

The tool is primarily designed to be used with natural language. Simply ask Claude to search for something on Twitter, and it will interpret your request.

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

Search Twitter using natural language or advanced syntax:

  • query: Search query (supports Twitter's advanced search operators)
  • section: "latest" or "top" results (default: "latest")
  • limit: Number of tweets to return (default: 20)

Natural Language Examples

Simple Query

Ask Claude:

Show me recent tweets about artificial intelligence

User-Focused Query

Ask Claude:

Find the latest tweets from Elon Musk that mention SpaceX

Complex Natural Query

Ask Claude:

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

Analysis Request

Ask Claude:

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

Direct Syntax Examples

For those who prefer direct syntax:

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

Required Files

This tool includes several important files that must be properly set up:

  • main.js: The main application file
  • tools/twitter.js: The Twitter search implementation
  • claude-rules.md: Instructions for Claude to display search results appropriately
  • knowledge/TwitterSearchSyntaxGuide.txt: Reference guide for Twitter search syntax

Make sure all these files are placed in the correct locations in your Claude setup.

Search Syntax

The tool supports all standard Twitter search operators, which Claude can apply from your natural language:

Users

  • from:username - Tweets sent by a specific account
  • to:username - Replies to a specific account
  • @username - Tweets mentioning the account

Media and Links

  • filter:media - Tweets with any media
  • filter:images - Tweets with images
  • filter:native_video - Tweets with videos
  • filter:links - Tweets with links

Dates

  • since:YYYY-MM-DD - Tweets after this date
  • until:YYYY-MM-DD - Tweets before this date

Engagement

  • min_retweets:n - Tweets with at least n retweets
  • min_faves:n - Tweets with at least n likes
  • min_replies:n - Tweets with at least n replies

Troubleshooting

Common issues:

  • API Key Not Found: Ensure your RapidAPI key is correctly set in mcp.json
  • Path Errors: Make sure you're using full absolute paths with proper escaping in Windows (\\)
  • No Results: Check that your search query is valid and not too restrictive
  • Claude Behavior Issues: Make sure you have the latest version of claude-rules.md that includes the flexible output instructions
  • Missing Files: Verify that claude-rules.md and TwitterSearchSyntaxGuide.txt are properly added to your Claude rules and knowledge base

Development

To modify the tool:

  1. Edit the files in the tools/ directory
  2. Update the formatting in formatTwitterResults() function if needed
  3. Restart Claude for Desktop to see changes

License

This project is licensed under the MIT License.

Acknowledgements

  • Model Context Protocol (MCP) by Anthropic
  • RapidAPI Twitter154 API
  • Axios
  • Zod

Note: This tool is designed to work with the Claude AI assistant and provide Twitter search results with flexible display options based on user intent.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Lists Tailwind CSS classes in monospaced font

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

    Reviews

    5 (1)
    Avatar
    user_SvSifRjH
    2025-04-15

    As a dedicated user of MCP Servers for Cursor AI, I can confidently say this service is unparalleled. The server's efficiency and reliability significantly enhance my AI projects' performance. Additionally, the seamless integration and user-friendly interface provided by mericozkayagan make this an indispensable tool. Highly recommended for anyone in need of robust AI infrastructure!