aqicn-mcp
An MCP server to get Air Quality Data using AQICN.org
Documentation
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 claudeInstalling 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_hereAlternatively, 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_hereRunning the Server
Development Mode
The fastest way to test and debug your server is with the MCP Inspector:
mcp dev aqicn_server.pyClaude Desktop Integration
Once your server is ready, install it in Claude Desktop:
mcp install aqicn_server.pyDirect Execution
For testing or custom deployments:
python aqicn_server.pyAvailable 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.
Frequently asked questions
What is aqicn-mcp?
aqicn-mcp is An MCP server to get Air Quality Data using AQICN.org
How do I install aqicn-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is aqicn-mcp open source?
Yes — it is hosted on GitHub at https://github.com/mattmarcin/aqicn-mcp and has 1 stars.
Related MCP tools
🙌 OpenHands: Code Less, Make More for the Model Context Protocol. Enhance AI assistants with powerful integrations. Python-based implementation.
Universal memory layer for AI Agents; Announcing OpenMemory MCP - local and secure memory management. Python-based implementation.
基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择ChatGPT/Claude/DeepSeek/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
An LLM agent that conducts deep research (local and web) on any given topic and generates a long report with citations. Built for the Model Context Protocol to
🚀 The fast, Pythonic way to build MCP servers and clients Trusted by 19900+ developers. Trusted by 19900+ developers. Trusted by 19900+ developers.
🔥 MaxKB is an open-source platform for building enterprise-grade agents. MaxKB 是强大易用的开源企业级智能体平台。 for the Model Context Protocol. Enhance AI assistants with po
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP