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
- Create a Twitter Developer account at developer.twitter.com
- Create a new project and app
- 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
Metadata
Release files for mcp-twitter 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_twitter-0.0.2.tar.gz | 5.8 kB | Without provenance | Details for mcp_twitter-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_twitter-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for mcp_twitter-0.0.2-py3-none-any.whl |
Total release size: 12.3 kB
Release files / mcp_twitter-0.0.2.tar.gz
| Download URL | mcp_twitter-0.0.2.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7448b712543ca3d4c9b1aa3961660b93febb6e59ca766636e624eca22e8bfe50
|
|
BLAKE2b-256 checksum How to use checksums |
2f526a3a914f63f7be698c7d87cceb36fb40acb8e758db9432a4dbf5de095755
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.13
|
Release files / mcp_twitter-0.0.2-py3-none-any.whl
| Download URL | mcp_twitter-0.0.2-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25fcac454da560534b273f3b26827446928e913796301a3bd7d95b92b7f534fd
|
|
BLAKE2b-256 checksum How to use checksums |
ce91185292158ad1e4cd1ad6132994e401036aa835382f69123f68238ef6f63d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.13
|
Security for mcp-twitter 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.