Pushkarnsut/AI-Agent-with-MCP-Server
3.2
If you are the rightful owner of AI-Agent-with-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project is a conversational AI agent built with Express.js, Google Gemini, and the Model Context Protocol (MCP).
Tools
1
Resources
0
Prompts
0
AI Agent with MCP Server
This project is a conversational AI agent built with Express.js, Google Gemini, and the Model Context Protocol (MCP). It demonstrates tool/function calling, API integration, and multi-turn chat with context. The agent can perform actions such as posting to Twitter and executing arithmetic operations based on natural language prompts.
Features
- Conversational AI agent using Google Gemini
- Tool/function calling via MCP (Model Context Protocol)
- Twitter API v2 integration for posting tweets
- Arithmetic tool for adding numbers
- Contextual chat history for multi-turn conversations
- Modern JavaScript (ESM), environment-based configuration, and error handling
Project Structure
mcpserver/
āāā client/ # CLI chat client
ā āāā index.js
ā āāā ...
āāā server/ # MCP server and tools
ā āāā index.js
ā āāā createposttool.js
ā āāā ...
āāā README.md
āāā ...
Getting Started
Prerequisites
- Node.js
- Twitter Developer account (for posting tweets)
- Gemini API key
Setup
- Clone the repository:
git clone https://github.com/Pushkarnsut/AI-Agent-with-MCP-Server.git cd AI-Agent-with-MCP-Server
- Install dependencies in both
client
andserver
:cd client && npm install cd ../server && npm install
- Create a
.env
file in bothclient
andserver
directories with the required API keys and secrets:# Example for server/.env TWITTER_API_KEY=your_key TWITTER_API_SECRET=your_secret TWITTER_ACCESS_TOKEN=your_token TWITTER_ACCESS_TOKEN_SECRET=your_token_secret # Example for client/.env GEMINI_API_KEY=your_gemini_key
Running the Project
- Start the MCP server:
cd server node index.js
- Start the client (in a new terminal):
cd client node index.js
Usage
- Interact with the AI agent in the terminal.
- Example prompts:
add two numbers 2 and 3
post that I am learning MCP servers today
- The agent will call the appropriate tool and respond with the result.
Security
.gitignore
is set up to exclude sensitive files.
License
MIT
Author
Pushkarnsut