Back to MCP directory
publicPublicdnsLocal runtime

mcp-weatherapi

这是一个基于Spring Boot的天气服务应用,提供通过城市名称查询当前天气信息的REST API。

article

README

🚀 天气服务应用

该项目是一个基于Spring Boot的应用程序,它提供了一个REST API,让用户可以通过城市名称查询天气信息,极大地方便了获取天气数据的需求。

🚀 快速开始

先决条件

  • Java 21或更高版本
  • Maven 3.8或更高版本

配置

该应用程序需要在application.ymlapplication.properties文件中配置API属性。以下是示例配置:

weather-api:
  base-url: https://api.weatherapi.com/v1
  endpoint: /current.json
  api-key: 您的实际API密钥

请将“YOUR_API_KEY”替换为您实际的API密钥。

API端点

  • GET /weather?city={城市名称}:获取指定城市的当前天气信息。

✨ 主要特性

  • 获取指定城市的当前天气详情。
  • 使用Java和Kotlin构建,结合两种语言的优势。
  • 采用Spring Boot进行应用程序开发,提高开发效率。
  • 使用响应式WebClient进行API调用,提升性能。
  • 可配置的API属性,方便灵活使用。
  • 记录天气信息以备调试使用,便于问题排查。
  • 支持JSON响应,便于与其他系统集成。
  • 模块化设计,并通过DTO(数据传输对象)实现干净的数据处理,使代码结构更清晰。

🔧 技术细节

技术栈

  • Java 21:提供强大的编程能力和新特性。
  • Kotlin:简洁高效的编程语言,与Java良好兼容。
  • Spring Boot 3.4.5:简化Spring应用开发流程。
  • Maven:项目管理和构建工具。
  • Lombok:减少样板代码,提高代码可读性。
  • WebClient:用于进行响应式的HTTP调用。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client