A sample MCP server that provides basic arithmetic tools
MCP Demo
This repository contains demo projects showcasing the use of the Message Communication Protocol (MCP) in different scenarios.
Projects
1. Calculator
A simple calculator service with a client and server implementation.
- Files:
demo-client.mjs: Example client for the calculator serviceserver.mjs: Calculator serverpackage.json,README.md
2. MCP Client (TypeScript)
Offical demo from MCP documentation
A TypeScript-based client for interacting with MCP services.
- Files:
index.ts: Main client codebuild/index.js: Compiled output.env: Environment configurationlog/session1.txt: Example session logpackage.json,tsconfig.json
[!NOTE] Need to set
ANTHROPIC_API_KEYin.envto run the client. The credit from Anthropic is NOT free.
3. Weather
Offical demo from MCP documentation
A weather information service using MCP.
- Files:
src/index.ts: Main source codebuild/index.js: Compiled outputpackage.json,tsconfig.json
Getting Started
Each project contains its own dependencies and setup.
Navigate into a project folder and run:
npm install
npm start
or for TypeScript projects:
npm install
npm run build
npm start
License
MIT
Tools (4)
addAdds two numbers togethersubtractSubtracts the second number from the firstmultiplyMultiplies two numbersdivideDivides the first number by the secondConfiguration
{"mcpServers": {"calculator": {"command": "node", "args": ["/path/to/server.mjs"]}}}