@xjt-demo/xjt-weather-mcp

@xjt-demo/xjt-weather-mcp

基于高德天气API的MCP服务器,可通过adcode查询实时天气和未来3天预报。

Category
Visit Server

README

@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

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured