aysahoo
MCP Serveraysahoopublic

mcp trying

一个基于模型上下文协议(MCP)的聊天应用程序,集成Google Gemini AI。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
JavaScript
Language
-
License

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

  1. Clone the repository:

    git clone <repository-url>
    cd mcp-trying
    
  2. Install dependencies:

    # Install root dependencies
    npm install
    
    # Install server dependencies
    cd server
    npm install
    
    # Install client dependencies
    cd ../client
    npm install
    
  3. Create a .env file in the client directory with your Google Gemini API key:

    GEMINI_API_KEY=your_api_key_here
    

Running the Application

  1. Start the server:

    cd server
    node index.js
    

    The server will start on port 3000 by default.

  2. In a new terminal, start the client:

    cd client
    node index.js
    

Usage

  1. Once both the server and client are running, you can start chatting through the command-line interface.
  2. Type your message and press Enter to send it to the AI model.
  3. The AI will respond and can use available tools if needed.
  4. 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

1

Clone the repository

git clone https://github.com/aysahoo/mcp-trying
2

Install dependencies

cd mcp-trying
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Owneraysahoo
Repomcp-trying
LanguageJavaScript
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation