# Twitter Ai Agent

> 🤖 AI Twitter Agent - A Node.js app using Google's Gemini AI to post tweets via natural language. Demonstrates AI + Twitter API integration for intelligent social media automation. Built for developers interested in AI and API development.

- **Type:** MCP server
- **Install:** `agentstack add mcp-adarshpheonix2810-twitter-ai-agent`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [adarshpheonix2810](https://agentstack.voostack.com/s/adarshpheonix2810)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [adarshpheonix2810](https://github.com/adarshpheonix2810)
- **Source:** https://github.com/adarshpheonix2810/Twitter-Ai-Agent

## Install

```sh
agentstack add mcp-adarshpheonix2810-twitter-ai-agent
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Twitter Ai Agent with Gemini Integration 🤖

[](https://opensource.org/licenses/MIT)

An intelligent Twitter (X) agent powered by Google's Gemini AI that allows you to post tweets using natural language commands. This project demonstrates the integration of AI with social media APIs to create powerful automation tools.

## ✨ Features

- **Natural Language Processing**: Post tweets using everyday language
- **AI-Powered**: Leverages Google's Gemini 2.0 Flash model
- **Real-time Interaction**: Command-line interface for seamless interaction
- **Secure**: Environment-based configuration for sensitive credentials
- **Extensible**: Built with a modular architecture for easy expansion

## 🛠️ Tech Stack

- **Backend**: Node.js, Express
- **AI**: Google Gemini 2.0 Flash
- **APIs**: Twitter API v2
- **Protocol**: Model Context Protocol (MCP)
- **Authentication**: OAuth 1.0a

## 📦 Prerequisites

- Node.js (v16+)
- npm or yarn
- Twitter Developer Account
- Google Cloud Project with Gemini API enabled

## Installation

1. **Clone the repository**
   ```bash
   git clone https://github.com/adarshpheonix2810/Twitter-Ai-Agent.git
   cd Twitter-Ai-Agent
   ```

2. **Install dependencies**
   ```bash
   # Install server dependencies
   cd server
   npm install
   
   # Install client dependencies
   cd ../client
   npm install
   ```

3. **Set up environment variables**
   
   Create a `.env` file in both `client` and `server` directories:
   
   **client/.env**
   ```
   GEMINI_API_KEY=your_gemini_api_key_here
   ```
   
   **server/.env**
   ```
   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
   ```

## 🏃‍♂️ Running the Application

1. **Start the server**
   ```bash
   cd server
   node index.js
   ```

2. **In a new terminal, start the client**
   ```bash
   cd client
   node index.js
   ```

3. **Start interacting!**
   Type your message in the command line, for example:
   ```
   Post a tweet saying "Hello from my new AI Twitter agent! #AI #TwitterBot"
   ```

## 🛠️ Project Structure

```
twitter-ai-agent/
├── client/                   # Client application
│   ├── index.js             # Main client file
│   ├── package.json         # Client dependencies
│   └── .env                 # Client environment variables
├── server/                  # Server application
│   ├── index.js             # Main server file
│   ├── twittertool.js       # Twitter API integration
│   ├── package.json         # Server dependencies
│   └── .env                 # Server environment variables
├── .gitignore              # Git ignore file
└── README.md               # This file
```

## 🔒 Security Considerations

- Never commit your `.env` files
- Keep your API keys secure
- Use environment variables for all sensitive information
- Consider implementing user authentication for production use

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## 📄 License

Distributed under the MIT License. See `LICENSE` for more information.

## 📧 Contact

Your Name - [Adarsh Singh](https://www.linkedin.com/in/adarsh-singh-412298273/)

Project Link: [https://github.com/adarshpheonix2810/twitter-ai-agent](https://github.com/adarshpheonix2810/twitter-ai-agent)

## 🙏 Acknowledgments

- [Google Gemini](https://ai.google.dev/)
- [Twitter API](https://developer.twitter.com/)
- [Model Context Protocol](https://modelcontextprotocol.io/)
- [Node.js](https://nodejs.org/)

## 🌟 Show your support

Give a ⭐️ if this project helped you!

---

  Made with ❤️ by Adarsh Singh

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [adarshpheonix2810](https://github.com/adarshpheonix2810)
- **Source:** [adarshpheonix2810/Twitter-Ai-Agent](https://github.com/adarshpheonix2810/Twitter-Ai-Agent)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-adarshpheonix2810-twitter-ai-agent
- Seller: https://agentstack.voostack.com/s/adarshpheonix2810
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
