气象数据服务

一个用于从AviationWeather.gov API获取重要气象信息(SIGMET)的MCP服务器,支持国内和国际SIGMET数据检索,可按危险类型和飞行高度过滤,返回JSON格式数据。

  • by ken-wiebke
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 ken-wiebke/MCP-SIGMET

使用说明

MCP SIGMET服务器

MCP(模型上下文协议)服务器,用于从AviationWeather.gov API收集SIGMET(重要气象信息)数据。

特性

  • 从美国获取国内SIGMETs
  • 获取国际SIGMETs
  • 支持按危险类型(对流、湍流、结冰、IFR)进行过滤
  • 支持按飞行高度层过滤
  • 以JSON格式返回数据,并可选择人类可读的格式
  • 使用TypeScript构建类型安全
  • 使用Zod模式进行全面的参数验证
  • Vitest提供全面的测试覆盖

安装

npm install

发展

npm run dev

构建

npm run build

测试

该项目使用 Vitest 使用多个测试套件进行全面测试:

# Run all tests
npm test

# Run tests with UI (interactive)
npm run test:ui

# Run specific test suites
npm run test:api      # API client tests
npm run test:mcp      # MCP server component tests
npm run test:integration  # Full MCP integration tests

# Manual interactive testing
npm run build
node tests/manual-test.js

测试覆盖率

✅ API客户端测试 (tests/api-client.test.ts):测试AviationWeather.gov API客户端

  • 带和不带过滤器的国内SIGMET检索
  • 国际SIGMET检索
  • 参数验证和错误处理
  • 人类可读的输出格式

✅ MCP服务器测试 (tests/test-mcp-server.ts):测试MCP服务器组件

  • 工具注册和参数验证
  • API集成和响应格式
  • 无效参数的错误处理

✅ 集成测试 (tests/mcp-integrations.test.ts):端到端MCP客户端服务器测试

  • 全MCP协议通信
  • 工具列表和执行
  • 带有各种参数的真实API调用
  • 未知工具的错误处理

✅ 手动测试 (tests/manual-test.js):使用自定义参数的交互式测试

调试

VS代码调试

  1. 在VS Code中打开项目
  2. 转到调试面板(Ctrl+Shift+D/Cmd+Shift+D)
  3. 选择以下配置之一:
    • “调试测试API(已编译)” -使用编译的JavaScript(推荐)
    • “调试测试API(TSX)” -使用tsx运行时
    • “调试MCP服务器” -用于调试主服务器
  4. 在TypeScript文件中设置断点
  5. 按F5开始调试

命令行调试

# Build and debug with compiled JavaScript
npm run build
node --inspect-brk dist/tests/test-api.js

# Debug with tsx (if the above doesn't work)
npx tsx --inspect-brk tests/test-api.ts

# Use the debug wrapper script
npm run debug:test

添加断点

您可以添加 debugger; 代码中的语句:

async function testApi() {
  debugger; // This will pause execution when debugging
  const client = new AviationWeatherApiClient();
  // ... rest of the code
}

故障排除

如果遇到“包子路径'./register'未定义”错误:

  1. 使用“调试测试API(编译)”配置
  2. 或者跑 npm run build 首先,调试编译后的JavaScript
  3. 确保您使用的是最新版本的tsx

用法

此MCP服务器提供了检索SIGMET数据的工具,并进行了全面的参数验证:

国内SIGMETs

  • 工具: get_domestic_sigmets
  • 描述:检索美国的国内SIGMET
  • 参数:
    • hazard (可选):按危险类型过滤(conv, turb, ice, ifr)
    • level (可选):飞行高度±3000'搜索(0-600)
    • date (可选):要搜索的特定日期/时间(格式: yyyymmdd_hhmmZ 或 yyyy-mm-ddThh:mm:ssZ)
    • humanReadable (可选):返回人类可读的格式化输出

国际SIGMETs

  • 工具: get_international_sigmets
  • 描述:检索国际SIGMET
  • 参数:
    • hazard (可选):按危险类型过滤(turb, ice)
    • level (可选):飞行高度±3000'搜索(0-600)
    • date (可选):要搜索的特定日期/时间(格式: yyyymmdd_hhmmZ 或 yyyy-mm-ddThh:mm:ssZ)
    • humanReadable (可选):返回人类可读的格式化输出

参数验证

所有参数都使用Zod模式进行验证:

  • 危险类型:严格执行枚举值
  • 飞行高度层:必须介于0到600之间
  • 日期格式:必须与指定的图案匹配
  • 错误处理:无效参数引发描述性错误

输出格式

  • 标准:来自API的原始JSON数据
  • 人类可读:带有可读时间戳和描述的格式化输出(当 humanReadable: true)

api参考

此服务器使用 AviationWeather.gov API 用于数据检索。

许可证

麻省理工学院