Jain-Tirth/MCP-Server-Demo
3.1
If you are the rightful owner of MCP-Server-Demo and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This project demonstrates a Model Context Protocol (MCP) server and client integration, including Gemini AI and Twitter (X) tool usage.
Tools
2
Resources
0
Prompts
0
MCP Server Demo
This project demonstrates a Model Context Protocol (MCP) server and client integration, including Gemini AI and Twitter (X) tool usage.
Project Structure
server/— Express-based MCP server with tool registration (e.g., addTwoNumbers, createPost for Twitter/X)client/— Node.js client that connects to the MCP server, uses Gemini AI, and supports tool calling
Prerequisites
- Node.js (v18+ recommended)
- npm
- Twitter/X Developer account (for posting)
- Google Gemini API key
Setup
-
Clone the repository:
git clone https://github.com/Jain-Tirth/MCP-Server-Demo.git cd MCP-Server-Demo -
Install dependencies:
cd server && npm install cd ../client && npm install -
Environment variables:
- Copy
.env.exampleto.envin bothserver/andclient/folders (if provided), or create.envfiles manually. - For Twitter/X posting, set:
TWITTER_API_KEY=your_api_key TWITTER_API_SECRET=your_api_secret TWITTER_ACCESS_TOKEN=your_access_token TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret - For Gemini API, set:
GEMINI_API_KEY=your_gemini_api_key
- Copy
-
Start the MCP server:
cd server node index.js # or use nodemon for auto-reload # npx nodemon index.js -
Start the client:
cd ../client node index.js
Features
- MCP Server
- Registers tools (e.g., addTwoNumbers, createPost)
- Handles tool calls from clients
- Client
- Connects to MCP server via SSE
- Uses Gemini AI for chat and tool invocation
- Supports function calling (e.g., posting to Twitter/X)
Notes
- Ensure your Twitter/X app permissions are set to "Read and Write" and use regenerated access tokens after changing permissions.
- Sensitive files like
.envand credential JSONs are gitignored for security.