Skip to main content
Glama
TheHexaflux

@xjt-demo/xjt-weather-mcp

by TheHexaflux

@xjt-demo/xjt-weather-mcp

基于 MCP 官方 Weather Server Quickstart 实现的天气 MCP Server,数据源为高德地图天气查询 API,可通过 npx 直接运行,无需本地安装。

前置条件

  1. 高德开放平台 注册并创建应用

  2. 申请 Web 服务 类型的 API Key

  3. 在 MCP 配置中通过环境变量 AMAP_API_KEY 传入 Key

城市编码(adcode)可参考高德城市编码表,例如:

城市

adcode

北京东城

110101

上海

310100

广州

440100

深圳

440300

Related MCP server: amap-weather-mcp-server

MCP Tools

Tool

说明

get-weather-live

查询指定城市的实况天气

get-weather-forecast

查询指定城市的天气预报(当天 + 未来 3 天)

两个工具均接受 city 参数:6 位数字 adcode。

Cursor / Claude 配置

发布到 npm 后,使用者无需手动安装依赖。npx 会自动下载包及其 dependencies,然后启动 MCP Server。

{
  "mcpServers": {
    "xjtWeather": {
      "command": "npx",
      "args": ["-y", "@xjt-demo/xjt-weather-mcp"],
      "env": {
        "AMAP_API_KEY": "你的高德 Web 服务 Key"
      }
    }
  }
}

预发布通道:

{
  "mcpServers": {
    "xjtWeatherAlpha": {
      "command": "npx",
      "args": ["-y", "@xjt-demo/xjt-weather-mcp@alpha"],
      "env": {
        "AMAP_API_KEY": "你的高德 Web 服务 Key"
      }
    }
  }
}

本地开发

npm install
npm run build
AMAP_API_KEY=你的Key npm run dev

本地调试配置:

{
  "mcpServers": {
    "xjtWeatherLocal": {
      "command": "node",
      "args": ["/path/to/xjt-weather-mcp/dist/server.js"],
      "env": {
        "AMAP_API_KEY": "你的高德 Web 服务 Key"
      }
    }
  }
}

运行集成测试前, 在.env 文件中填入 Key(.env 已被 git 忽略):

使用 MCP Inspector 调试:

AMAP_API_KEY=你的Key npx @modelcontextprotocol/inspector node dist/server.js

发布到 npm

npm login
npm run build
npm publish --tag alpha   # 预发布
# 或
npm publish             # 稳定版

prepublishOnly 会在发布前自动执行 npm run build

License

MIT

Install Server
A
license - permissive license
A
quality
A
maintenance

Maintenance

Maintainers
Response time
Release cycle
2Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

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/TheHexaflux/xjt-weather-mcp-server'

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