MCP ExplorerExplorer

Weather Mcp

@jackjin1997on a year ago
1 MIT
FreeCommunity
AI Systems

Overview

What is Weather Mcp

Weather MCP is a TypeScript-based application that provides weather information via the AMAP API. It allows users to retrieve current weather data and forecasts by city name or adcode, facilitating access to real-time and predictive weather information.

Use cases

Users can utilize Weather MCP for various purposes including checking current weather conditions in specific cities, planning activities based on weather forecasts, and integrating weather data into other applications or services that require weather information.

How to use

To use Weather MCP, clone the repository, install the necessary dependencies, and set up an AMAP API key in a .env file. The application can be run in development mode with ‘pnpm dev’ or ‘npm run dev’, and for production, build the application and start it using ‘pnpm start’ or ‘npm start’. Access the weather data through provided API endpoints.

Key features

Key features of Weather MCP include obtaining current weather and weather forecasts for cities via RESTful API endpoints, type safety provided by TypeScript, and a straightforward setup process that requires minimal configuration for end-users.

Where to use

Weather MCP can be used in various contexts such as web applications, mobile applications, or any system that requires up-to-date weather information. It is particularly useful for developers looking to integrate weather data into their products or services.

Content

Weather MCP

A TypeScript-based weather Messaging and Cloud Platform (MCP) application that provides weather information using the AMAP API.

Features

  • Get current weather by city name or adcode
  • Get weather forecast by city name or adcode
  • RESTful API design
  • TypeScript for type safety

Prerequisites

  • Node.js (v14 or higher)
  • pnpm (recommended) or npm
  • AMAP API key

Installation

  1. Clone the repository:
git clone https://github.com/your-username/weather-mcp.git
cd weather-mcp
  1. Install dependencies:
# Using pnpm (recommended)
pnpm install

# Using npm
npm install
  1. Create a .env file in the root directory and add your AMAP API key:
PORT=3000
AMAP_KEY=your_amap_key_here

Running the Application

Development Mode

# Using pnpm
pnpm dev

# Using npm
npm run dev

Production Mode

# Using pnpm
pnpm build
pnpm start

# Using npm
npm run build
npm start

API Endpoints

Get Current Weather

GET /api/weather/current?city={city}
  • city: City name or adcode (required)

Get Weather Forecast

GET /api/weather/forecast?city={city}
  • city: City name or adcode (required)

Health Check

GET /health

Example API Responses

Current Weather

{
  "success": true,
  "data": [
    {
      "province": "北京市",
      "city": "北京市",
      "adcode": "110000",
      "weather": "晴",
      "temperature": "28",
      "winddirection": "西南",
      "windpower": "≤3",
      "humidity": "40",
      "reporttime": "2023-08-10 16:00:00"
    }
  ]
}

Weather Forecast

License

ISC

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers