Skip to main content

MCP server for Twitter integration

Project description

Twitter MCP Server

A Model Context Protocol (MCP) server for Twitter integration. This server provides tools for interacting with Twitter, including searching tweets, retrieving user profiles, posting tweets, and analyzing trends.

Features

  • User Management: Get user profiles and details
  • Tweet Operations: Post, read, and search tweets
  • Trends Analysis: Discover and analyze trending topics
  • Resources: Access Twitter data through URI templates
  • Prompts: Templates for common Twitter workflows

Installation

pip install mcp-twitter

Configuration

Set the following environment variables:

# Required for read-only operations (Bearer Token authentication)
export TWITTER_BEARER_TOKEN="your_bearer_token"

# Required for write operations (OAuth 1.0a)
export TWITTER_API_KEY="your_api_key"
export TWITTER_API_SECRET="your_api_secret"
export TWITTER_ACCESS_TOKEN="your_access_token"
export TWITTER_ACCESS_SECRET="your_access_secret"

# Optional - change API base URL if needed
export TWITTER_BASE_URL="https://api.twitter.com/2"

Usage

Starting the server directly

mcp-twitter

Using with Claude Desktop

Add the following to your claude_desktop_config.json file:

"mcp-twitter": {
  "command": "uvx",
  "args": [
    "mcp-twitter"
  ],
  "env": {
    "TWITTER_BEARER_TOKEN": "your_bearer_token",
    "TWITTER_API_KEY": "your_api_key",
    "TWITTER_API_SECRET": "your_api_secret",
    "TWITTER_ACCESS_TOKEN": "your_access_token",
    "TWITTER_ACCESS_SECRET": "your_access_secret"
  }
}

Replace the environment variables with your actual Twitter API credentials.

Available Tools

  • get_user: Get details of a specific Twitter user by username
  • get_tweet: Get details of a specific tweet by ID
  • search_tweets: Search for tweets matching a query
  • get_user_tweets: Get recent tweets from a specific user
  • get_trending_topics: Get trending topics on Twitter
  • post_tweet: Post a new tweet (requires OAuth 1.0a credentials)

Available Resources

  • twitter://user/{username}: Get details about a Twitter user
  • twitter://tweets/user/{username}: Get recent tweets from a specific user
  • twitter://trends: Get current trending topics on Twitter

Available Prompts

  • draft_tweet: Template for drafting a tweet on a specific topic
  • analyze_trends: Template for analyzing Twitter trends
  • engagement_strategy: Template for developing a Twitter engagement strategy

Getting Twitter API Credentials

  1. Create a Twitter Developer account at developer.twitter.com
  2. Create a new project and app
  3. Generate the necessary keys and tokens:
    • For read-only access: Bearer Token
    • For write access: Consumer Keys (API Key & Secret) and Authentication Tokens (Access Token & Secret)

Version

0.0.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_twitter-0.0.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_twitter-0.0.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file mcp_twitter-0.0.2.tar.gz.

File metadata

  • Download URL: mcp_twitter-0.0.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.13

File hashes

Hashes for mcp_twitter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7448b712543ca3d4c9b1aa3961660b93febb6e59ca766636e624eca22e8bfe50
MD5 472c617ec2f93c9277c12259b1467ee3
BLAKE2b-256 2f526a3a914f63f7be698c7d87cceb36fb40acb8e758db9432a4dbf5de095755

See more details on using hashes here.

File details

Details for the file mcp_twitter-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_twitter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 25fcac454da560534b273f3b26827446928e913796301a3bd7d95b92b7f534fd
MD5 d7a502cc0fd763614f72aa9e70e9b3ac
BLAKE2b-256 ce91185292158ad1e4cd1ad6132994e401036aa835382f69123f68238ef6f63d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page