Skip to main content
Glama

AQICN MCP Server

by mattmarcin
MIT License
1
  • Linux
  • Apple

AQICN MCP Server

This is a Model Context Protocol (MCP) server that provides air quality data tools from the World Air Quality Index (AQICN) project. It allows LLMs to fetch real-time air quality data for cities and coordinates worldwide.

Installation

Installing via Smithery

To install AQICN MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @mattmarcin/aqicn-mcp --client claude

We recommend using uv to manage your Python environment:

# Install the package and dependencies uv pip install -e .

Environment Setup

Create a .env file in the project root (you can copy from .env.example):

# .env AQICN_API_KEY=your_api_key_here

Alternatively, you can set the environment variable directly:

# Linux/macOS export AQICN_API_KEY=your_api_key_here # Windows set AQICN_API_KEY=your_api_key_here

Running the Server

Development Mode

The fastest way to test and debug your server is with the MCP Inspector:

mcp dev aqicn_server.py

Claude Desktop Integration

Once your server is ready, install it in Claude Desktop:

mcp install aqicn_server.py

Direct Execution

For testing or custom deployments:

python aqicn_server.py

Available Tools

1. city_aqi

Get air quality data for a specific city.

@mcp.tool() def city_aqi(city: str) -> AQIData: """Get air quality data for a specific city."""

Input:

  • city: Name of the city to get air quality data for

Output: AQIData with:

  • aqi: Air Quality Index value
  • station: Station name
  • dominant_pollutant: Main pollutant (if available)
  • time: Timestamp of the measurement
  • coordinates: Latitude and longitude of the station

2. geo_aqi

Get air quality data for a specific location using coordinates.

@mcp.tool() def geo_aqi(latitude: float, longitude: float) -> AQIData: """Get air quality data for a specific location using coordinates."""

Input:

  • latitude: Latitude of the location
  • longitude: Longitude of the location

Output: Same as city_aqi

3. search_station

Search for air quality monitoring stations by keyword.

@mcp.tool() def search_station(keyword: str) -> list[StationInfo]: """Search for air quality monitoring stations by keyword."""

Input:

  • keyword: Keyword to search for stations (city name, station name, etc.)

Output: List of StationInfo with:

  • name: Station name
  • station_id: Unique station identifier
  • coordinates: Latitude and longitude of the station

Example Usage

Using the MCP Python client:

from mcp import Client async with Client() as client: # Get air quality data for Beijing beijing_data = await client.city_aqi(city="beijing") print(f"Beijing AQI: {beijing_data.aqi}") # Get air quality data by coordinates (Tokyo) geo_data = await client.geo_aqi(latitude=35.6762, longitude=139.6503) print(f"Tokyo AQI: {geo_data.aqi}") # Search for stations stations = await client.search_station(keyword="london") for station in stations: print(f"Station: {station.name} ({station.coordinates})")

Contributing

Feel free to open issues and pull requests. Please ensure your changes include appropriate tests and documentation.

License

This project is licensed under the MIT License.

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

モデル コンテキスト プロトコル (MCP) を介して、世界大気質指数とのやり取りを可能にし、世界中の都市と座標のリアルタイムの大気質データを取得します。

  1. インストール
    1. Smithery経由でインストール
    2. 推奨UV(手動)によるインストール
  2. 環境設定
    1. サーバーの実行
      1. 開発モード
      2. クロードデスクトップ統合
      3. 直接実行
    2. 利用可能なツール
      1. 1. シティアキ
      2. 2. geo_aqi
      3. 3. 検索ステーション
    3. 使用例
      1. 貢献
        1. ライセンス

          Related MCP Servers

          • -
            security
            F
            license
            -
            quality
            Provides current weather and air quality data for any city using WeatherAPI, easily integrating with MCP clients like n8n and Claude Desktop App.
            Last updated -
            86
            1
          • -
            security
            F
            license
            -
            quality
            An India-focused MCP server that provides real-time weather conditions, forecasts, air quality data, and location search capabilities using the OpenWeatherMap API.
            Last updated -
          • A
            security
            A
            license
            A
            quality
            A Model Context Protocol implementation that enables LLMs to access real-time, forecasted, and historical U.S. air quality data through the AirNow API.
            Last updated -
            10
            6
            MIT License
            • Apple
          • A
            security
            F
            license
            A
            quality
            A MCP server that provides real-time weather information for any city through a simple tool that resolves geographic coordinates and fetches current weather data.
            Last updated -
            1
            9

          View all related MCP servers

          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/mattmarcin/aqicn-mcp'

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