yoshinorin/mcp-server-example
If you are the rightful owner of mcp-server-example and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A learning project for implementing Model Context Protocol (MCP) servers.
MCP Server Sandbox
A learning project for implementing Model Context Protocol (MCP) servers. This project provides a simple MCP server with basic tools to understand MCP fundamentals.
Overview
This project is an educational sample created to learn the basic concepts of MCP servers. It includes the following features:
- Greeting Tool: Greet with specified names in Japanese or English
- Calculator Tool: Basic arithmetic operations (addition, subtraction, multiplication, division)
- Time Tool: Get current date and time in various formats
Prerequisites
- Node.js 16 or higher
- npm or yarn
Setup
-
Install dependencies:
npm install -
Build the project:
npm run build -
Start the server:
npm run start
Development
Development mode (build → run):
npm run dev
Project Structure
mcp-server-sandbox/
├── src/
│ └── index.ts # Main MCP server implementation
├── dist/ # Compiled JavaScript
├── .vscode/
│ └── mcp.json # VS Code MCP configuration
├── .github/
│ └── copilot-instructions.md
├── package.json
├── tsconfig.json
└── README.md
Implemented Tools
1. greet
Greets with the specified name.
Parameters:
name(string): Name of the person to greetlanguage(optional): "japanese" or "english"
2. calculate
Performs basic arithmetic operations.
Parameters:
operation: "add", "subtract", "multiply", "divide"a(number): First numberb(number): Second number
3. current_time
Gets the current date and time.
Parameters:
format(optional): "iso", "japanese", "timestamp"
Usage with VS Code
This server can be integrated with VS Code's MCP functionality. The configuration is included in .vscode/mcp.json and can be used in VS Code's Agent mode.
Learning Points
Through this project, you can learn:
- Basic structure of MCP servers
- How to define and implement tools
- Type-safe argument validation using Zod
- Error handling
- Using STDIO transport