- Explore MCP Servers
- x-post-mcp-server
X Post Mcp Server
What is X Post Mcp Server
x-post-mcp-server is a Model Context Protocol (MCP) server designed for interacting with the X (formerly Twitter) API. It includes a client that utilizes Google’s Gemini AI for natural language interactions and features automated daily posting scripts.
Use cases
Use cases include automating daily posts of news summaries, sharing inspirational quotes, and commemorating historical events, making it suitable for content creators, marketers, and developers interested in leveraging AI for social media engagement.
How to use
To use x-post-mcp-server, clone the repository, set up the required environment variables with your API keys for X/Twitter and Google Gemini AI, and run the server. You can then interact with the MCP server to create posts or utilize the automated posting features.
Key features
Key features include an MCP server that exposes a ‘createPost’ tool for posting tweets, a client that connects to the server using Google Gemini AI, and automated scripts for daily posting of Hacker News recaps, quotes, and historical events.
Where to use
x-post-mcp-server can be used in social media management, content automation, and AI-driven interactions, particularly for users or businesses looking to enhance their presence on X (Twitter).
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is X Post Mcp Server
x-post-mcp-server is a Model Context Protocol (MCP) server designed for interacting with the X (formerly Twitter) API. It includes a client that utilizes Google’s Gemini AI for natural language interactions and features automated daily posting scripts.
Use cases
Use cases include automating daily posts of news summaries, sharing inspirational quotes, and commemorating historical events, making it suitable for content creators, marketers, and developers interested in leveraging AI for social media engagement.
How to use
To use x-post-mcp-server, clone the repository, set up the required environment variables with your API keys for X/Twitter and Google Gemini AI, and run the server. You can then interact with the MCP server to create posts or utilize the automated posting features.
Key features
Key features include an MCP server that exposes a ‘createPost’ tool for posting tweets, a client that connects to the server using Google Gemini AI, and automated scripts for daily posting of Hacker News recaps, quotes, and historical events.
Where to use
x-post-mcp-server can be used in social media management, content automation, and AI-driven interactions, particularly for users or businesses looking to enhance their presence on X (Twitter).
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
🤖 MCP X/Twitter Post Server & Client
This project demonstrates a Model Context Protocol (MCP) server that allows interaction with the X (formerly Twitter) API, along with a client to interact with the server using Google’s Gemini AI, and automated daily posting scripts.
✨ Features
- MCP Server (
/server): Exposes acreatePosttool via MCP to post tweets. - MCP Client (
/client): Connects to the MCP server and uses Google Gemini AI to interact with thecreatePosttool through natural language. - Auto Poster (
/server/autopost.ts): 🚀 Fetches top Hacker News stories daily, generates a recap using Gemini AI, and posts it to X using thecreatePosttool. - Quote Poster (
/server/autopost_quotes.ts): 💬 Fetches a random ZenQuotes quote and posts it to X. - On This Day Poster (
/server/autopost_today.ts): 📅 Fetches a historical event for today from ZenQuotes and posts it to X. - GitHub Actions: 🤖 Automates posting with workflows:
/.github/workflows/daily-post.yml: 📰 Posts Hacker News recap daily at 12:00 UTC./.github/workflows/autopost_quotes.yml: 💡 Posts a quote daily at 4:00 UTC./.github/workflows/autopost_today.yml: 🏛️ Posts a historical event daily at 18:00 UTC.
🚀 Getting Started
Prerequisites
- Bun installed (
v1.2.5or later recommended). - Node.js (compatible version for Bun).
- API keys for X/Twitter and Google Gemini AI.
Setup
- Clone the repository:
git clone https://github.com/Xeven777/x-post-mcp-server cd x-post-mcp-server - Environment Variables:
- Navigate to the
serverdirectory:cd server - Create a
.envfile by copying the example or creating a new one. Seeserver/.envfor required variables (you’ll needTWITTER_API_KEY,TWITTER_API_SECRET,TWITTER_ACCESS_TOKEN,TWITTER_ACCESS_SECRET,GEMINI_API_KEY). - Fill in your API credentials.
- Navigate back to the root directory:
cd .. - (Optional) If the client needs specific environment variables (like
GEMINI_API_KEYif not using the server’s), repeat the.envcreation process in theclientdirectory. The current client readsGEMINI_API_KEYfrom the environment it’s run in.
- Navigate to the
🖥️ Server (/server)
The server exposes the MCP endpoint and the createPost tool.
- Navigate to the server directory:
cd server - Install dependencies:
bun install - Run the server:
Or, to run the compiled version (after building):bun run dev
The server will be running onbun run build bun run starthttp://localhost:3001.
🗣️ Client (client)
The client connects to the server and allows you to interact with the createPost tool using natural language via Gemini.
- Navigate to the client directory:
cd client - Install dependencies:
bun install - Ensure the server is running.
- Run the client:
(Make sureGEMINI_API_KEYis available in this terminal’s environment)
You can now chat with the AI. Try asking it to “post ‘Hello World!’ to X”.bun run index.ts
📰 Auto Posters (/server/autopost.ts, /server/autopost_quotes.ts, /server/autopost_today.ts)
- Hacker News Recap: 🚀 Fetches the top 5 Hacker News stories from the last ~24 hours, uses Gemini to generate a witty recap, and posts it to X.
- Quote Poster: 💬 Fetches a random quote from ZenQuotes and posts it to X.
- On This Day Poster: 📅 Fetches a historical event for today from ZenQuotes and posts it to X.
How to use:
- 📂 Navigate to the server directory:
cd server - 📦 Install dependencies:
bun install - 🔑 Set up your
.envfile with Twitter and Gemini keys. - ▶️ Run the scripts directly:
bun run autopost.ts # 🚀 Hacker News Recap bun run autopost_quotes.ts # 💬 ZenQuotes Quote bun run autopost_today.ts # 📅 On This Day Event
🔁 Automated GitHub Actions
The following workflows keep your X account fresh and fun, automatically:
daily-post.yml: 📰 Runsserver/autopost.tsevery day at 12:00 UTC.autopost_quotes.yml: 💡 Runsserver/autopost_quotes.tsevery day at 4:00 UTC.autopost_today.yml: 🏛️ Runsserver/autopost_today.tsevery day at 18:00 UTC.
Each workflow:
- ✅ Checks out the code
- 🛠️ Sets up Node.js
- 📦 Installs dependencies
- 🚦 Runs the respective script using secrets configured in the GitHub repository settings
Enjoy using the MCP X Poster! 🎉
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










