Requires Node.js for running the MCP server, with the server implementation written for the Node.js runtime.
Implements the MCP server using TypeScript for type safety, requiring compilation before execution.
Utilizes Zod for runtime type validation of data exchanged between the MCP server and clients.
Simple MCP Server
A simple Model Context Protocol (MCP) server example that demonstrates basic MCP functionality.
What it does
This MCP server provides three basic tools:
echo - Echoes back a message you provide
calculator - Performs basic mathematical operations (add, subtract, multiply, divide)
current_time - Returns the current date and time
Prerequisites
Node.js 16 or higher
npm
Installation
Clone this repository
Install dependencies:
npm install
Building
Build the TypeScript code:
Running the Server
Start the server in development mode:
Or run the built version:
Testing with Claude Desktop
To test this MCP server with Claude Desktop, add the following configuration to your claude_desktop_config.json
:
Windows
Location: %APPDATA%\Claude\claude_desktop_config.json
macOS/Linux
Location: ~/Library/Application Support/Claude/claude_desktop_config.json
Configuration:
Replace /absolute/path/to/your/project/
with the actual path to your project directory.
Project Structure
Tools Available
echo
Description: Echo back the provided message
Parameters:
message
(string): The message to echo back
calculator
Description: Perform basic mathematical operations
Parameters:
operation
(enum): One of 'add', 'subtract', 'multiply', 'divide'a
(number): The first numberb
(number): The second number
current_time
Description: Get the current date and time
Parameters: None
Example Usage
Once connected to an MCP client like Claude Desktop, you can use commands like:
"Echo back the message 'Hello World'"
"Calculate 15 plus 25"
"What's the current time?"
Development
This project is set up with:
TypeScript for type safety
Zod for runtime type validation
MCP SDK for protocol compliance
ES modules support
local-only server
The server can only run on the client's local machine because it depends on local resources.
A demonstration server implementing the Model Context Protocol (MCP) that provides three basic tools: echo, calculator, and current time functionality.
Related MCP Servers
- -securityAlicense-qualityA demonstration server that implements the Model Context Protocol (MCP) SDK, providing tools and endpoints for server-sent events and message handling.Last updated -14511MIT License
- AsecurityAlicenseAqualityA simple server implementing the Model Context Protocol (MCP) that echoes messages back, designed for testing MCP clients.Last updated -12MIT License
- -securityFlicense-qualityAn MCP (Model Context Protocol) server implementation using HTTP SSE (Server-Sent Events) connections with built-in utility tools including echo, time, calculator, and weather query functionality.Last updated -
- -securityFlicense-qualityA simple Model Context Protocol (MCP) server that provides date and time functionality in any timezone, along with user profiles and personalized greeting resources.Last updated -