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.
Clone the repository:
git clone https://github.com/0xGval/twitter-X-mcp-server
cd twitter-X-mcp-tools
Install dependencies:
npm install
Create your configuration:
mcp.json.example
to mcp.json
in your Claude Desktop directorymcp.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"
}
}
}
}
Configure Claude for Desktop:
mcp.json
file in %APPDATA%\Claude\
mcp.json
file in ~/Library/Application Support/Claude/
claude-rules.md
and knowledge/TwitterSearchSyntaxGuide.txt
to your Claude knowledge base directoryThe tool is designed to work with natural language queries, allowing you to simply ask Claude to search Twitter.
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)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?
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
from:username
- Tweets sent by a specific accountto:username
- Replies to a specific account@username
- Tweets mentioning the accountfilter:media
- Tweets with any mediafilter:images
- Tweets with imagesfilter:native_video
- Tweets with videosfilter:links
- Tweets with linkssince:YYYY-MM-DD
- Tweets after this dateuntil:YYYY-MM-DD
- Tweets before this datemin_retweets:n
- Tweets with at least n retweetsmin_faves:n
- Tweets with at least n likesmin_replies:n
- Tweets with at least n repliesCommon issues and their solutions:
mcp.json
\\
)claude-rules.md
claude-rules.md
and TwitterSearchSyntaxGuide.txt
are properly added to your Claude rules and knowledge baseTo 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.
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.
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"
}
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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