
mcp trying
一个基于模型上下文协议(MCP)的聊天应用程序,集成Google Gemini AI。
Repository Info
About This Server
一个基于模型上下文协议(MCP)的聊天应用程序,集成Google Gemini AI。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
MCP (Model Context Protocol) Chat Application
This is a chat application that implements the Model Context Protocol (MCP) to enable communication between a client and server with AI model integration. The application uses Google's Gemini AI model and provides a command-line interface for interaction.
Features
- Real-time communication between client and server using MCP
- Integration with Google's Gemini AI model
- Command-line interface for user interaction
- Tool support for extending functionality
- Session management with unique IDs
- CORS support for cross-origin requests
Prerequisites
- Node.js (v14 or higher)
- npm (Node Package Manager)
- Google Gemini API key
Project Structure
.
├── client/ # Client-side application
│ ├── index.js # Main client implementation
│ └── package.json # Client dependencies
├── server/ # Server-side application
│ ├── index.js # Main server implementation
│ └── package.json # Server dependencies
└── package.json # Root project dependencies
Setup
-
Clone the repository:
git clone <repository-url> cd mcp-trying -
Install dependencies:
# Install root dependencies npm install # Install server dependencies cd server npm install # Install client dependencies cd ../client npm install -
Create a
.envfile in the client directory with your Google Gemini API key:GEMINI_API_KEY=your_api_key_here
Running the Application
-
Start the server:
cd server node index.jsThe server will start on port 3000 by default.
-
In a new terminal, start the client:
cd client node index.js
Usage
- Once both the server and client are running, you can start chatting through the command-line interface.
- Type your message and press Enter to send it to the AI model.
- The AI will respond and can use available tools if needed.
- The conversation history is maintained during the session.
Available Tools
The server currently implements the following tool:
addTwoNumbers: Adds two numbers together and returns the sum
Technical Details
- The application uses the Model Context Protocol (MCP) for communication
- Server implements Express.js for handling HTTP requests
- Client uses readline for command-line interaction
- Google's Gemini AI model is used for generating responses
- Session management is handled using UUIDs
- CORS is enabled for cross-origin requests
Error Handling
The application includes error handling for:
- Connection issues
- Invalid session IDs
- Server errors
- Chat loop errors
Contributing
Feel free to submit issues and enhancement requests!
License
This project is licensed under the MIT License - see the LICENSE file for details.
Quick Start
Clone the repository
git clone https://github.com/aysahoo/mcp-tryingInstall dependencies
cd mcp-trying
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.