x-post-mcp
A Model Context Protocol (MCP) server that allows interaction with the X API, along with a client to interact with the server using Google's Gemini AI.
Documentation
π¦ X-Post MCP π
A powerful integration that allows AI models to post directly to X (formerly Twitter) using the Model Context Protocol (MCP) π€β¨
π Overview
X-Post MCP is a client-server application that enables AI models to create and publish posts on X (formerly Twitter) through a standardized interface. It leverages the Model Context Protocol to provide a seamless integration between AI models and the X platform.
β¨ Features
- π Seamless integration with X (Twitter) API
- π§ AI-powered post creation using Google's Gemini models
- π οΈ MCP server exposing X posting functionality as a tool
- π¬ Interactive chat interface for testing and demonstration
- π Secure handling of API credentials
- βοΈ Automatic truncation of posts exceeding X's character limit
π οΈ Technologies
- **Bun**: Fast all-in-one JavaScript runtime
- **TypeScript**: Type-safe JavaScript
- **Express**: Web framework for Node.js
- **Model Context Protocol (MCP)**: Standardized protocol for AI context
- **Twitter API v2**: X platform API
- **Google Gemini**: Google's generative AI models
π¦ Installation
Prerequisites
- Bun v1.2.5 or later
- X (Twitter) API credentials
- Google Gemini API key
Server Setup
# Clone the repository
git clone https://github.com/subhadeeproy3902/x-post-mcp.git
cd x-post-mcp
# Install server dependencies
cd server
bun installClient Setup
# From the project root
cd client
bun installβοΈ Configuration
Obtaining X (Twitter) API Credentials
1. Create a Developer Account:
2. Create a Project & App:
3. Set App Permissions:
4. Generate Access Tokens:
> β οΈ Important: Keep your API keys and tokens secure and never commit them to public repositories.
Server Environment Variables
Create a `.env` file in the `server` directory with the following variables:
# X (Twitter) API Credentials
TWITTER_API_KEY=your_twitter_api_key
TWITTER_API_SECRET=your_twitter_api_secret
TWITTER_ACCESS_TOKEN=your_twitter_access_token
TWITTER_ACCESS_SECRET=your_twitter_access_secretObtaining Google Gemini API Key
1. Create a Google AI Studio Account:
2. Get API Key:
> β οΈ Important: Keep your API key secure and never commit it to public repositories.
Client Environment Variables
Create a `.env` file in the `client` directory with the following variables:
# Google Gemini API Key
GEMINI_API_KEY=your_gemini_api_keyπ Usage
Starting the Server
cd server
bun run devThe server will start on http://localhost:3001.
Starting the Client
cd client
bun run index.tsThe client will connect to the server and provide an interactive chat interface where you can interact with the AI model and instruct it to post to X.
Example Commands
Once the client is running, you can interact with the AI model:
You: Post a tweet about the beautiful weather todayThe AI will use the Gemini model to generate a post and then use the MCP tool to publish it to X.
ποΈ Architecture
Server
The server component is built with Express and implements the Model Context Protocol. It exposes a tool called `createPost` that can be used to post to X. The server uses Server-Sent Events (SSE) for communication with clients.
Client
The client component connects to the MCP server and provides an interface for interacting with Google's Gemini AI models. It translates user requests into AI-generated content and can call the server's tools to post to X.
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgements
- Model Context Protocol for providing the standardized AI context protocol
- Twitter API v2 for X platform integration
- Google Gemini for AI capabilities
Frequently asked questions
What is x-post-mcp?
x-post-mcp is A Model Context Protocol (MCP) server that allows interaction with the X API, along with a client to interact with the server using Google's Gemini AI.
How do I install x-post-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is x-post-mcp open source?
Yes β it is hosted on GitHub at https://github.com/subhadeeproy3902/x-post-mcp and has 1 stars.
Related MCP tools
Enhanced ChatGPT Clone: Features Agents, MCP, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini...
π¦ Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file. Perfect for when you need to feed your codebase to Large Lan...
AI Agents & MCPs & AI Workflow Automation β’ (~400 MCP servers for AI agents) β’ AI Automation / AI Agent with MCPs β’ AI Workflows & AI Agents β’ MCPs for AI Ag...
π¬DeepChat - A smart assistant that connects powerful AI to your personal world for the Model Context Protocol. Enhance AI assistants with powerful integrations
π€ A visualization mcp contains 25+ visual charts using @antvis. Using for chart generation and data analysis. TypeScript-based implementation.
Brings MCP to ChatGPT, DeepSeek, Perplexity, Grok, Gemini, Google AI Studio, OpenRouter, DeepSeek, T3 Chat and more... TypeScript-based implementation.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP