Queries real-time AQI data from AQICN, returning full air quality details for Chinese cities via MCP.
Configuration
View docs{
"mcpServers": {
"8xiang5hao-aqicn-mcp": {
"command": "python",
"args": [
"/path/to/aqicn_mcp/src/aqicn_mcp/server.py"
],
"env": {
"AQICN_TOKEN": "your_token_here"
}
}
}
}You can query real-time air quality information for Chinese cities using this MCP server. It connects to AQICN’s data source and returns comprehensive air quality details, making it easy to build dashboards or alert systems around urban air conditions.
You interact with the AQICN MCP Server through your MCP client by calling the available city queries. Provide the city name in pinyin to obtain the current AQI value, pollutant details, health tips, and the overall air quality description for that location. Use natural language prompts to request the data you need, such as the current AQI for a city or the pollutant breakdown for a given day.
Prerequisites you need before installation: Python 3.8 or newer and Internet access to fetch dependencies.
cd /path/to/aqicn_mcp
pip install -e .To run the MCP server, you must supply your API token from AQICN and point to the server script as shown in the configuration example.
{
"mcpServers": {
"aqicn": {
"command": "python",
"args": [
"/path/to/aqicn_mcp/src/aqicn_mcp/server.py"
],
"env": {
"AQICN_TOKEN": "your_token_here"
}
}
}
}If you encounter issues starting the MCP server, verify Python path correctness, ensure dependencies are installed with pip install -e ., and confirm the AQICN_TOKEN is set correctly.
The project layout includes the MCP server source, a test script, and configuration files. The main server script handles incoming MCP requests and fetches data from the AQICN API.
Data returned includes the AQI index, air quality level, health recommendations, pollutant details (PM2.5, PM10, SO2, NO2, O3, CO, etc.), and the data update timestamp. The server sources data from AQICN and aligns with its terms of service.
Query live AQI for a city by its pinyin name and retrieve current AQI and health information.
Provide detailed pollutant measurements such as PM2.5, PM10, SO2, NO2, O3, CO, and other pollutants.
Return health recommendations based on the current air quality level.
Support queries for major Chinese cities and return structured air quality data.