MCP cover image
See in Github
2025-01-12

镜像://github.com/crazyrabbitltc/mcp-twitter-server

0

Github Watches

1

Github Forks

0

Github Stars

Twitter MCP Server

A Model Context Protocol server implementation for Twitter API integration.

Setup

  1. Clone the repository
  2. Install dependencies: npm install
  3. Copy .env.example to .env and fill in your Twitter API credentials
  4. Build the project: npm run build
  5. Start the server: npm start

Environment Variables

Required Twitter API credentials in .env:

X_API_KEY=your_api_key
X_API_SECRET=your_api_secret
X_ACCESS_TOKEN=your_access_token
X_ACCESS_TOKEN_SECRET=your_access_token_secret

Available Tools

Tweet Operations

  • postTweet: Post a new tweet

    {
      "text": "Your tweet text here"
    }
    
  • postTweetWithMedia: Post a tweet with media attachment

    {
      "text": "Your tweet text",
      "mediaPath": "path/to/media/file",
      "mediaType": "image/jpeg|image/png|image/gif|video/mp4",
      "altText": "Optional alt text for accessibility"
    }
    
  • getTweetById: Get a specific tweet by ID

    {
      "tweetId": "tweet_id",
      "tweetFields": ["created_at", "public_metrics"]
    }
    
  • replyToTweet: Reply to an existing tweet

    {
      "tweetId": "tweet_id",
      "text": "Your reply text"
    }
    
  • deleteTweet: Delete a tweet

    {
      "tweetId": "tweet_id"
    }
    

Search & Analytics

  • searchTweets: Search for tweets

    {
      "query": "search query",
      "maxResults": 10,
      "tweetFields": ["created_at", "public_metrics"]
    }
    
  • getHashtagAnalytics: Get analytics for a hashtag

    {
      "hashtag": "hashtag",
      "startTime": "ISO-8601 date",
      "endTime": "ISO-8601 date"
    }
    

User Operations

  • getUserInfo: Get user information

    {
      "username": "twitter_username",
      "fields": ["description", "public_metrics"]
    }
    
  • getUserTimeline: Get user's tweets

    {
      "username": "twitter_username",
      "maxResults": 10,
      "tweetFields": ["created_at", "public_metrics"]
    }
    
  • getFollowers: Get user's followers

    {
      "username": "twitter_username",
      "maxResults": 100,
      "userFields": ["description", "public_metrics"]
    }
    
  • getFollowing: Get accounts a user follows

    {
      "username": "twitter_username",
      "maxResults": 100,
      "userFields": ["description", "public_metrics"]
    }
    

Engagement

  • likeTweet: Like a tweet

    {
      "tweetId": "tweet_id"
    }
    
  • unlikeTweet: Unlike a tweet

    {
      "tweetId": "tweet_id"
    }
    
  • retweet: Retweet a tweet

    {
      "tweetId": "tweet_id"
    }
    
  • undoRetweet: Undo a retweet

    {
      "tweetId": "tweet_id"
    }
    
  • getRetweets: Get users who retweeted a tweet

    {
      "tweetId": "tweet_id",
      "maxResults": 100,
      "userFields": ["description", "public_metrics"]
    }
    
  • getLikedTweets: Get tweets liked by a user

    {
      "userId": "user_id",
      "maxResults": 100,
      "tweetFields": ["created_at", "public_metrics"]
    }
    

List Management

  • createList: Create a new list

    {
      "name": "List name",
      "description": "List description",
      "isPrivate": false
    }
    
  • addUserToList: Add a user to a list

    {
      "listId": "list_id",
      "username": "twitter_username"
    }
    
  • removeUserFromList: Remove a user from a list

    {
      "listId": "list_id",
      "username": "twitter_username"
    }
    
  • getListMembers: Get members of a list

    {
      "listId": "list_id",
      "maxResults": 100,
      "userFields": ["description", "public_metrics"]
    }
    

Error Handling

All tools return standardized error responses:

  • Missing parameters: Missing required parameter: parameter_name
  • API errors: Error message from Twitter API
  • Not found errors: Appropriate "not found" message for the resource

Response Format

All successful responses follow this format:

{
  "content": [
    {
      "type": "text",
      "text": "Operation result message"
    }
  ]
}

Development

  • Build: npm run build
  • Start: npm start
  • Watch mode: npm run dev

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • https://jgadvisorycpa.com
  • This GPT assists in finding a top-rated business CPA - local or virtual. We account for their qualifications, experience, testimonials and reviews. Business operators provide a short description of your business, services wanted, and city or state.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • modelcontextprotocol
  • 模型上下文协议服务器

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

    Reviews

    1 (1)
    Avatar
    user_C1mYLeiZ
    2025-04-16

    I recently tried the MCP Server Example by t-nakatani and am thoroughly impressed! The usability and seamless integration it offers are unmatched. The product does exactly what it promises and is easy to set up, thanks to the comprehensive start URL provided. The welcoming information is clear and helpful, ensuring a smooth experience. Highly recommend for anyone needing a robust server solution. Check it out at https://mcp.so/server/mcp_server-exmaple/t-nakatani!