mcp-server-client

YuvvrajSingh/mcp-server-client

3.1

If you are the rightful owner of mcp-server-client 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.

The Model Context Protocol (MCP) server is a system designed to manage user data through a chat-like interface, leveraging AI for enhanced user interaction and data management.

MCP Server and Client

TypeScript Node.js MCP Google AI

A simple user management system that lets you create, view, and manage users through a chat-like interface powered by Google AI.

What This Project Does

This project helps you manage users in a smart way. It has two main parts:

  • Server (server.ts) - Stores and manages user information (like a simple database)
  • Client (client.ts) - A chat program where you can talk to the server and ask it to do things
  • User Storage (users.json) - A file that saves all your users

How it works: You can ask the program questions like "create a new user" or "show me all users" and it will understand what you want and do it for you. It even uses Google's AI to create fake users with realistic names and information!

What You Can Do

Server Features (What the program can do for you)

Actions You Can Take
  • Add a new user - Create users by entering their name, email, address, and phone number
  • Create a fake user - Let the AI make up a realistic user with fake but believable information
Information You Can Get
  • See all users - Get a list of everyone in your user database
  • Find a specific user - Look up one person by their ID number
AI Help
  • Generate user ideas - Ask the AI to help you create fake users based on a name you give it

Client Features (How you interact with it)

  • Easy menu - Simple options to choose what you want to do
  • Smart responses - Powered by Google's AI so you can ask questions in normal language
  • Run commands - Click through menus to do things like add users or see your user list
  • Ask questions - Type questions like "How many users do I have?" and get smart answers

🛠️ Tech Stack

  • Runtime: Node.js with TypeScript
  • MCP SDK: @modelcontextprotocol/sdk v1.13.0
  • AI Integration: Google Gemini via @ai-sdk/google
  • CLI Interface: @inquirer/prompts for interactive prompts
  • Validation: Zod for schema validation
  • Build Tools: TypeScript 5.8.3, tsx for development

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd mcp-server-and-client-main
    
  2. Install dependencies:

    npm install
    
  3. Set up environment variables:

    # Create .env file
    echo "GEMINI_API_KEY=your_gemini_api_key_here" > .env
    

    Get your Gemini API key from Google AI Studio.

  4. Build the TypeScript code:

    npm run server:build
    

Usage

Running the Server

# Development mode
npm run server:dev

# Build and watch mode
npm run server:build:watch

Running the Client

npm run client:dev

The client provides an interactive menu with the following options:

  1. Query - Ask natural language questions and get AI-powered responses
  2. Tools - Execute server tools (create users, generate random users)
  3. Resources - Access server resources (view all users, get user details)
  4. Prompts - Use server prompts for AI-assisted user generation

Project Structure

mcp-server-and-client-main/
├── src/
│   ├── client.ts          # Interactive MCP client
│   ├── server.ts          # MCP server implementation
│   └── data/
│       └── users.json     # User database (JSON)
├── package.json           # Dependencies and scripts
├── tsconfig.json         # TypeScript configuration
└── README.md             # This file