Cover image
Try Now
2025-04-06

模型上下文协议服务器用于Twitter集成。可用于在后台使用Twitter API执行CRUD

3 years

Works with Finder

1

Github Watches

0

Github Forks

1

Github Stars

X Logo X (Twitter) MCP Server

This MCP server allows Clients to interact with X (formerly Twitter), enabling comprehensive platform operations including posting tweets, searching content, managing accounts, and organizing lists.

Quick Start

  1. Create an X Developer account and get your API keys from X Developer Portal
  2. Set all required API keys in the environment variables
  3. Clone this repository: git clone https://github.com/Dishant27/twitter-mcp.git
  4. Install dependencies: npm install
  5. Run the server:
  • With environment variables:
TWITTER_API_KEY=your_api_key \
TWITTER_API_SECRET=your_api_secret \
TWITTER_ACCESS_TOKEN=your_access_token \
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret \
npm start
  • Using a .env file:
# Create a .env file with your X API keys
echo "TWITTER_API_KEY=your_api_key
TWITTER_API_SECRET=your_api_secret
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret" > .env

# Start the server
npm start
  1. Use with a MCP client, such as Claude.

Claude Configuration

To use this server with Claude, you'll need to set up the MCP configuration. Here's an example of how the configuration structure should look:

{
  "name": "x",
  "display_name": "X",
  "description": "X MCP allows Claude to interact with X (formerly Twitter)",
  "path": "path/to/twitter-mcp/dist/index.js",
  "startup": {
    "env": {
      "TWITTER_API_KEY": "your_api_key",
      "TWITTER_API_SECRET": "your_api_secret",
      "TWITTER_ACCESS_TOKEN": "your_access_token",
      "TWITTER_ACCESS_TOKEN_SECRET": "your_access_token_secret"
    }
  },
  "transport": "stdio"
}

Save this configuration in your Claude MCP config directory, typically located at:

  • Windows: %APPDATA%\AnthropicClaude\mcp-servers
  • macOS: ~/Library/Application Support/AnthropicClaude/mcp-servers
  • Linux: ~/.config/AnthropicClaude/mcp-servers

Features

Post Operations

  • Post content (up to 280 characters)
  • Search for posts by query with customizable result count

Account Management

  • Get profile information for any user or the authenticated account
  • Update profile details (name, bio, location, website URL)
  • Follow and unfollow users
  • List followers for any user or the authenticated account
  • List accounts that a user is following

List Management

  • Create new lists (public or private)
  • Get information about specific lists
  • Retrieve all lists owned by the authenticated user

Available MCP Tools

Tool Name Description
post_tweet Post new content to X
search_tweets Search for content on X
get_profile Get profile information for a user or the authenticated account
update_profile Update the authenticated user's profile
follow_user Follow a user
unfollow_user Unfollow a user
list_followers List followers of a user or the authenticated account
list_following List accounts that a user or the authenticated account is following
create_list Create a new list
get_list_info Get information about a list
get_user_lists Get all lists owned by the authenticated user

Requirements

  • Node.js 18.x or higher
  • X Developer account with API keys
  • API v1 and v2 access

Environment Variables

Variable Description
TWITTER_API_KEY Your API key
TWITTER_API_SECRET Your API secret
TWITTER_ACCESS_TOKEN Your access token
TWITTER_ACCESS_TOKEN_SECRET Your access token secret

Repository Structure

twitter-mcp/
├── .github/
│   └── workflows/
│       ├── publish.yml
│       └── release.yml
├── code/
│   ├── account_management.py  # Sample Python code for account management
│   ├── post_tweet.py          # Sample Python code for posting content
│   └── retrieve_tweets.py     # Sample Python code for retrieving content
├── src/
│   ├── index.ts        # Main entry point
│   ├── twitter-api.ts  # X API client
│   ├── formatter.ts    # Response formatter
│   └── types.ts        # Type definitions
├── .env.example
├── .gitignore
├── Dockerfile
├── LICENSE
├── package.json
├── README.md
└── tsconfig.json

License

MIT

相关推荐

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

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

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

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

  • 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!

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

  • Lists Tailwind CSS classes in monospaced font

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

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

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

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

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

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

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • JackKuo666
  • 🔍使AI助手可以通过简单的MCP接口搜索和访问PYPI软件包信息。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

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

    Reviews

    4 (1)
    Avatar
    user_0QofbqLg
    2025-04-17

    I've been using twitter-mcp for a while now, and it has drastically improved my Twitter experience. The tool is easy to set up and the functionalities it offers are exactly what I needed. Kudos to Dishant27 for creating such a useful application. Highly recommended for anyone looking to streamline their Twitter interactions!