MCP ExplorerExplorer

Mcp Hello World

@HAERGI-PLon a year ago
1 MIT
FreeCommunity
AI Systems
A simple MCP server implementation in JavaScript for AI assistants.

Overview

What is Mcp Hello World

mcp-hello_world is a simple implementation of the Model Context Protocol (MCP) using JavaScript ES Modules. It allows AI assistants to interact with external tools and services, enabling functionalities like tool discovery and structured input/output processing.

Use cases

Use cases for mcp-hello_world include creating interactive AI applications that greet users by name, integrating with chatbots for personalized user experiences, and enhancing AI assistants with the ability to call external tools.

How to use

To use mcp-hello_world, ensure you have Node.js and npm installed. Install the necessary packages using ‘npm install’ and start the server with ‘npm start’. Once running, AI assistants can discover and execute the ‘hello_world’ tool by providing a name parameter.

Key features

Key features of mcp-hello_world include a single ‘hello_world’ tool that generates personalized greetings, standard MCP interfaces for tool discovery and execution, and the use of the official ‘@modelcontextprotocol/sdk’ package.

Where to use

mcp-hello_world can be used in applications involving AI assistants that require interaction with external tools, such as customer service bots, personal assistants, and any scenario where personalized responses are beneficial.

Content

MCP Hello World for Claude

A simple, easy-to-understand implementation of the Model Context Protocol (MCP) using JavaScript ES Modules.

Note: This implementation has been tested and verified to work with Claude, Anthropic’s AI assistant.

What is MCP?

The Model Context Protocol (MCP) is a standardized interface that allows AI assistants to interact with external tools and services. It enables AI models to:

  • Discover available tools
  • Call tools with structured inputs
  • Receive structured outputs
  • Process and display the results to users

This protocol creates a bridge between AI models and external capabilities, making AI assistants more powerful and useful in real-world applications.

Project Structure

This repository contains a minimalistic JavaScript (ESM) MCP server implementation:

.
├── src/
│   ├── index.mjs     # Main server implementation
│   └── hello.mjs     # Hello World tool implementation
├── package.json
└── README.md

The server implements:

  • A single “hello_world” tool that takes a name and returns a personalized greeting
  • Standard MCP interfaces for tool discovery and execution
  • Uses the official @modelcontextprotocol/sdk package

Getting Started

Prerequisites

  • Node.js (v14.0.0 or higher)
  • npm (v6.0.0 or higher)

Server Setup

npm install
npm start

This will start the MCP server running on stdio, ready to process tool discovery and execution requests.

How It Works

  1. Tool Definition: The server defines a “hello_world” tool with a specific input schema that requires a “name” parameter.

  2. Tool Discovery: When an AI assistant connects to the server, it can request a list of available tools using the ListTools request.

  3. Tool Execution: The AI assistant can then call the “hello_world” tool with a name parameter, and receive a formatted greeting in response.

  4. Data Flow:

    • AI Assistant → MCP Server: Tool discovery request
    • MCP Server → AI Assistant: List of available tools with schemas
    • AI Assistant → MCP Server: Tool execution request with parameters
    • MCP Server → AI Assistant: Tool execution result

This simple example demonstrates the core MCP concepts:

  • Tool definition with schemas
  • Tool discovery
  • Tool execution
  • Structured input/output

How to use it with Claude?

  1. Install Claude and go to: File -> Settings
image
  1. Switch to developer tab
image
  1. Click: Edit Config and paste below json (update your path)
{
  "mcpServers": {
    "hello-world": {
      "command": "node",
      "args": [
        "D:\\github\\mcp-hello_world\\src\\index.mjs"
      ]
    }
  }
}
  1. The output:
image
  1. Diagnose here:
image

Logs are here:

C:\Users<your-login>\AppData\Roaming\Claude\logs

Do not use console.log inside MCP with stdio mode it interfere with the Claude, instead use console.error that goes to log file.

License

The MCP Hello World repository is licensed under the MIT License.

Further Resources

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers