Built on Node.js with support for debugging mode and production deployment options
Supports development workflow with Nodemon for automatic server restarts with more granular file monitoring and configurable ignore rules
Package management and script execution for installation, development, and production deployment workflows
Utilizes ts-node-dev for development environment with fast compilation and automatic server restarts
Fully implemented in TypeScript with type definitions for improved development experience and compile-time error checking
MCP Server - 模块化多工具服务
English below 中文介绍
📝 项目简介
MCP Server 是基于 Model Context Protocol (MCP) 的模块化服务端,支持天气、定位、数学计算、IoT 设备控制、GitHub 搜索等多种工具,适合智能体/AI 助手等场景。
📁 目录结构
🚀 快速开始
安装依赖
启动开发环境
生产环境
其他命令
⚙️ 配置
- 端口、名称、版本、日志、会话等均可通过环境变量配置,详见
src/config/index.ts
- 常用环境变量:
PORT
、SERVER_NAME
、SERVER_VERSION
、NODE_ENV
、LOG_LEVEL
、MAX_SESSIONS
、SESSION_TIMEOUT
🔧 可用工具(API)
1. 天气查询 getWeather
- 参数:
city
(可选,城市名,缺省自动定位),unit
(可选,celsius/fahrenheit) - 示例:
2. 定位 getLocation
- 参数:无
- 返回:当前定位的城市名(模拟/可扩展)
3. 数学计算 calculate
- 参数:
operation
(add/subtract/multiply/divide),a
,b
- 示例:
4. IoT 设备控制 iotControl
- 参数:
deviceId
,action
(lock/unlock/open/close/getStatus),value
(可选) - 示例:
5. GitHub 搜索 search
- 参数:
query
(关键词),可选:language
、stars
、forks
、user
、topic
、created
、sort
、order
、limit
- 示例:
📊 健康检查
GET /health
返回服务器状态
🧪 测试
所有测试脚本位于 test/
目录:
test/test-mcp.js
、test/test-modular.js
、test/test-tools-rename.js
- 运行示例:
🔄 扩展指引
- 新增工具:在
src/tools/
新建文件并注册 - 新增服务/中间件/类型:参考现有目录结构
📝 许可证
ISC
MCP Server - Modular Multi-Tool Service (English)
📝 Introduction
MCP Server is a modular backend based on Model Context Protocol (MCP), supporting weather, location, calculator, IoT device control, GitHub search and more. Ideal for AI agents and assistant scenarios.
📁 Structure
See above for directory tree. Main code in src/
, tests in test/
.
🚀 Quick Start
Install dependencies
Start development server
Production
Other scripts
⚙️ Configuration
- All configs (port, name, version, log, session, etc.) via env vars, see
src/config/index.ts
- Common env vars:
PORT
,SERVER_NAME
,SERVER_VERSION
,NODE_ENV
,LOG_LEVEL
,MAX_SESSIONS
,SESSION_TIMEOUT
🔧 Tools (APIs)
1. Weather getWeather
- Params:
city
(optional, auto-location if omitted),unit
(optional, celsius/fahrenheit) - Example:
2. Location getLocation
- Params: none
- Returns: current city (mocked/extendable)
3. Calculator calculate
- Params:
operation
(add/subtract/multiply/divide),a
,b
- Example:
4. IoT Device Control iotControl
- Params:
deviceId
,action
(lock/unlock/open/close/getStatus),value
(optional) - Example:
5. GitHub Search search
- Params:
query
(keyword), optional:language
,stars
,forks
,user
,topic
,created
,sort
,order
,limit
- Example:
📊 Health Check
GET /health
returns server status
🧪 Testing
All test scripts in test/
:
test/test-mcp.js
,test/test-modular.js
,test/test-tools-rename.js
- Run example:
🔄 Extension
- Add tool: create file in
src/tools/
and register - Add service/middleware/type: follow existing structure
📝 License
ISC
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A modular server based on Model Context Protocol (MCP) that provides weather queries, mathematical calculations, and search functionalities.
Related MCP Servers
- -securityFlicense-qualityAn MCP server implementation that allows users to fetch and display weather information for specified cities, including temperature, humidity, wind speed, and weather descriptions.Last updated -Python
- TypeScriptMIT 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 -JavaScript
- AsecurityAlicenseAqualityA TypeScript-based MCP server that provides simulated weather data including current conditions, forecasts, alerts, and location search functionality through both MCP protocol and HTTP API endpoints.Last updated -58JavaScriptMIT License