# OpenAQ MCP

> OpenAQ connects your AI agent to the world's largest open air quality database. Monitor real-time pollution levels—including PM2.5, O3, NO2, SO2, and CO—and pull historical air quality trends from thousands of global monitoring stations. You can query data by city, country, or specific pollutant parameter using natural language.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Tags:** air-quality, pollution-monitoring, environmental-data, real-time-sensors, climate-science

## Description

OpenAQ connects your AI agent straight into the world’s largest open air quality database. You can use it to track pollution levels and analyze global air trends using simple natural language queries. This server pulls data from thousands of monitoring stations worldwide.

***

### Finding Stations and Locations

You'll find stations in several ways. If you need a quick overview, `get_countries` lists every country that has active monitoring stations, giving you counts for how many cities and locations are covered there. Need to narrow it down? You can use `get_locations` to search for air quality stations by filtering criteria like a specific country, city name, pollutant type, or even a geographic bounding box. Once you know the general area, if you need all the details on one known station, `get_location_by_id` retrieves every piece of data tied to that unique monitoring ID.

To find out what physical hardware is running these readings, you've got sensor tools too. Use `get_sensors` to list air quality sensors, letting you filter by location or the type of pollutant they monitor. If you know a specific sensor’s identifier, `get_sensor_by_id` fetches all its details for you.

### Getting Measurements and Data Trends

The server gives you two main ways to get readings: current status or history. To check the most recent pollution levels without pulling massive amounts of historical data, use `get_latest_measurements`. This function grabs the absolute newest air quality reading for a specific monitored location ID, covering pollutants like PM2.5, O3, NO2, SO2, and CO.

For deep dives into trends, you'll rely on `get_measurements`. You can pull time-series readings with timestamps by filtering this function using the required location, a specific pollutant parameter, and a defined date range. This lets your agent track long-term pollution patterns over weeks or months. When you just need to know what pollutants are even measurable, run `get_parameters` which lists every available air quality parameter—including units of measure and whether they're considered core parameters like PM10 or Ozone (O3). If you only care about one specific pollutant, use `get_parameter_by_id` to get detailed info on that single chemical.

### Sensor Details and Pollutant Types

If you want a list of every measurable air quality pollutant available, run `get_parameters`. This returns the full catalog, which includes units for parameters like Nitrogen Dioxide (NO2) and Carbon Monoxide (CO), plus whether they are designated as core monitoring types. For sensor hardware details, if you need to find out what specific pollutants a general category of sensors monitors, use `get_sensors`, allowing filtering by location or pollutant type.

***

When your AI client uses these tools—for instance, running `get_locations` first, then feeding that result into `get_latest_measurements`, and finally using `get_parameter_by_id` to check the units for PM2.5—it builds a complete picture of air quality data from start to finish.

## Tools

### get_countries
Lists countries with active monitoring stations, along with city and location counts.

### get_latest_measurements
Gets the most current air quality readings for a specific monitored location ID.

### get_location_by_id
Retrieves all details for one known monitoring station using its unique identifier.

### get_locations
Finds air quality stations by filtering criteria like country, city name, pollutant type, or bounding box.

### get_measurements
Pulls historical readings with timestamps, allowing filtering by location, parameter, and date range.

### get_parameter_by_id
Gets detailed information about a single pollutant parameter using its unique ID.

### get_parameters
Lists all measurable air quality pollutants, including units and whether they are core parameters.

### get_sensor_by_id
Retrieves details for a single physical sensor device using its unique identifier.

### get_sensors
Lists air quality sensors, allowing filtering by location or pollutant type.

## Prompt Examples

**Prompt:** 
```
What's the current PM2.5 level in São Paulo, Brazil?
```

**Response:** 
```
Latest PM2.5 reading for São Paulo: 18.5 µg/m³ (moderate). This is above the WHO guideline of 5 µg/m³ annual mean. Would you like to see the 24-hour trend?
```

**Prompt:** 
```
Which countries have the most air quality monitoring stations?
```

**Response:** 
```
Top countries by monitoring stations: India (2,100+ locations), United States (1,800+), China (1,500+), Brazil (900+), and Germany (700+). Would you like details for any specific country?
```

**Prompt:** 
```
Show me ozone (O3) measurements from the last 24 hours in Paris.
```

**Response:** 
```
Retrieved 48 O3 readings from Paris monitoring stations in the last 24 hours. Average: 65 µg/m³, Peak: 92 µg/m³ at 14:00. All readings within acceptable range. Highest reading was at the Paris 18ème station.
```

## Capabilities

### Get Country Lists
Lists countries that have active air quality monitoring stations, including counts for cities and locations.

### Check Current Air Quality Status
Retrieves the most recent pollution measurements for a specific location without querying historical data.

### View Specific Location Details
Gets detailed information about one particular monitoring station using its unique ID.

### Find Monitoring Locations
Searches for air quality stations by filtering criteria like country, city, pollutant type, or geographic area.

