MCP ExplorerExplorer

Mcp Ai Agent

@kumarprakhar14on 10 months ago
1 MIT
FreeCommunity
AI Systems
MCP-AI-Agent integrates Google's Gemini AI with Twitter using MCP for seamless interactions.

Overview

What is Mcp Ai Agent

MCP-AI-Agent is a project that integrates Google’s Gemini AI model with Twitter using the Model Context Protocol (MCP) for seamless interactions, allowing users to engage with AI through a command-line interface and post tweets via Twitter API.

Use cases

Use cases include automating tweet posting based on user inputs, generating content for social media, and providing AI-driven responses to user queries on Twitter.

How to use

To use MCP-AI-Agent, clone the repository, set up the server and client by installing dependencies and configuring API keys in the .env file. Start the server and client to interact with the AI and post tweets.

Key features

Key features include integration with Google Gemini AI, real-time user interaction through a command-line interface, REST API for tool exposure, and the ability to post tweets using Twitter API credentials.

Where to use

MCP-AI-Agent can be used in various fields such as social media management, AI-driven content creation, customer engagement, and automated tweeting.

Content

🚀 Twitter-AI-AGENT: MCP-Enabled Twitter Bot

📡 About MCP Server

Model Context Protocol (MCP) enables AI models to interact with external tools and services through a standardized interface. It allows seamless integration between AI and functionalities—making it easier to build AI-powered applications.


🤖 About the Project

This project demonstrates the integration of Google’s Gemini AI model with Twitter (X) using the MCP protocol.
It provides a command-line interface where users interact with AI, which can post tweets via Twitter API credentials.


⚙️ How It Works

  1. The MCP server exposes tools (e.g., createPost, addTwoNumbers) via a REST API.
  2. The client connects to the MCP server using Server-Sent Events (SSE).
  3. User inputs are processed by Gemini AI.
  4. The AI chooses to call available tools based on context.
  5. Results are displayed back to the user in real time.

🛠️ Using the Project

📥 Clone the Repository

git clone https://github.com/kumarprakhar14/MCP-AI-Agent.git
cd MCP-AI-Agent

🖥️ Server Setup

cd server
npm install
# Create .env file with Twitter API credentials
npx nodemon ./index.js

💻 Client Setup

cd client
npm install
# Add GEMINI_API_KEY to .env file
npx nodemon ./index.js

📦 Dependencies

  • Node.js
  • Express
  • twitter-api-v2
  • @modelcontextprotocol/sdk
  • @google/genai
  • zod
  • dotenv

🔐 Getting API Keys

🧠 Gemini API Key

  1. Visit Google AI Studio
  2. Sign in with your Google account
  3. Click “Get API Key”
  4. Copy it and add to your .env file:
GEMINI_API_KEY=your_gemini_api_key

🐦 Twitter (X) API Keys

  1. Go to Twitter Developer Portal
  2. Create a new project and app
  3. Enable Read and Write permissions
  4. Generate the following and add them to your .env file:
TWITTER_API_KEY
TWITTER_API_SECRET
TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET

🧪 Environment Variables

Your .env file should look like this:

GEMINI_API_KEY=your_gemini_api_key
TWITTER_API_KEY=your_twitter_api_key
TWITTER_API_SECRET=your_twitter_api_secret
TWITTER_ACCESS_TOKEN=your_twitter_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_twitter_access_token_secret

⚠️ Disclaimer

Twitter (X) enforces strict policies regarding automated posting.
Excessive or irresponsible automation may lead to account suspension or permanent ban.
This tool is intended for educational purposes only.
Always comply with Twitter’s automation rules and best practices.


Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers