Get the FREE Ultimate OpenClaw Setup Guide →

Twitter -for-Claude

MCP server from Muralikrishankp/Twitter-MCP-Server-for-Claude

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio muralikrishankp-twitter-mcp-server-for-claude python twitter_server_run.py \
  --env PYTHONPATH="src" \
  --env TWITTER_API_KEY="your_api_key" \
  --env PYTHONUNBUFFERED="1" \
  --env TWITTER_API_SECRET="your_api_secret" \
  --env TWITTER_ACCESS_TOKEN="your_access_token" \
  --env TWITTER_BEARER_TOKEN="your_bearer_token" \
  --env TWITTER_ACCESS_TOKEN_SECRET="your_access_token_secret"

How to use

This MCP server integrates real-time Twitter trends with Claude-based analysis. It fetches current trending topics from Twitter and exposes resources and tools that Claude can consume through MCP. The server is implemented in Python and is started via the twitter_server_run.py entry point. Once running, Claude Desktop can connect to the configured MCP server, list available resources and tools, and execute analysis tasks that identify business opportunities from the latest trends. To use it, ensure your Twitter API credentials are set in the environment vars and start the server. Then configure Claude Desktop to point to the twitter-trends MCP server entry so you can run the built-in analysis workflows. The planned capabilities include real-time trend fetching, category-based analysis, and Claude-powered insights for market opportunities.

How to install

Prerequisites:

  • Python 3.8 or higher
  • Claude Desktop installed
  • Twitter Developer API access with credentials
  • Basic knowledge of Python

Step 1: Create project directory

mkdir twitter-trends-mcp
cd twitter-trends-mcp

Step 2: Set up a virtual environment

python -m venv .venv
# On Windows
.venv\Scripts\activate
# On macOS/Linux
source .venv/bin/activate

Step 3: Install required packages

pip install tweepy mcp python-dotenv

Step 4: Prepare project structure (as described in README)

# Create files and folders as in the README:
# - twitter_server_run.py
# - src/twitter_trends_mcp/__init__.py
# - src/twitter_trends_mcp/server.py

Step 5: Install the package in editable mode (if you have the package scaffold)

pip install -e .

Note: This setup assumes you will implement the server code in src/twitter_trends_mcp/server.py and wire it up to the twitter_server_run.py runner as shown in the README.

Additional notes

Tips and notes:

  • Keep Twitter API credentials secure; avoid hard-coding them. Use environment variables or a secure credentials store.
  • Ensure PYTHONPATH points to the src directory so imports resolve correctly when the server runs.
  • If you encounter module not found errors, verify PYTHONPATH and the project structure matches the expected layout in the README.
  • Monitor twitter_server.log for server-side debugging and Claude-related interactions.
  • When configuring Claude Desktop, use absolute paths for the Python executable and script, and ensure the working directory is the project root.
  • Consider adding error handling for rate limits from Twitter and for Claude API calls to improve robustness.
Sponsor this space

Reach thousands of developers