Skip to main content
Glama

MCP Server

by chendaleiQ

MCP Server - 模块化多工具服务

English below 中文介绍


📝 项目简介

MCP Server 是基于 Model Context Protocol (MCP) 的模块化服务端,支持天气、定位、数学计算、IoT 设备控制、GitHub 搜索等多种工具,适合智能体/AI 助手等场景。

📁 目录结构

├── src/ │ ├── app.ts # 应用主类 │ ├── index.ts # 启动入口 │ ├── config/ # 配置 │ ├── types/ # 类型定义 │ ├── middleware/ # 中间件 │ ├── routes/ # 路由 │ ├── services/ # 业务服务 │ ├── tools/ # 工具函数(天气、定位、计算、IoT、搜索等) │ └── utils/ # 通用工具 ├── test/ # 测试脚本 ├── package.json # 依赖与脚本 ├── tsconfig.json # TypeScript 配置 └── ...

🚀 快速开始

安装依赖

npm install

启动开发环境

npm run dev

生产环境

npm run build npm run start:prod

其他命令

npm run dev:watch # nodemon 热重载 npm run dev:debug # 调试模式 npm start # 直接运行(ts-node)

⚙️ 配置

  • 端口、名称、版本、日志、会话等均可通过环境变量配置,详见 src/config/index.ts
  • 常用环境变量:
    • PORTSERVER_NAMESERVER_VERSIONNODE_ENVLOG_LEVELMAX_SESSIONSSESSION_TIMEOUT

🔧 可用工具(API)

1. 天气查询 getWeather

  • 参数:city(可选,城市名,缺省自动定位),unit(可选,celsius/fahrenheit)
  • 示例:
    { "city": "北京", "unit": "celsius" }

2. 定位 getLocation

  • 参数:无
  • 返回:当前定位的城市名(模拟/可扩展)

3. 数学计算 calculate

  • 参数:operation(add/subtract/multiply/divide),ab
  • 示例:
    { "operation": "add", "a": 1, "b": 2 }

4. IoT 设备控制 iotControl

  • 参数:deviceIdaction(lock/unlock/open/close/getStatus),value(可选)
  • 示例:
    { "deviceId": "lock001", "action": "lock" }
  • 参数:query(关键词),可选:languagestarsforksusertopiccreatedsortorderlimit
  • 示例:
    { "query": "nodejs", "language": "TypeScript", "limit": 3 }

📊 健康检查

  • GET /health 返回服务器状态

🧪 测试

所有测试脚本位于 test/ 目录:

  • test/test-mcp.jstest/test-modular.jstest/test-tools-rename.js
  • 运行示例:
    node test/test-mcp.js node test/test-modular.js node 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

npm install

Start development server

npm run dev

Production

npm run build npm run start:prod

Other scripts

npm run dev:watch # nodemon hot reload npm run dev:debug # debug mode npm start # direct run (ts-node)

⚙️ 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:
    { "city": "Beijing", "unit": "celsius" }

2. Location getLocation

  • Params: none
  • Returns: current city (mocked/extendable)

3. Calculator calculate

  • Params: operation (add/subtract/multiply/divide), a, b
  • Example:
    { "operation": "add", "a": 1, "b": 2 }

4. IoT Device Control iotControl

  • Params: deviceId, action (lock/unlock/open/close/getStatus), value (optional)
  • Example:
    { "deviceId": "lock001", "action": "lock" }
  • Params: query (keyword), optional: language, stars, forks, user, topic, created, sort, order, limit
  • Example:
    { "query": "nodejs", "language": "TypeScript", "limit": 3 }

📊 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:
    node test/test-mcp.js node test/test-modular.js node test/test-tools-rename.js

🔄 Extension

  • Add tool: create file in src/tools/ and register
  • Add service/middleware/type: follow existing structure

📝 License

ISC

-
security - not tested
F
license - not found
-
quality - not tested

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.

  1. 📝 项目简介
    1. 📁 目录结构
      1. 🚀 快速开始
        1. 安装依赖
        2. 启动开发环境
        3. 生产环境
        4. 其他命令
      2. ⚙️ 配置
        1. 🔧 可用工具(API)
          1. 1. 天气查询 getWeather
          2. 2. 定位 getLocation
          3. 3. 数学计算 calculate
          4. 4. IoT 设备控制 iotControl
          5. 5. GitHub 搜索 search
        2. 📊 健康检查
          1. 🧪 测试
            1. 🔄 扩展指引
              1. 📝 许可证
                1. MCP Server - Modular Multi-Tool Service (English)
                  1. 📝 Introduction
                  2. 📁 Structure
                  3. 🚀 Quick Start
                  4. ⚙️ Configuration
                  5. 🔧 Tools (APIs)
                  6. 📊 Health Check
                  7. 🧪 Testing
                  8. 🔄 Extension
                  9. 📝 License

                Related MCP Servers

                • -
                  security
                  F
                  license
                  -
                  quality
                  An 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
                  • Linux
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  An 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
                • A
                  security
                  A
                  license
                  A
                  quality
                  A 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 -
                  5
                  8
                  JavaScript
                  MIT License

                View all related MCP servers

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/chendaleiQ/mcp-iot'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server