π¦ X-Post MCP π
@subhadeeproy3902
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.
Overview
What is π¦ X-Post MCP π?
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 using the Model Context Protocol (MCP). It integrates Google Gemini AI models with the X platform, allowing AI assistants to generate and post content.
How to use π¦ X-Post MCP π?
Install prerequisites (Bun v1.2.5+, X API credentials, Google Gemini API key). Clone the repository, install dependencies in both server and client directories, and create .env files with API keys. Start the server with bun run dev (listens on port 3001) and the client with bun run index.ts. Interact via the chat interface to instruct the AI to post to X.
Key features of π¦ X-Post MCP π
- Seamless integration with X (Twitter) API v2
- AI-powered post creation using Google Gemini models
- MCP server exposes a
createPosttool - Interactive chat interface for testing
- Secure handling of API credentials
- Automatic truncation of posts exceeding X's character limit
Use cases of π¦ X-Post MCP π
- Automating social media posts from AI assistants
- Generating and publishing AI-created content on X
- Testing MCP-based tool integration with Twitter
FAQ from π¦ X-Post MCP π
What does π¦ X-Post MCP π do?
It allows AI models (via Gemini) to post to X (Twitter) by exposing a MCP tool called createPost. Users interact through a chat client that translates requests into AI-generated tweets.
What prerequisites are needed to run π¦ X-Post MCP π?
You need Bun v1.2.5 or later, X (Twitter) API credentials (API key, secret, access token, access secret), and a Google Gemini API key.
How do I obtain X API credentials for π¦ X-Post MCP π?
Register a developer account on the X Developer Portal, create a project and app, enable OAuth 1.0a with βRead and Write and Direct Messagesβ permissions, and generate consumer keys and access tokens.
How does the client communicate with the server in π¦ X-Post MCP π?
The server uses Server-Sent Events (SSE) for communication. The client connects to the MCP server and sends commands via the chat interface.
What happens if a post exceeds Xβs character limit?
The server automatically truncates the post to fit within Xβs character limit before publishing.