Twitter Search MCP server

Enables Claude to search Twitter with natural language queries, filtering by keywords, users, dates, and engagement metrics with formatted markdown results.
Back to servers
Setup instructions
Provider
0xGval
Release date
Mar 26, 2025
Language
TypeScript
Stats
2 stars

X Tools for Claude MCP is a lightweight toolkit that enables Claude to search Twitter efficiently with natural language and display results based on user intent. It allows for both raw data viewing and optional analysis, making it easy to find and analyze tweets on various topics.

Prerequisites

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

Installation

Getting a RapidAPI Key

  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 (free tier available)
  4. Copy your RapidAPI key from your dashboard

Setting Up the MCP Server

  1. Clone the 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

Using the Twitter Search Tool

The tool is designed to work with natural language queries, allowing you to simply ask Claude to search Twitter.

Basic Search Syntax

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

Parameters:

  • 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 Query Examples

Simply ask Claude something like:

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?

Direct Syntax Examples

For more precise searches, you can use Twitter's search operators:

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

Supported Search Operators

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 and their solutions:

  • 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
  • Missing Files: Verify that claude-rules.md and TwitterSearchSyntaxGuide.txt are properly added to your Claude rules and knowledge base

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "x-tools" '{"command":"node","args":["YOUR_ABSOLUTE_PATH_TO/main.js"],"env":{"RAPIDAPI_KEY":"your_rapidapi_key"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "x-tools": {
            "command": "node",
            "args": [
                "YOUR_ABSOLUTE_PATH_TO/main.js"
            ],
            "env": {
                "RAPIDAPI_KEY": "your_rapidapi_key"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "x-tools": {
            "command": "node",
            "args": [
                "YOUR_ABSOLUTE_PATH_TO/main.js"
            ],
            "env": {
                "RAPIDAPI_KEY": "your_rapidapi_key"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later