Cover image
Try Now
2025-02-05

An MCP server to get Air Quality Data using AQICN.org

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

AQICN MCP Server

smithery badge

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

Installing via recommended uv (manual)

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.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • Gil kaminski
  • Make sure you are post-ready before you post on social media

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • J. DE HARO OLLE
  • Especialista en juegos de palabras en varios idiomas.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

  • deemkeen
  • control your mbot2 with a power combo: mqtt+mcp+llm

  • zhaoyunxing92
  • 本项目是一个钉钉MCP(Message Connector Protocol)服务,提供了与钉钉企业应用交互的API接口。项目基于Go语言开发,支持员工信息查询和消息发送等功能。

  • apappascs
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • OffchainLabs
  • Go implementation of Ethereum proof of stake

    Reviews

    1 (1)
    Avatar
    user_lusFgi0Q
    2025-04-16

    I recently used the Hello MCP Go ???? application created by softchris and I am absolutely blown away! The user interface is seamless and the performance is top-notch. This application's welcome message makes you feel instantly right at home. For anyone looking for an efficient and user-friendly MCP tool, I highly recommend checking it out at https://mcp.so/server/hello-mcp-go/softchris. You won't be disappointed!