Token导航 LogoToken导航TokenDH.com
Weather MCP Ts logo
地图位置未说明官方级别未说明来源级核验

Weather MCP Ts

MCP Server

一个基于TypeScript开发的天气MCP服务器,提供模拟天气数据和相关功能,包括当前天气信息、多日天气预报、天气警报系统和位置搜索功能。

工具数

5

提示词数

0

GitHub Stars

1

资源数

0
位置天气JavaScript天气警报天气预报

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

bobbyyng

提供方

bobbyyng

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

气象MCP服务器

使用TypeScript开发的天气MCP(模型上下文协议)服务器,提供模拟天气数据和相关功能。

特性

  • 🌤️ 获取当前天气信息
  • 📅 多日天气预报
  • ⚠️ 天气警报系统
  • 🔍 位置搜索功能
  • 📊 天气统计
  • 🎭 模拟数据支持

再进行

pnpm install

🚀 用法

安装和建造

# Install dependencies
pnpm install

# Build project
pnpm run build

启动方法

1.MCP协议(stdio)

# For MCP client integration
pnpm start

2.HTTP API服务器🆕

# Start HTTP server (default port 8080)
pnpm run start:http

# Start HTTP server (specified port 3001)
pnpm run start:http:3001

# Or specify port directly
node dist/http-server.js 8080

3.简单HTTP服务器(推荐)🚀

# Start with default port 8080
pnpm run start:simple

# Start with specific ports
pnpm run start:simple:3000  # Development port
pnpm run start:simple:5000  # Alternative port
pnpm run start:simple:9000  # High port

# Or use the serve commands
pnpm run serve              # Default port 8080
pnpm run serve:dev          # Development port 3000
pnpm run serve:prod         # Production port 8080

# Or specify any port directly
node dist/simple-http-server.js 4000

动态端口支持

简单的HTTP服务器支持动态端口配置:

# Use any port you want
node dist/simple-http-server.js 3000
node dist/simple-http-server.js 5000
node dist/simple-http-server.js 9000
node dist/simple-http-server.js 12345

服务器将自动:

  • 如果未指定端口,则使用端口8080作为默认端口
  • 接受任何有效的端口号作为命令行参数
  • 在启动消息和文档中显示实际端口

HTTP API使用示例

启动HTTP服务器后,您可以通过以下方式使用它:

浏览器访问

  • 打开 http://localhost:8080 查看API文档
  • 直接点击链接测试各种API

curl命令

# Get current weather for Hong Kong
curl "http://localhost:8080/weather?location=Hong Kong"

# Get 5-day weather forecast for Tokyo
curl "http://localhost:8080/forecast?location=Tokyo&days=5"

# Get weather alerts
curl "http://localhost:8080/alerts?location=Hong Kong"

# Search locations
curl "http://localhost:8080/locations?q=kong"

# Get statistics
curl "http://localhost:8080/stats"

JavaScript/提取

// Get weather data
const response = await fetch('http://localhost:8080/weather?location=Tokyo');
const weather = await response.json();
console.log(weather);

发展模式

# Watch mode compilation
pnpm run dev

可用工具

1.get_current_weather

获取指定位置的当前天气信息

参数:

  • location (string):位置名称

例子:

{
  "location": "Hong Kong"
}

2.获取天气预报

获取指定位置的天气预报

参数:

  • location (string):位置名称
  • days (数字,可选):预测天数(1-7天,默认3天)

例子:

{
  "location": "Tokyo",
  "days": 5
}

3.获取食物警报

获取天气警报信息

参数:

  • location (字符串,可选):位置名称

例子:

{
  "location": "Hong Kong"
}

4.搜索位置

搜索支持的位置

参数:

  • query (string):搜索关键字

例子:

{
  "query": "kong"
}

5.获取_死亡_开始

获取天气统计数据

参数:

支持的地点

目前支持以下位置的详细天气数据:

  • 香港
  • 东京、大阪、京都、广岛、札幌、福冈(日本)
  • 伦敦(英国)
  • 纽约(美国)
  • 悉尼(澳大利亚)

其他位置将返回随机生成的模拟数据。

技术规格

  • 语言:TypeScript
  • 程序包管理器:pnpm
  • MCP-SDK:@modelcontextprotocol/sdk
  • Node.js: >=18

项目结构

src/
├── index.ts              # MCP server main file (stdio)
├── http-server.ts        # HTTP API server
├── simple-http-server.ts # Simple HTTP server
├── weather-service.ts    # Weather service logic
├── mock-data.ts          # Mock data
└── types.ts              # TypeScript type definitions

HTTP API终结点

端点方法参数描述
/获取-neneneba API文档页
/mcpPOSTJSON-RPC 2.0MCP协议端点
/weatherGET位置(必填)获取当前天气
/forecastGET位置(必填),天数(可选)获取天气预报
/alertsGET位置(可选)获取天气警报
/locationsGETq(必填)搜索位置
/statsGET-获取统计数据

许可证

MIT许可证

目录标签

目录标签

位置天气JavaScript天气警报天气预报天气数据本地部署位置服务模拟数据

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明noneremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP