@cyanheads/openaq-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@cyanheads/openaq-mcp-serverShow me the latest air quality readings in Berlin"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Public Hosted Server: https://openaq.caseyjhand.com/mcp
Overview
Measured air quality from the OpenAQ v3 API: physical-sensor observations from government reference monitors and research-grade sensors worldwide. Find monitoring stations, read current values, and pull historical pollutant series from any MCP client. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
Tools
Tool | Description |
| Find monitoring stations near a point, in a bounding box, or by country; the location ids the other tools take |
| Latest value for every sensor at a station, labeled with its pollutant and unit |
| Historical series for one pollutant at one station, raw or rolled up hourly/daily |
| Pollutant catalog with canonical units; maps a pollutant and unit to its parameter id |
| Country coverage: data span and the parameters measured in each |
| List the tables and columns staged on a DataCanvas |
| Run a read-only SQL |
| Delete a complete staged canvas; opt-in with |
Resources
Resource | Description |
| Metadata for one station: coordinates, provider, sensors with units, data span |
| Full pollutant and unit catalog |
Both resources mirror tool output, so tool-only clients lose nothing.
Related MCP server: Wellness Air
Capability reference
openaq_find_locations tool
Scope by
coordinateswithradius(metres, 1–25000, default 12000),bbox, and/oriso(a code fromopenaq_list_countries); at least one is required, andcoordinatesandbboxexclude each other.parametersId,monitor,mobile, andprovidersIdnarrow further; up to 100 stations per page (limit, default 20), 1-basedpageEach station carries
id,distanceMeters(coordinate search only),provider/providerId,isMonitor/isMobile, itsparameterswith units, and thedatetimeFirst/datetimeLastspan;coordinates,country, andproviderare null when OpenAQ lists nonetotalCountcounts stations through the current page and is a floor whentotalCountIsLowerBoundis set; no match fails asno_locations_found, a page past the end aspage_exhausted
openaq_get_readings tool
A
locationId, orcoordinatesplusparametersIdto resolve the nearest station within 25 km that measures it (compared across up to 1,000 matching stations; a full 1,000 adds anotice); withlocationId,parametersIdoptionally filters to one parameterOne reading per sensor with
value,unit,sensorId, anddatetimeUtc/datetimeLocal, plus the station'sprovider,providerId,timezone, anddatetimeLastMisses are typed:
location_not_found,parameter_not_at_location(with the station'savailableids),no_station_near_coordinates,no_recent_values
openaq_get_measurements tool
Requires
locationIdandparametersId;datetimeFrom/datetimeToaccept UTC timestamps or station-localYYYY-MM-DDdates (UTC days when the station has no timezone).aggregationisraw(default),hourly, ordaily; up to 5,000 rows per callReturns
series,sensorId,pulledCount,pullComplete,effectiveRange, and stationprovider,providerId, andtimezone.totalCountis a floor whentotalCountIsLowerBoundis set; rollups add summary statistics,gapCount, the first 20 missing intervals asgaps, and a notice when edge buckets are clippedPast 100 rows,
seriesis a preview (truncated) and the pulled rows stage on a DataCanvas asmeasurements_<sensorId>(canvasId,tableName) whenCANVAS_PROVIDER_TYPE=duckdb; a suppliedcanvas_idstages onto that canvas at any size. One table per sensor: a second sensor adds a table to join against, and re-staging the same sensor overwrites its earlier series
openaq_list_parameters tool
Optional case-insensitive
queryover code, display name, and description;pollutantsOnlydrops meteorological and particle-count channelsRows carry
id,name,displayName,unit, anddescription; one pollutant can appear under several ids by unit (CO is 4 in µg/m³, 8 in ppm, 102 in ppb)
openaq_list_countries tool
Optional
query(a two-letter value matches an ISO 3166-1 alpha-2 code first; otherwise code or name substrings match) andparametersId; up to 100 per page (limit, default 20), 1-basedpageRows carry
code(theisovalue foropenaq_find_locations),name, thedatetimeFirst/datetimeLastspan, and theparametersmeasured anywhere in the country;totalCountis the full filtered count
openaq_dataframe_describe tool
Takes a
canvas_idfromopenaq_get_measurementsand returns each staged table'sname,rowCount, andcolumns. Call it beforeopenaq_dataframe_query: the staged table is flat (min,sd) while the inlineseriesnests those undersummaryFails as
canvas_unavailableunlessCANVAS_PROVIDER_TYPE=duckdb, orcanvas_not_foundfor an unknown or expired id
openaq_dataframe_query tool
A
canvas_idand one read-onlySELECT; writes, DDL, and file/network table functions are rejectedAt most 200 rows per response, with
truncatedset when the cap cut the result; page withORDER BYplusLIMIT/OFFSETFails as
canvas_unavailable,canvas_not_found, ormissing_table
openaq_dataframe_drop tool
Registered only with
OPENAQ_ENABLE_CANVAS_DROP=true; calls fail ascanvas_unavailableunlessCANVAS_PROVIDER_TYPE=duckdb. When disabled, the HTTP landing page shows the enable hint andtools/listomits the toolTakes a
canvas_idand deletes that whole canvas, including all staged tables. Other agents sharing the id lose access; OpenAQ's source data is unaffectedReturns the requested
canvasIdanddropped: true when deleted, false when no reachable canvas exists. With authentication off, callers share a tenant: anyone holding an id can delete its canvas when enabled
openaq://location/{locationId} resource
application/json: name, locality, timezone, country, provider,isMonitor/isMobile, coordinates,sensors(each withparameterIdandunit), and thedatetimeFirst/datetimeLastspanlocationIdcomes fromopenaq_find_locations; cached 5 minutes
openaq://parameters resource
application/jsoncatalog, the same rows as an unfilteredopenaq_list_parametersCached 1 hour
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
OpenAQ-specific:
One typed client over the OpenAQ v3 REST API:
X-API-Keyauth, retry with backoff, and typed upstream failures (invalid_api_key,rate_limited,upstream_timeout,upstream_error) on every OpenAQ callHides the v3 location → sensor → measurement hierarchy: readings join the latest feed to the station's sensor map, and measurements resolve a station plus parameter to its sensor
Coordinates and bbox corners are range-checked and contradictory search scopes rejected before any request reaches OpenAQ
Large measurement series stage on a DataCanvas for read-only DuckDB SQL, one table per sensor, so two series on one
canvas_idcan be joined
Agent-friendly output:
Measured, not modeled: a search with no station fails as
no_locations_foundorno_station_near_coordinates, stated as no coverage rather than clean airUnits travel with every value and are never converted;
parametersIdselects pollutant and unit togetherFreshness and truncation are explicit: per-value timestamps and
datetimeLast, andtotalCount/truncated/noticeon capped results
Getting started
Public Hosted Instance
A public instance is available at https://openaq.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"openaq-mcp-server": {
"type": "streamable-http",
"url": "https://openaq.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file.
{
"mcpServers": {
"openaq-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/openaq-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"OPENAQ_API_KEY": "your-api-key"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"openaq-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/openaq-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"OPENAQ_API_KEY": "your-api-key"
}
}
}
}Or with Docker:
{
"mcpServers": {
"openaq-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"-e", "OPENAQ_API_KEY=your-api-key",
"ghcr.io/cyanheads/openaq-mcp-server:latest"
]
}
}
}Add "CANVAS_PROVIDER_TYPE": "duckdb" to env to enable DataCanvas SQL over large measurement series.
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 OPENAQ_API_KEY=your-api-key bun run start:http
# Server listens at http://localhost:3010/mcpPrerequisites
Bun v1.4.0 or higher (or Node.js v24+).
A free OpenAQ v3 API key from an OpenAQ Explorer account.
Installation
Clone the repository:
git clone https://github.com/cyanheads/openaq-mcp-server.gitNavigate into the directory:
cd openaq-mcp-serverInstall dependencies:
bun installConfigure environment:
cp .env.example .env
# edit .env and set OPENAQ_API_KEYConfiguration
Variable | Description | Default |
| Required. OpenAQ v3 API key, sent as the | — |
| OpenAQ v3 API base URL, for a proxy or test mirror. |
|
|
|
|
| Enable |
|
| Transport: |
|
| HTTP server port. |
|
| HTTP session mode: |
|
| Authentication: |
|
| Log level ( |
|
| Enable OpenTelemetry. |
|
| OTLP base URL; traces use | — |
| Opt into OTLP log export with a full endpoint URL. The base endpoint never enables logs. | — |
| Log failed calls' arguments and results. Redacts by key name only; secrets in free-form values remain. |
|
| UTF-8 byte cap per logged failure payload. |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
Build and run:
bun run rebuild bun run start:http # or start:stdioRun checks and tests:
bun run devcheck # Lint, format, typecheck, security, changelog sync bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t openaq-mcp-server .
docker run --rm -e OPENAQ_API_KEY=your-api-key -p 3010:3010 openaq-mcp-serverThe image defaults to HTTP transport, stateless session mode, and logs to /var/log/openaq-mcp-server. DuckDB ships in the image, so DataCanvas works once CANVAS_PROVIDER_TYPE=duckdb is set. OpenTelemetry peer dependencies are installed by default; build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
Directory | Purpose |
|
|
| Server-specific environment variable parsing and validation with Zod. |
| Tool definitions ( |
| Resource definitions ( |
| OpenAQ v3 client and domain types ( |
| Unit and integration tests mirroring |
Development guide
See CLAUDE.md / AGENTS.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — catch only to map a failure to a declared error reason or to keep a partial result
Use
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storageRegister new tools and resources in the
createApp()arraysWrap the OpenAQ API: validate raw → normalize to the domain type → return the output schema; surface units verbatim and never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
Data comes from the OpenAQ platform, and attribution to OpenAQ is required when using this server's output (Terms of Use). OpenAQ aggregates measurements from government agencies, research institutions, and other networks, each of which may set its own attribution or licensing terms. The provider field on openaq_find_locations, openaq_get_readings, and openaq_get_measurements results and the openaq://location/{locationId} resource names the originating network; review and follow the terms of any provider whose data you use.
This server cannot be deployed
Maintenance
Related MCP Connectors
OpenAQ MCP — global air-quality measurements via the OpenAQ v3 API.
Air Quality MCP — wraps air-quality-api.open-meteo.com (free, no auth)
EPA AirNow MCP — official US real-time AQI + forecast (free key)
openSenseMap MCP — citizen-science environmental sensor network (opensensemap.org)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with the World Air Quality Index to fetch real-time air quality data for cities and coordinates worldwide via Model Context Protocol (MCP).1MIT
- AlicenseAqualityAmaintenanceLocal-first air-quality MCP for AI agents: AirGradient, AirThings, PurpleAir, IQAir and Awair.19133 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables querying of official Netherlands air quality data from the RIVM Luchtmeetnet API via MCP tools.194 npmMIT
- AlicenseNot gradedqualityBmaintenanceFind EV charging stations by location and connector, get full station detail, resolve reference IDs, and read community reliability check-ins via MCP.304 npm1Apache 2.0