### Pull Historical Readings
Retrieves time-series readings (measurements) filtered by location, specific pollutant, and a date range.

### Lookup Pollutant Parameters
Gets detailed information about specific pollutants, such as units of measure or core status.

### List Measurable Pollutants
Returns a list of all available air quality parameters, including PM10, Ozone (O3), NO2, and CO.

## Use Cases

### Assessing a City's Air Quality Baseline
An urban planner needs to know if smog levels have improved since last year. They ask their agent: "Show me the average PM2.5 in Chicago for Q3 of the last three years." The agent uses `get_locations` first, then executes `get_measurements`, providing a clean, comparative graph of historical data.

### Investigating an Industrial Incident
An environmental scientist suspects high NO2 levels near a factory. They ask: "What is the current NO2 reading at stations within 1 mile of coordinates X, Y?" The agent uses `get_locations` to narrow down nearby sites and then runs `get_latest_measurements` for immediate action.

### Building a Sensor Inventory
A developer needs to list all available monitoring hardware types. They use the specialized tools like `get_sensors` or `get_parameter_by_id` to build a comprehensive inventory list, confirming which specific devices track which pollutants.

### Global Comparison Report
A sustainability consultant needs to compare ozone levels between three different continents. They instruct the agent to query `get_countries`, select the relevant locations, and then use `get_measurements` for a side-by-side comparative report.

## Benefits

- See real-time status instantly. Instead of checking multiple government websites, the agent uses `get_latest_measurements` to provide a single, unified reading for PM2.5 or O3 at any point globally.
- Track long-term trends precisely. Need to compare pollution levels from last year? Use `get_measurements` with defined date range filters—it handles the time-series heavy lifting so you don't have to write complex SQL queries.
- Don't guess what pollutants exist. Running `get_parameters` gives you a full reference list of every measurable pollutant (NO2, SO2, CO, etc.) and its unit, keeping your data accurate from the start.
- Find stations by any criteria. If you only know the city name but not the station ID, use `get_locations`. It filters by country or city to give you a list of valid monitoring points first.
- Target specific sensor types. Use `get_sensors` if your goal is to understand the hardware—it lets you filter sensors by location or even the type of pollutant they measure.

## How It Works

The bottom line is: The agent first maps your request to specific IDs using discovery tools, then runs a single, targeted call to pull all required historical or current sensor data.

1. First, use `get_locations` or `get_countries` to narrow down the area of interest and gather necessary location IDs.
2. Next, call `get_parameters` to confirm the exact pollutant codes (e.g., NO2) needed for the query, ensuring accuracy.
3. Finally, execute `get_measurements`, passing the gathered location ID(s), parameter code(s), and date range filters to retrieve the data.

## Frequently Asked Questions

**How do I check current PM2.5 levels using the OpenAQ MCP Server?**
Use `get_latest_measurements`. You need a location ID for this tool; running it with that ID tells your agent exactly what the most recent reading is without fetching years of history.

**What pollutants can I track using OpenAQ MCP Server?**
You can list all available pollutants by calling `get_parameters`. This tool provides a full reference, including PM10, Ozone (O3), NO2, SO2, and CO.

**How do I find monitoring stations in my city with OpenAQ MCP Server?**
Use `get_locations`. You can filter this tool by country or city name to get a list of valid station IDs before you try to pull any data.

**Can I compare air quality across different countries using OpenAQ MCP Server?**
Yes. Start with `get_countries` to see available regions, then use the location lists from those countries in conjunction with `get_measurements` for a global comparison.

**How do I run historical trend analysis using the `get_measurements` tool?**
You pass three key filters to get measurements over time: a location ID, a specific parameter, and a required date range. This lets you query readings for any period, not just the latest status.

**If I have an ID, how do I get full details about a specific monitoring site using the `get_location_by_id` tool?**
This function returns comprehensive data for one station. You'll find its exact coordinates, sensor counts, and whether it qualifies as an official monitor.

**Can I use the `get_sensors` tool to filter for active or specific types of monitoring equipment?**
Yes. The tool lets you filter sensors by location, parameter type, or current active status. This is useful if you only care about operational devices.

**Before I use any function, what credentials does the OpenAQ MCP Server require for access?**
You must subscribe to the server and enter your free OpenAQ API Key within your AI client. This key authenticates all calls and enables you to run tools like `get_parameters`.

**How do I get an OpenAQ API Key?**
Visit [**OpenAQ Platform**](https://platform.openaq.org/), create a free account, and generate your API key from the dashboard. Free tier includes 1,000 requests/hour.

**What air quality parameters can I monitor?**
PM2.5, PM10, O3 (ozone), NO2, SO2, CO, BC (black carbon), and more. Use `get_parameters` to see the full list with units and classifications.

**Can I get historical air quality data?**
Yes! Use `get_measurements` with date_from and date_to parameters in ISO 8601 format to retrieve time-series data for any location and parameter.