@pipeworx/mcp-openaq 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +89 -5
- package/bin/cli.js +17 -0
- package/package.json +16 -4
- package/server.json +3 -3
- package/src/index.ts +1261 -144
- package/src/server.ts +45 -0
- package/tsconfig.json +5 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
# mcp-openaq
|
|
2
2
|
|
|
3
|
-
OpenAQ MCP —
|
|
3
|
+
OpenAQ MCP — global air-quality measurements via the OpenAQ v3 API.
|
|
4
4
|
|
|
5
|
-
Part of
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1679+ live data sources.
|
|
6
6
|
|
|
7
7
|
## Tools
|
|
8
8
|
|
|
9
9
|
| Tool | Description |
|
|
10
10
|
|------|-------------|
|
|
11
|
+
| `air_quality_near` | Get the latest air-quality readings (PM2.5, PM10, O3, NO2, SO2, CO, etc.) at the monitoring station NEAREST to a latitude/longitude. PREFER for "air quality near me", "what is the air quality at <coordinates>", "is the air bad in <place> right now". Returns the nearest station with its most recent pollutant values, plus other nearby stations. |
|
|
12
|
+
| `find_stations` | Find OpenAQ air-quality monitoring stations by location: a city or place name, coordinates+radius (nearest first), a country (ISO 3166-1 alpha-2 code), or a bounding box. Returns station id, name, country, coordinates, and the pollutants each measures (with sensor ids), plus resolved_place echoing the coordinates a city name resolved to. This is the first step for a historical series: find the station here, then pass its sensor_id to get_measurements. At least one location argument is required — the tool will not return an unfiltered global list. |
|
|
13
|
+
| `get_latest` | Get the latest reading for every pollutant at a specific OpenAQ station (by location id from find_stations). Returns each parameter (PM2.5, O3, NO2, etc.) with its value, units, and measurement time. |
|
|
14
|
+
| `get_measurements` | Get the most recent time series (hourly or daily aggregates) for a single OpenAQ sensor (sensor id from find_stations), newest first. Use for pollutant trends over time at one station/parameter. Returns the sensor's LAST `limit` readings — note that many OpenAQ sensors are archived and stopped reporting years ago, so "most recent" can legitimately be several years old: always read the returned timestamps rather than assuming the data is current. Use find_stations or get_latest to pick a sensor that is still reporting. |
|
|
11
15
|
|
|
12
16
|
## Quick Start
|
|
13
17
|
|
|
14
|
-
Add to your MCP client
|
|
18
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
15
19
|
|
|
16
20
|
```json
|
|
17
21
|
{
|
|
@@ -23,12 +27,92 @@ Add to your MCP client config:
|
|
|
23
27
|
}
|
|
24
28
|
```
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
### What this endpoint actually serves
|
|
31
|
+
|
|
32
|
+
`tools/list` at `https://gateway.pipeworx.io/openaq/mcp` returns the tools in the table
|
|
33
|
+
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
|
|
34
|
+
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
|
|
35
|
+
gateway-wide set. So the tool count you see is larger than this table: a
|
|
36
|
+
single-pack endpoint currently lists roughly 30 shared tools alongside the
|
|
37
|
+
pack's own. The connection's `initialize` response states its exact scope, and
|
|
38
|
+
is the authoritative answer for a given day.
|
|
39
|
+
|
|
40
|
+
This is deliberate, not multiplexing by accident. The meta-tools are what let a
|
|
41
|
+
scoped connection answer a question this pack does not cover — via
|
|
42
|
+
`ask_pipeworx`, which routes across the whole catalog — without you adding a
|
|
43
|
+
second MCP server. There is currently no way to mount a pack endpoint without
|
|
44
|
+
them; if the extra schemas cost you more context than the routing is worth,
|
|
45
|
+
connect to the full gateway once rather than to several pack endpoints.
|
|
46
|
+
|
|
47
|
+
Or connect to the full Pipeworx gateway to get every pack's tools listed
|
|
48
|
+
directly, instead of just this one's:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"pipeworx": {
|
|
54
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Both URLs reach the same gateway and the same 1679+ data sources. The
|
|
61
|
+
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
|
|
62
|
+
reaches all of them from either one.
|
|
63
|
+
|
|
64
|
+
## No MCP client? Call it over HTTP
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
curl -X POST https://gateway.pipeworx.io/v1/tools/air_quality_near \
|
|
68
|
+
-H 'Content-Type: application/json' \
|
|
69
|
+
-d '{"latitude":40.785,"longitude":-73.968}'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/air_quality_near`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.
|
|
73
|
+
|
|
74
|
+
## Standalone (no gateway account)
|
|
75
|
+
|
|
76
|
+
This package also runs as a local stdio MCP server — no Pipeworx account, no
|
|
77
|
+
gateway round-trip:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"openaq": {
|
|
83
|
+
"command": "npx",
|
|
84
|
+
"args": ["-y", "@pipeworx/mcp-openaq"]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or run it directly to confirm it starts:
|
|
27
91
|
|
|
28
92
|
```bash
|
|
29
|
-
npx pipeworx
|
|
93
|
+
npx -y @pipeworx/mcp-openaq
|
|
30
94
|
```
|
|
31
95
|
|
|
96
|
+
It speaks MCP over stdin/stdout and answers `initialize`/`tools/list`/`tools/call`
|
|
97
|
+
for **only** this pack's tools — none of the shared meta-tools the gateway
|
|
98
|
+
connection above adds. Same source, same tools, no ask_pipeworx routing.
|
|
99
|
+
|
|
100
|
+
## Using with ask_pipeworx
|
|
101
|
+
|
|
102
|
+
Instead of calling tools directly, you can ask questions in plain English —
|
|
103
|
+
this works on the pack endpoint above as well as on the full gateway:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
ask_pipeworx({ question: "your question about Openaq data" })
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
110
|
+
|
|
111
|
+
## More
|
|
112
|
+
|
|
113
|
+
- [Docs and guides](https://pipeworx.io/docs)
|
|
114
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
115
|
+
|
|
32
116
|
## License
|
|
33
117
|
|
|
34
118
|
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//
|
|
3
|
+
// Entry point for `npx @pipeworx/mcp-<slug>`.
|
|
4
|
+
//
|
|
5
|
+
// Packs ship as raw TypeScript (no build step — see publish-pack.sh for why:
|
|
6
|
+
// tsx sidesteps every extensionless-import / bare-JSON-import edge case a
|
|
7
|
+
// per-pack tsc build would have to solve one pack at a time). This file
|
|
8
|
+
// registers tsx's ESM loader programmatically, then hands off to src/server.ts,
|
|
9
|
+
// which wraps the pack's {tools, callTool} export in a stdio MCP server.
|
|
10
|
+
//
|
|
11
|
+
// Copied verbatim into every published pack repo by scripts/publish-pack.sh —
|
|
12
|
+
// edit this file, not a per-pack copy.
|
|
13
|
+
import { register } from 'tsx/esm/api';
|
|
14
|
+
|
|
15
|
+
register();
|
|
16
|
+
|
|
17
|
+
await import('../src/server.ts');
|
package/package.json
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipeworx/mcp-openaq",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "OpenAQ MCP —
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "OpenAQ MCP — global air-quality measurements via the OpenAQ v3 API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"types": "src/index.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mcp-openaq": "bin/cli.js"
|
|
10
|
+
},
|
|
8
11
|
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "openaq"],
|
|
9
12
|
"license": "MIT",
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/pipeworx-io/mcp-openaq"
|
|
15
|
+
"url": "git+https://github.com/pipeworx-io/mcp-openaq.git"
|
|
13
16
|
},
|
|
14
17
|
"scripts": {
|
|
15
18
|
"typecheck": "tsc --noEmit"
|
|
16
19
|
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
22
|
+
"tsx": "^4.19.0"
|
|
23
|
+
},
|
|
17
24
|
"devDependencies": {
|
|
18
|
-
"typescript": "^5.
|
|
25
|
+
"typescript": "^5.9.3",
|
|
26
|
+
"@cloudflare/workers-types": "^4.20260405.1"
|
|
27
|
+
},
|
|
28
|
+
"pipeworx": {
|
|
29
|
+
"sourceHash": "v1-adee8121f09c5963682f4de33f0befd370ca7df76ee1ff1acbf963ab4ecb5cb6",
|
|
30
|
+
"sourceCommit": "adb69d997f82a62e8e22b594488c7d04a227db35"
|
|
19
31
|
}
|
|
20
32
|
}
|
package/server.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
3
|
"name": "io.github.pipeworx-io/openaq",
|
|
4
|
-
"title": "
|
|
5
|
-
"description": "OpenAQ MCP —
|
|
6
|
-
"version": "0.1.
|
|
4
|
+
"title": "Openaq",
|
|
5
|
+
"description": "OpenAQ MCP — global air-quality measurements via the OpenAQ v3 API.",
|
|
6
|
+
"version": "0.1.1",
|
|
7
7
|
"websiteUrl": "https://pipeworx.io/packs/openaq",
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/pipeworx-io/mcp-openaq",
|