Weather MCP Server

Weather MCP Server

site icon
2025.03.20 0
JavaScript天气服务数据获取其它
Weather-MCP-Server 是一个基于 Model Context Protocol (MCP) 的天气数据服务,使用 TypeScript 构建并运行在 Node.js 上。它提供了天气数据的获取和处理功能,支持通过环境变量进行配置。
View on GitHub

Overview

基本能力

产品定位

Weather-MCP-Server 是一个提供天气数据的服务,主要用于获取和处理天气信息。

核心功能

  • 获取和处理天气数据
  • 使用 Model Context Protocol (MCP) SDK
  • 基于 TypeScript 构建,提供类型安全
  • 通过环境变量进行配置

适用场景

  • 需要实时天气数据的应用
  • 天气数据分析和处理
  • 基于天气数据的自动化服务

工具列表

  • npm run build: 将 TypeScript 编译为 JavaScript
  • npm start: 运行编译后的服务器
  • npm run lint: 使用 ESLint 检查 TypeScript 文件

常见问题解答

  • 如果 npm run build 没有输出,可以检查 TypeScript 日志: sh npx tsc --diagnostics
  • 如果 Node.js 找不到 index.js,确保 build/ 目录包含编译后的文件: sh ls build/
  • 在 Windows 上运行时,chmod 会失败,需要从构建脚本中移除 chmod 755 build/index.js

使用教程

使用依赖

  1. 确保已安装 Node.js 和 npm。

安装教程

  1. 克隆仓库: sh git clone https://github.com/your-username/weather-mcp-server.git cd weather-mcp-server
  2. 安装依赖: sh npm install
  3. 构建项目: sh npm run build
  4. 运行服务器: sh npm start 或者直接运行编译后的 JavaScript: sh node build/index.js

调试方式

  1. 检查 TypeScript 编译日志: sh npx tsc --diagnostics
  2. 检查编译后的文件是否存在: sh ls build/

许可证

该项目遵循 ISC 开源许可条款。