home / mcp / twitter mcp server
Provides programmatic access to Twitter features via an MCP server, including timeline retrieval, tweet management, DMs, and searches.
Configuration
View docs{
"mcpServers": {
"luniakunal-mcp-twitter": {
"command": "uv",
"args": [
"run",
"--with",
"twikit",
"--with",
"mcp",
"tweet_service.py"
],
"env": {
"ENV_FILE": ".env",
"COOKIES_PATH": "Path\\\\cookies.json"
}
}
}
}You can deploy the Twitter MCP Server to manage your Twitter account programmatically. It exposes endpoints and actions to read timelines, fetch tweets, search hashtags, handle direct messages, and manage your own tweets, all through a configurable MCP server written in Python.
Start the server using the standard MCP runtime to expose all Twitter-related capabilities. The server is designed to run locally and connect to the Twitter API using credentials you provide in an environment file.
Prerequisites you need before starting: Python 3.11 or newer, and uvicorn for running the server.
Install the Python dependencies from the project’s requirements file.
Set up your environment with your Twitter API credentials in an .env file and ensure a cookies file path is available if required by the server.
Run the application using the following command to start the MCP server bundled with Twitter tools.
The server exposes a single MCP configuration named twitter-mcp. It runs the runtime using the uv command with a specific directory and the tweet service script. Environment variables COOKIES_PATH and ENV_FILE are used to locate cookies and environment variables for the Twitter integration.
Store credentials securely. Limit access to the environment file and cookies file. Rotate credentials regularly and monitor access to the Twitter API to prevent abuse.
If the server fails to start, verify that Python 3.11+ is installed, the required dependencies are installed, and that the environment file (.env) contains valid Twitter API credentials. Check that the cookies path points to an accessible JSON file as configured.
Retrieve your Twitter home timeline to view the most recent tweets from your network.
Fetch tweets from any public Twitter user by specifying the username or user ID.
Search for tweets containing a specific hashtag to monitor topics of interest.
Retrieve replies to tweets and obtain summarized insights for quick understanding.
Send and receive Twitter direct messages through the MCP interface.
Programmatically compose and publish new tweets to your timeline.
Remove tweets via the API when needed.