twitter-mcp

MCP.Pizza Chef: EnesCinr

The Twitter MCP server is a Model Context Protocol server that facilitates direct interaction with Twitter's platform. It allows MCP clients to post tweets and perform Twitter searches programmatically, integrating Twitter's social media capabilities into AI workflows. By connecting through Twitter's Developer API, this server enables real-time social media engagement and data retrieval within MCP-enabled applications. It supports secure and efficient communication between LLMs and Twitter, enhancing automation and contextual awareness in social media tasks.

Use This MCP server To

Post tweets programmatically from AI workflows Search Twitter for real-time content and trends Integrate Twitter data into AI-driven applications Automate social media monitoring and engagement Enable LLMs to interact with Twitter APIs Fetch tweets for sentiment analysis or research

README

MseeP.ai Security Assessment Badge

Twitter MCP Server

smithery badge

This MCP server allows Clients to interact with Twitter, enabling posting tweets and searching Twitter.

Twitter Server MCP server

Quick Start

  1. Create a Twitter Developer account and get your API keys from Twitter Developer Portal

  2. Add this configuration to your Claude Desktop config file:

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "twitter-mcp": {
      "command": "npx",
      "args": ["-y", "@enescinar/twitter-mcp"],
      "env": {
        "API_KEY": "your_api_key_here",
        "API_SECRET_KEY": "your_api_secret_key_here",
        "ACCESS_TOKEN": "your_access_token_here",
        "ACCESS_TOKEN_SECRET": "your_access_token_secret_here"
      }
    }
  }
}
  1. Restart Claude Desktop

That's it! Claude can now interact with Twitter through two tools:

  • post_tweet: Post a new tweet
  • search_tweets: Search for tweets

Example Usage

Try asking Claude:

  • "Can you post a tweet saying 'Hello from Claude!'"
  • "Can you search for tweets about Claude AI?"

Troubleshooting

Logs can be found at:

  • Windows: %APPDATA%\Claude\logs\mcp-server-twitter.log
  • macOS: ~/Library/Logs/Claude/mcp-server-twitter.log

Development

If you want to contribute or run from source:

  1. Clone the repository:
git clone https://github.com/EnesCinr/twitter-mcp.git
cd twitter-mcp
  1. Install dependencies:
npm install
  1. Build:
npm run build
  1. Run:
npm start

Running evals

The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found here.

OPENAI_API_KEY=your-key  npx mcp-eval src/evals/evals.ts src/index.ts

License

MIT

twitter-mcp FAQ

How do I configure the Twitter MCP server?
Obtain Twitter API keys from the Twitter Developer Portal and add the configuration to your Claude Desktop config file as specified in the quick start guide.
Is a Twitter Developer account required to use this MCP server?
Yes, a Twitter Developer account is necessary to access API keys for authentication.
Can this MCP server post tweets on behalf of a user?
Yes, it allows posting tweets programmatically through the Twitter API.
How does the Twitter MCP server handle authentication?
It uses Twitter API keys and tokens configured in the client setup to authenticate requests securely.
Is the Twitter MCP server compatible with multiple LLM providers?
Yes, it works with any MCP client connected to LLMs like OpenAI, Claude, and Gemini.
Where can I find the Twitter MCP server source code?
The source code is available on GitHub under the repository linked in the MCP entity details.
Does the server support searching tweets by keywords?
Yes, it supports searching Twitter content using keywords and other query parameters.
How do I start the Twitter MCP server?
Follow the quick start instructions to configure and run the server using the provided command and API keys.