mcp-server-hello

lqwangxg/mcp-server-hello
0 starsCommunity

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

MCP server providing tools for addition, current time, config index updates, a random joke resource, and a friendly greeting prompt.

README.md

MCP Server Hello

This project implements a Model Context Protocol (MCP) server that provides several tools, resources, and prompts. It's designed to be used with the Gemini CLI as an MCP server.

Available Functionalities

  • add tool: Adds two numbers together.
  • get-time tool: Returns the current server time.
  • update-config-index tool: update the index in configfile by increment.
  • random-joke resource: Provides a random joke.
  • friendly-greeting prompt: Generates a friendly greeting message given a name.

Installation

To set up the project, follow these steps:

  1. Clone the repository (if applicable):
    # If this project is part of a larger repository, clone it first.
    # git clone <repository-url>
    # cd mcp-server-hello
  1. Install dependencies:

Navigate to the project root directory and install the required Node.js packages: ``bash npm install ``

How to Run

To run the MCP server:

  1. Build the TypeScript project:
    npm run build
  1. Start the server:
    npm start

The server will start and listen for connections. You won't see much output on the console as console.log has been removed to avoid interfering with the MCP protocol. Errors will be logged to stderr.

Deployment

This server is intended to be run as a background process, typically managed by a process manager or as part of a larger system. Ensure that the npm run build step is executed before starting the server in a production environment.

Usage with Gemini CLI

  1. create ./.gemini/settings.json for Gemini CLI
    {
    "mcpServers": {
        "my-mcp": {
        "command": "node",
        "args": ["./dist/server.js"],
        "transport": "stdio"
        }
    }
    }
  1. check mcp server status by /mcp list after gemini-cli start
  • This server acts as an MCP server for the Gemini CLI.
  • Once the server is running, the Gemini CLI can connect to it and utilize the registered tools, resources, and prompts.
    β„ΉConfigured MCP servers:
    
    🟒 my-mcp - Ready (2 tools, 1 prompt)
        Tools:
        - add
        - get-time

        Prompts:
        - friendly-greeting


    πŸ’‘ Tips:
        β€’ Use /mcp desc to show server and tool descriptions
        β€’ Use /mcp schema to show tool parameter schemas
        β€’ Use /mcp nodesc to hide descriptions
        β€’ Use /mcp auth <server-name> to authenticate with OAuth-enabled servers
        β€’ Press Ctrl+T to toggle tool descriptions on/off   

Test of tools, resources, and prompts by Gemini-cli

The Gemini CLI will communicate with this MCP server to execute the requested functionality and return the results.

  1. invoke the 'add' tool
   #prompt1: 
   > result of add 123456,456789 
    βœ“  add (summarize-mcp MCP Server) {"b":456789,"a":123456}        
    The sum of 123456 and 456789 is 580245.   
   #result of add 123456,456789 
   ✦ 580245

   #prompt2: 
   > add 123,456 
    βœ“  add (summarize-mcp MCP Server) {"b":456,"a":123}       
    The sum of 123 and 456 is 579.   
   ✦ 579
  1. invoke the 'get-time' tool
   #prompt: 
   >  what time now? 
    βœ“  get-time (summarize-mcp MCP Server) {}       
    The current server time is 14:28:32. 
   ✦ The current time is 14:28:32. 
  1. invoke the 'random-joke' resource
   #prompt: 
   >  tell me a joke 
   ✦ Why don't scientists trust atoms?    
   Because they make up everything 
  1. invoke the 'friendly-greeting' prompt
   #prompt
   > friendly-greeting to wangxg 
   ✦ Hello, wangxg! It's a pleasure to meet you. I hope you're having a fantastic day
  1. invoke the 'update-config-index' tool
   #prompt:
   > update the index in configfile @config/config.yaml by increment 10
   βœ“  update-config-index (my-mcp) {"numberOfIncrements":10,"filePath":"C:\\work\\mcp-server\\mcp-server-hello\\config\\config.yaml"}
   OK. I've updated the index in `config/config.yaml` to 12.

Related MCP servers

Browse all β†’