A Unofficial Twitter MCP Server with cookie auth.
claude mcp add --transport stdio gkydev-twitter-mcp-server python server.py
How to use
The Twitter MCP Server exposes a collection of tools built on top of the twikit library to interact with X/Twitter using cookie-based authentication. It supports a wide range of operations including timeline access, user information, tweet posting and management (like, retweet, bookmark), direct messaging, and trending topics. Authentication is performed by providing the ct0 and auth_token cookies with each tool call, enabling session caching and streamlined interactions. The available tools automate common Twitter actions and data retrieval, allowing an AI agent to perform tasks such as reading timelines, posting tweets, fetching user profiles, sending direct messages, and querying trends.
To use the server, run it locally using the Python entry point described in the installation section. Once the server is running, craft JSON payloads with the tool name and the required arguments (including ct0 and auth_token cookies) to invoke the corresponding Twitter actions. Each tool expects arguments defined in the README, for example tweeting, retrieving user info, or getting DM history. The server handles session management and cookies behind the scenes to simplify repeated operations across multiple requests.
How to install
Prerequisites:
- Python 3.8+ installed on your system
- Git installed to clone the repository
- internet access to install dependencies
Installation steps:
- Clone the repository:
git clone <repository-url>
cd twitter-mcp
- Create and activate a virtual environment (optional but recommended):
python -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activate.bat
- Install dependencies:
pip install -r requirements.txt
- Run the server:
python server.py
- The server should start and listen for requests. Use the documented tool calls to interact with Twitter via the MCP server.
Additional notes
Notes and tips:
- Cookie handling: Each tool call must include the ct0 and auth_token cookies provided by the LLM. There is no separate pre-configuration step required.
- Security: Treat cookies as sensitive data. Do not expose ct0/auth_token in logs or shared prompts.
- Rate limits: Be mindful of Twitter/X rate limits; the wrapper may expose methods that can be throttled by Twitter if used aggressively.
- Debugging: If a tool returns an error, ensure cookies are valid and that the target Twitter account has permission for the requested action (e.g., DM or follow actions may be restricted by account settings).
- Environment: You can customize the server behavior via additional environment variables if the codebase supports them; refer to the codebase documentation for available options.
Related MCP Servers
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
mcp-in-action
极客时间MCP新课已经上线!超2000同学一起开启MCP学习之旅!
mcp-stata
A lightweight Model Context Protocol (MCP) server for Stata. Execute commands, inspect data, retrieve stored results (r()/e()), and view graphs in your chat interface. Built for economists who want to integrate LLM assistance into their Stata workflow.
asterisk
Asterisk Model Context Protocol (MCP) server.
julia
MCP server for persistent Julia sessions — fast iteration without startup/compilation overhead
BinAssistMCP
Binary Ninja plugin to provide MCP functionality.