@cyanheads/epa-mcp-server 0.2.0 → 0.3.0
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/CLAUDE.md +2 -2
- package/Dockerfile +10 -6
- package/LICENSE +201 -0
- package/README.md +24 -9
- package/changelog/0.2.x/0.2.1.md +31 -0
- package/changelog/0.3.x/0.3.0.md +13 -0
- package/dist/config/server-config.d.ts +1 -0
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +7 -0
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-air-quality.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-air-quality.tool.js +37 -35
- package/dist/mcp-server/tools/definitions/get-air-quality.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-ejscreen.tool.d.ts +73 -0
- package/dist/mcp-server/tools/definitions/get-ejscreen.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ejscreen.tool.js +273 -0
- package/dist/mcp-server/tools/definitions/get-ejscreen.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tri-releases.tool.d.ts +4 -0
- package/dist/mcp-server/tools/definitions/get-tri-releases.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-tri-releases.tool.js +26 -2
- package/dist/mcp-server/tools/definitions/get-tri-releases.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +139 -2
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/index.js +4 -1
- package/dist/mcp-server/tools/definitions/index.js.map +1 -1
- package/dist/services/airnow/airnow-service.d.ts.map +1 -1
- package/dist/services/airnow/airnow-service.js +5 -4
- package/dist/services/airnow/airnow-service.js.map +1 -1
- package/dist/services/dmap/dmap-service.d.ts +10 -0
- package/dist/services/dmap/dmap-service.d.ts.map +1 -1
- package/dist/services/dmap/dmap-service.js +81 -5
- package/dist/services/dmap/dmap-service.js.map +1 -1
- package/dist/services/dmap/types.d.ts +36 -4
- package/dist/services/dmap/types.d.ts.map +1 -1
- package/dist/services/echo/echo-service.js +1 -1
- package/dist/services/echo/echo-service.js.map +1 -1
- package/dist/services/ejscreen/ejscreen-service.d.ts +38 -0
- package/dist/services/ejscreen/ejscreen-service.d.ts.map +1 -0
- package/dist/services/ejscreen/ejscreen-service.js +258 -0
- package/dist/services/ejscreen/ejscreen-service.js.map +1 -0
- package/dist/services/ejscreen/types.d.ts +63 -0
- package/dist/services/ejscreen/types.d.ts.map +1 -0
- package/dist/services/ejscreen/types.js +9 -0
- package/dist/services/ejscreen/types.js.map +1 -0
- package/package.json +5 -3
- package/server.json +17 -3
package/CLAUDE.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** epa-mcp-server
|
|
4
|
-
**Version:** 0.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.10.
|
|
4
|
+
**Version:** 0.3.0
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.10.14`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
|
|
8
8
|
**Zod:** ^4.4.3
|
package/Dockerfile
CHANGED
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
# This stage installs all dependencies (including dev), builds the TypeScript
|
|
5
5
|
# source code into JavaScript, and prepares the production assets.
|
|
6
6
|
# ==============================================================================
|
|
7
|
-
FROM oven/bun:1.3 AS build
|
|
7
|
+
FROM oven/bun:1.3.14 AS build
|
|
8
8
|
|
|
9
9
|
WORKDIR /usr/src/app
|
|
10
10
|
|
|
11
11
|
# Copy dependency manifests for optimized layer caching
|
|
12
12
|
COPY package.json bun.lock ./
|
|
13
13
|
|
|
14
|
-
# Install all dependencies (including dev dependencies for building)
|
|
15
|
-
|
|
14
|
+
# Install all dependencies (including dev dependencies for building).
|
|
15
|
+
# The BuildKit cache mount persists Bun's global package cache across builds.
|
|
16
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
17
|
+
bun install --frozen-lockfile --ignore-scripts
|
|
16
18
|
|
|
17
19
|
# Copy the rest of the source code
|
|
18
20
|
COPY . .
|
|
@@ -28,7 +30,7 @@ RUN node_modules/.bin/tsc --project tsconfig.build.json && node_modules/.bin/tsc
|
|
|
28
30
|
# application. It uses a slim base image and only includes production
|
|
29
31
|
# dependencies and build artifacts.
|
|
30
32
|
# ==============================================================================
|
|
31
|
-
FROM oven/bun:1.3-slim AS production
|
|
33
|
+
FROM oven/bun:1.3.14-slim AS production
|
|
32
34
|
|
|
33
35
|
WORKDIR /usr/src/app
|
|
34
36
|
|
|
@@ -49,13 +51,15 @@ COPY package.json bun.lock ./
|
|
|
49
51
|
|
|
50
52
|
# Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
|
|
51
53
|
# that are not needed in the final production image.
|
|
52
|
-
RUN bun
|
|
54
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
55
|
+
bun install --production --frozen-lockfile --ignore-scripts
|
|
53
56
|
|
|
54
57
|
# Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
|
|
55
58
|
# These are not bundled by default to keep the base image lean. Enable at build time
|
|
56
59
|
# with: docker build --build-arg OTEL_ENABLED=true
|
|
57
60
|
ARG OTEL_ENABLED=true
|
|
58
|
-
RUN
|
|
61
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
62
|
+
if [ "$OTEL_ENABLED" = "true" ]; then \
|
|
59
63
|
bun add @hono/otel \
|
|
60
64
|
@opentelemetry/instrumentation-http \
|
|
61
65
|
@opentelemetry/exporter-metrics-otlp-http \
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<h1>@cyanheads/epa-mcp-server</h1>
|
|
3
|
-
<p><b>Access EPA environmental data — facility compliance (ECHO), toxic releases (TRI), Superfund sites, drinking water systems, and real-time air quality (AirNow) via MCP. STDIO or Streamable HTTP.</b>
|
|
4
|
-
<div>
|
|
3
|
+
<p><b>Access EPA environmental data — facility compliance (ECHO), toxic releases (TRI), Superfund sites, drinking water systems, environmental justice screening (EJScreen), and real-time air quality (AirNow) via MCP. STDIO or Streamable HTTP.</b>
|
|
4
|
+
<div>9 Tools • 2 Resources</div>
|
|
5
5
|
</p>
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/epa-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/epa-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
## Tools
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
9 tools spanning EPA facility compliance, toxic chemical releases, Superfund cleanup sites, drinking water safety, environmental justice screening, and real-time air quality:
|
|
27
27
|
|
|
28
28
|
| Tool | Description |
|
|
29
29
|
|:---|:---|
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
| `epa_search_tri_releases` | Search Toxic Release Inventory data across facilities in a state or county for a given year. Returns facility name, TRI ID, chemical name, total releases by medium, and facility coordinates. |
|
|
36
36
|
| `epa_search_superfund` | Search Superfund (CERCLA/SEMS) sites by location or NPL listing status. Accepts state/city/ZIP or lat/lng + radius for proximity searches. Returns site name, EPA ID, NPL status, cleanup status, and coordinates. |
|
|
37
37
|
| `epa_search_water_systems` | Search drinking water systems (SDWIS) by state or ZIP code. Returns system name, PWSID, population served, primary water source, and active violation status. |
|
|
38
|
+
| `epa_get_ejscreen` | Get EJScreen environmental-justice indicators for a point + buffer: 13 environmental and 6 demographic indicators with national/state percentiles, EJ Index values, and the demographic indices. Serves EJScreen v2.2 (2022) via the community-maintained EJAM API (Public Environmental Data Partners), which rehosts EJScreen after EPA discontinued public access in 2025. |
|
|
38
39
|
|
|
39
40
|
### `epa_search_facilities`
|
|
40
41
|
|
|
@@ -121,6 +122,18 @@ Identify drinking water systems with active or recent violations.
|
|
|
121
122
|
- `has_violation` flag surfaces only systems with current violations
|
|
122
123
|
- PWS type filter: community (`CWS`), non-transient non-community (`NTNCWS`), or transient non-community (`TNCWS`)
|
|
123
124
|
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### `epa_get_ejscreen`
|
|
128
|
+
|
|
129
|
+
Screen a point and its surrounding buffer for environmental-justice indicators.
|
|
130
|
+
|
|
131
|
+
- Input: `latitude`, `longitude`, `distance` (default 1), and `unit` (`miles` or `kilometers`); kilometers are converted to miles before the request, and the buffer is capped at 15 miles
|
|
132
|
+
- Returns the 13 EJScreen environmental indicators (PM2.5, ozone, diesel particulate, NO2, lead paint, traffic proximity, Superfund/RMP/hazardous-waste/wastewater proximity, underground storage tanks, drinking-water non-compliance, RSEI toxic air releases) and 6 demographic indicators (people of color, low income, limited English, less than high school, under 5, over 64)
|
|
133
|
+
- Each indicator carries national and state percentiles plus EJ Index values; the Demographic Index and Supplemental Demographic Index are included
|
|
134
|
+
- Points outside US coverage return a coverage note instead of fabricated indicators
|
|
135
|
+
- **Data source:** EJScreen v2.2 (2022) served via the community-maintained [EJAM API](https://api.ejanalysis.com) (Public Environmental Data Partners), which rehosts EJScreen after EPA discontinued public access in 2025 — not a live EPA endpoint
|
|
136
|
+
|
|
124
137
|
## Resources and prompts
|
|
125
138
|
|
|
126
139
|
| Type | Name | Description |
|
|
@@ -143,7 +156,7 @@ Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp
|
|
|
143
156
|
|
|
144
157
|
EPA-specific:
|
|
145
158
|
|
|
146
|
-
-
|
|
159
|
+
- Multiple environmental data sources unified behind a single `epa_` tool surface: ECHO (facility compliance), Envirofacts DMAP (TRI, Superfund, SDWIS), AirNow (real-time air quality), and the community-maintained EJAM API rehosting EJScreen environmental-justice data (v2.2, 2022)
|
|
147
160
|
- Parallel ECHO DFR aggregation in `epa_get_facility` — 3–5 upstream calls resolved concurrently with `Promise.allSettled`
|
|
148
161
|
- AirNow response caching (~1 hour TTL) to stay within per-key rate limits
|
|
149
162
|
- DMAP coordinate normalization — `tri.tri_facility` DDMMSS integers converted to decimal degrees
|
|
@@ -156,7 +169,7 @@ Agent-friendly output:
|
|
|
156
169
|
|
|
157
170
|
## Getting started
|
|
158
171
|
|
|
159
|
-
Add the following to your MCP client configuration file. An AirNow API key is optional — set `AIRNOW_API_KEY` to enable `epa_get_air_quality` (register free at [docs.airnowapi.org](https://docs.airnowapi.org/account/request/)); without it the server starts with the other
|
|
172
|
+
Add the following to your MCP client configuration file. An AirNow API key is optional — set `AIRNOW_API_KEY` to enable `epa_get_air_quality` (register free at [docs.airnowapi.org](https://docs.airnowapi.org/account/request/)); without it the server starts with the other 8 tools. ECHO, DMAP, and EJScreen tools work without authentication.
|
|
160
173
|
|
|
161
174
|
```json
|
|
162
175
|
{
|
|
@@ -204,7 +217,7 @@ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 AIRNOW_API_KEY=... bun run start:http
|
|
|
204
217
|
### Prerequisites
|
|
205
218
|
|
|
206
219
|
- [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).
|
|
207
|
-
- (Optional) An AirNow API key to enable `epa_get_air_quality` — register free at [docs.airnowapi.org/account/request](https://docs.airnowapi.org/account/request/). Without it the server runs the other
|
|
220
|
+
- (Optional) An AirNow API key to enable `epa_get_air_quality` — register free at [docs.airnowapi.org/account/request](https://docs.airnowapi.org/account/request/). Without it the server runs the other 8 tools. ECHO, DMAP, and EJScreen tools require no API key.
|
|
208
221
|
|
|
209
222
|
### Installation
|
|
210
223
|
|
|
@@ -239,10 +252,11 @@ All configuration is validated at startup via Zod schemas in `src/config/`. Key
|
|
|
239
252
|
|
|
240
253
|
| Variable | Description | Default |
|
|
241
254
|
|:---|:---|:---|
|
|
242
|
-
| `AIRNOW_API_KEY` | **Optional.** Enables `epa_get_air_quality` when set; the server runs the other
|
|
255
|
+
| `AIRNOW_API_KEY` | **Optional.** Enables `epa_get_air_quality` when set; the server runs the other 8 tools without it. Free registration at [docs.airnowapi.org](https://docs.airnowapi.org/account/request/). | — |
|
|
243
256
|
| `EPA_ECHO_BASE_URL` | ECHO API base URL | `https://echodata.epa.gov/echo` |
|
|
244
257
|
| `EPA_DMAP_BASE_URL` | Envirofacts DMAP API base URL | `https://data.epa.gov/dmapservice` |
|
|
245
258
|
| `EPA_AIRNOW_BASE_URL` | AirNow API base URL | `https://www.airnowapi.org/aq` |
|
|
259
|
+
| `EJSCREEN_API_BASE_URL` | **Optional.** EJScreen (EJAM) API base URL used by `epa_get_ejscreen`. | `https://api.ejanalysis.com` |
|
|
246
260
|
| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http` | `stdio` |
|
|
247
261
|
| `MCP_HTTP_PORT` | HTTP server port | `3010` |
|
|
248
262
|
| `MCP_HTTP_ENDPOINT_PATH` | HTTP endpoint path | `/mcp` |
|
|
@@ -293,11 +307,12 @@ The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `
|
|
|
293
307
|
|:---|:---|
|
|
294
308
|
| `src/index.ts` | `createApp()` entry point — registers tools/resources and inits services. |
|
|
295
309
|
| `src/config` | Server-specific environment variable parsing and validation with Zod. |
|
|
296
|
-
| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`).
|
|
310
|
+
| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`). Nine tools across ECHO, DMAP, EJAM, and AirNow. |
|
|
297
311
|
| `src/mcp-server/resources` | Resource definitions (`*.resource.ts`). Facility and Superfund URI handlers. |
|
|
298
312
|
| `src/services/echo` | ECHO REST API service layer — facility search, facility detail, enforcement cases. |
|
|
299
313
|
| `src/services/dmap` | Envirofacts DMAP service layer — TRI releases, Superfund sites, drinking water systems. |
|
|
300
314
|
| `src/services/airnow` | AirNow service layer — current and forecast AQI observations. |
|
|
315
|
+
| `src/services/ejscreen` | EJScreen (EJAM) service layer — environmental-justice indicators for a point + buffer. |
|
|
301
316
|
| `tests/` | Unit and integration tests mirroring `src/`. |
|
|
302
317
|
|
|
303
318
|
## Development guide
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Per-medium TRI release breakdown on epa_get_tri_releases, ECHO proximity search radius fix, and mcp-ts-core 0.10.14 adoption clearing 9 dependency advisories"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.2.1 — 2026-07-10
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`epa_get_tri_releases` per-medium release breakdown** — four new optional fields on each release record: `releasesToAirInLbs`, `releasesToWaterInLbs`, `releasesToLandInLbs`, `releasesToUndergroundInjectionInLbs`, summed from a new batched `tri.tri_release_qty` query joined on `doc_ctrl_num`. Completes the four-way media split the README already documented. ([#15](https://github.com/cyanheads/epa-mcp-server/issues/15))
|
|
12
|
+
|
|
13
|
+
## Changed
|
|
14
|
+
|
|
15
|
+
- **`totalReleasesInLbs` description** clarified as TRI's one-time / non-routine release quantity (spills, accidents) — a distinct category from the new routine per-medium fields, not their sum. Value and field name unchanged.
|
|
16
|
+
- **Supply-chain hardening** — `bunfig.toml` blocks packages published <3 days ago (`minimumReleaseAge`, `@cyanheads/mcp-ts-core` exempted for same-day framework adoption) and scans installs via `@socketsecurity/bun-security-scanner`; new `LICENSE` (Apache-2.0), `.github/SECURITY.md`, `.gitattributes`; `Dockerfile` pins `oven/bun:1.3.14` (was floating `1.3`), adds BuildKit cache mounts, and runs `--ignore-scripts` on the build stage.
|
|
17
|
+
- **`devcheck`** adds a `check-dependency-specifiers.ts` step (rejects floating `latest` / `*` / dist-tag dependency specifiers) and extends packaging-lint to cover plugin marketplace manifests; framework skills re-synced to `.claude/skills/`.
|
|
18
|
+
|
|
19
|
+
## Fixed
|
|
20
|
+
|
|
21
|
+
- **`epa_search_facilities` proximity search** — ECHO requests now send `p_radius` instead of the unrecognized `p_radius_mi`, so `latitude` + `longitude` + `radius_miles` queries return facilities instead of ECHO's "p_radius required" error. ([#16](https://github.com/cyanheads/epa-mcp-server/issues/16))
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
- **`@cyanheads/mcp-ts-core`** `^0.10.6` → `^0.10.14` — clears 9 transitive advisories (2 high, 6 moderate, 1 low); `bun audit` now reports zero:
|
|
26
|
+
- `hono` <4.12.25 → 4.12.29 — high [GHSA-88fw-hqm2-52qc](https://github.com/advisories/GHSA-88fw-hqm2-52qc) (CORS middleware reflects any Origin with credentials), moderate [GHSA-wwfh-h76j-fc44](https://github.com/advisories/GHSA-wwfh-h76j-fc44), [GHSA-j6c9-x7qj-28xf](https://github.com/advisories/GHSA-j6c9-x7qj-28xf), [GHSA-rv63-4mwf-qqc2](https://github.com/advisories/GHSA-rv63-4mwf-qqc2), [GHSA-wgpf-jwqj-8h8p](https://github.com/advisories/GHSA-wgpf-jwqj-8h8p)
|
|
27
|
+
- `vite` 8.0.14 → 8.1.4 — high [GHSA-fx2h-pf6j-xcff](https://github.com/advisories/GHSA-fx2h-pf6j-xcff) (`server.fs.deny` bypass on Windows), moderate [GHSA-v6wh-96g9-6wx3](https://github.com/advisories/GHSA-v6wh-96g9-6wx3)
|
|
28
|
+
- `js-yaml` 3.14.2 → 3.15.0 — moderate [GHSA-h67p-54hq-rp68](https://github.com/advisories/GHSA-h67p-54hq-rp68) (quadratic-complexity DoS in merge-key handling)
|
|
29
|
+
- `esbuild` 0.28.0 — no longer resolved (was a transitive dep of `tsx`, dropped from the tree); clears low [GHSA-g7r4-m6w7-qqqr](https://github.com/advisories/GHSA-g7r4-m6w7-qqqr)
|
|
30
|
+
- `@biomejs/biome` `^2.5.0` → `^2.5.2`
|
|
31
|
+
- Added `@socketsecurity/bun-security-scanner` `^1.1.2` (dev) — the install-time scanner wired into `bunfig.toml` above
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "New epa_get_ejscreen tool: EJScreen environmental-justice indicators (13 environmental + 6 demographic, each with national/state percentiles and EJ Index) for a point + buffer, served via the community-maintained EJAM API rehosting EJScreen v2.2 (2022)."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.3.0 — 2026-07-10
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`epa_get_ejscreen`** — tool returning EJScreen environmental-justice indicators for a point and surrounding buffer (default 1 mile, capped at 15). Reports the 13 environmental indicators (PM2.5, ozone, diesel particulate, NO2, lead paint, traffic proximity, Superfund/RMP/hazardous-waste/wastewater proximity, underground storage tanks, drinking-water non-compliance, RSEI toxic air releases) and 6 demographic indicators (people of color, low income, limited English, less than high school, under 5, over 64), each with national and state percentiles plus EJ Index values, along with the Demographic Index and Supplemental Demographic Index. Points outside US coverage return a coverage note instead of fabricated indicators. ([#12](https://github.com/cyanheads/epa-mcp-server/issues/12))
|
|
12
|
+
- **`src/services/ejscreen/`** — service wrapping the community-maintained EJAM API (`api.ejanalysis.com`, Public Environmental Data Partners), which rehosts EJScreen v2.2 (2022) after EPA discontinued public access in 2025. Keyless; not a live EPA endpoint.
|
|
13
|
+
- **`EJSCREEN_API_BASE_URL`** — optional environment variable overriding the EJScreen (EJAM) API base URL (default `https://api.ejanalysis.com`); wired into `server.json` and `manifest.json`.
|
|
@@ -8,6 +8,7 @@ declare const ServerConfigSchema: z.ZodObject<{
|
|
|
8
8
|
echoBaseUrl: z.ZodDefault<z.ZodString>;
|
|
9
9
|
dmapBaseUrl: z.ZodDefault<z.ZodString>;
|
|
10
10
|
airNowBaseUrl: z.ZodDefault<z.ZodString>;
|
|
11
|
+
ejscreenBaseUrl: z.ZodPreprocess<z.ZodDefault<z.ZodString>>;
|
|
11
12
|
}, z.core.$strip>;
|
|
12
13
|
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
13
14
|
export declare function getServerConfig(): ServerConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,QAAA,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,QAAA,MAAM,kBAAkB;;;;;;iBAoCtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,wBAAgB,eAAe,IAAI,YAAY,CAS9C"}
|
|
@@ -26,6 +26,12 @@ const ServerConfigSchema = z.object({
|
|
|
26
26
|
.url()
|
|
27
27
|
.default('https://www.airnowapi.org/aq')
|
|
28
28
|
.describe('AirNow API base URL'),
|
|
29
|
+
// Optional override. Bundle/compose configs may inject an unfilled
|
|
30
|
+
// `${EJSCREEN_API_BASE_URL}` placeholder as an empty string — treat empty or
|
|
31
|
+
// whitespace-only as absent so the default applies instead of failing `.url()`.
|
|
32
|
+
ejscreenBaseUrl: z
|
|
33
|
+
.preprocess((v) => (typeof v === 'string' && v.trim() === '' ? undefined : v), z.string().url().default('https://api.ejanalysis.com'))
|
|
34
|
+
.describe('EJScreen (EJAM) API base URL — the community-maintained EJScreen rehost'),
|
|
29
35
|
});
|
|
30
36
|
let _config;
|
|
31
37
|
export function getServerConfig() {
|
|
@@ -34,6 +40,7 @@ export function getServerConfig() {
|
|
|
34
40
|
echoBaseUrl: 'EPA_ECHO_BASE_URL',
|
|
35
41
|
dmapBaseUrl: 'EPA_DMAP_BASE_URL',
|
|
36
42
|
airNowBaseUrl: 'EPA_AIRNOW_BASE_URL',
|
|
43
|
+
ejscreenBaseUrl: 'EJSCREEN_API_BASE_URL',
|
|
37
44
|
});
|
|
38
45
|
return _config;
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,oFAAoF;IACpF,qFAAqF;IACrF,uFAAuF;IACvF,YAAY,EAAE,CAAC;SACZ,UAAU,CACT,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACjE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAC7B;SACA,QAAQ,CACP,4JAA4J,CAC7J;IACH,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,+BAA+B,CAAC;SACxC,QAAQ,CAAC,mBAAmB,CAAC;IAChC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,kCAAkC,CAAC;SAC3C,QAAQ,CAAC,mBAAmB,CAAC;IAChC,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,8BAA8B,CAAC;SACvC,QAAQ,CAAC,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,oFAAoF;IACpF,qFAAqF;IACrF,uFAAuF;IACvF,YAAY,EAAE,CAAC;SACZ,UAAU,CACT,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACjE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAC7B;SACA,QAAQ,CACP,4JAA4J,CAC7J;IACH,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,+BAA+B,CAAC;SACxC,QAAQ,CAAC,mBAAmB,CAAC;IAChC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,kCAAkC,CAAC;SAC3C,QAAQ,CAAC,mBAAmB,CAAC;IAChC,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,8BAA8B,CAAC;SACvC,QAAQ,CAAC,qBAAqB,CAAC;IAClC,mEAAmE;IACnE,6EAA6E;IAC7E,gFAAgF;IAChF,eAAe,EAAE,CAAC;SACf,UAAU,CACT,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACjE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC,CACvD;SACA,QAAQ,CAAC,yEAAyE,CAAC;CACvF,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,YAAY,EAAE,gBAAgB;QAC9B,WAAW,EAAE,mBAAmB;QAChC,WAAW,EAAE,mBAAmB;QAChC,aAAa,EAAE,qBAAqB;QACpC,eAAe,EAAE,uBAAuB;KACzC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,21 +10,23 @@ import { allToolDefinitions, coreToolDefinitions } from './mcp-server/tools/defi
|
|
|
10
10
|
import { initAirNowService } from './services/airnow/airnow-service.js';
|
|
11
11
|
import { initDmapService } from './services/dmap/dmap-service.js';
|
|
12
12
|
import { initEchoService } from './services/echo/echo-service.js';
|
|
13
|
+
import { initEjscreenService } from './services/ejscreen/ejscreen-service.js';
|
|
13
14
|
// AirNow is the only key-gated service. When AIRNOW_API_KEY is absent the server
|
|
14
|
-
// starts without epa_get_air_quality, leaving the
|
|
15
|
+
// starts without epa_get_air_quality, leaving the 8 keyless tools available.
|
|
15
16
|
const airNowEnabled = getServerConfig().airNowApiKey !== undefined;
|
|
16
17
|
/** Server instructions, omitting AirNow guidance when the air quality tool is disabled. */
|
|
17
18
|
function buildInstructions() {
|
|
18
19
|
const lines = [
|
|
19
|
-
`EPA environmental data server covering facility compliance (ECHO), toxic releases (TRI), Superfund sites, drinking water systems (SDWIS)${airNowEnabled ? ', and real-time air quality (AirNow)' : ''}.`,
|
|
20
|
-
'- All tools are read-only.
|
|
20
|
+
`EPA environmental data server covering facility compliance (ECHO), toxic releases (TRI), Superfund sites, drinking water systems (SDWIS), environmental-justice screening (EJScreen)${airNowEnabled ? ', and real-time air quality (AirNow)' : ''}.`,
|
|
21
|
+
'- All tools are read-only. Most APIs are US federal government public domain data.',
|
|
21
22
|
'- ECHO tools require at least one geographic filter (zip_code, state, or city) — unscoped searches time out. epa_search_facilities also accepts latitude + longitude + radius_miles for proximity search.',
|
|
22
23
|
'- TRI data lags ~18 months — most recent available year is typically 2 years prior to current.',
|
|
24
|
+
'- epa_get_ejscreen serves EJScreen v2.2 (2022) via the community-maintained EJAM API (Public Environmental Data Partners), which rehosts EJScreen after EPA discontinued public access in 2025 — not a live EPA endpoint; US coverage only.',
|
|
23
25
|
];
|
|
24
26
|
if (airNowEnabled) {
|
|
25
27
|
lines.push('- AirNow data is preliminary and not valid for regulatory, trend, or enforcement purposes.');
|
|
26
28
|
}
|
|
27
|
-
lines.push('- Typical workflows: epa_search_facilities → epa_get_facility → epa_search_violations (compliance audit); epa_search_superfund (proximity); epa_search_water_systems + has_violation=true (drinking water safety).');
|
|
29
|
+
lines.push('- Typical workflows: epa_search_facilities → epa_get_facility → epa_search_violations (compliance audit); epa_search_superfund (proximity); epa_search_water_systems + has_violation=true (drinking water safety); epa_get_ejscreen (environmental-justice indicators for a point + buffer).');
|
|
28
30
|
return lines.join('\n');
|
|
29
31
|
}
|
|
30
32
|
await createApp({
|
|
@@ -37,6 +39,7 @@ await createApp({
|
|
|
37
39
|
setup(core) {
|
|
38
40
|
initEchoService(core.config, core.storage);
|
|
39
41
|
initDmapService(core.config, core.storage);
|
|
42
|
+
initEjscreenService(core.config, core.storage);
|
|
40
43
|
if (airNowEnabled)
|
|
41
44
|
initAirNowService(core.config, core.storage);
|
|
42
45
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAE9E,iFAAiF;AACjF,6EAA6E;AAC7E,MAAM,aAAa,GAAG,eAAe,EAAE,CAAC,YAAY,KAAK,SAAS,CAAC;AAEnE,2FAA2F;AAC3F,SAAS,iBAAiB;IACxB,MAAM,KAAK,GAAG;QACZ,uLAAuL,aAAa,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,EAAE,GAAG;QACrP,oFAAoF;QACpF,2MAA2M;QAC3M,gGAAgG;QAChG,6OAA6O;KAC9O,CAAC;IACF,IAAI,aAAa,EAAE,CAAC;QAClB,KAAK,CAAC,IAAI,CACR,4FAA4F,CAC7F,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,IAAI,CACR,8RAA8R,CAC/R,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,SAAS,CAAC;IACd,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,gBAAgB;IACvB,KAAK,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;IACtE,SAAS,EAAE,CAAC,GAAG,sBAAsB,CAAC;IACtC,OAAO,EAAE,EAAE;IACX,YAAY,EAAE,iBAAiB,EAAE;IACjC,KAAK,CAAC,IAAI;QACR,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,aAAa;YAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-air-quality.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-air-quality.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"get-air-quality.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-air-quality.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwO5B,CAAC"}
|
|
@@ -100,19 +100,29 @@ export const getAirQualityTool = tool('epa_get_air_quality', {
|
|
|
100
100
|
},
|
|
101
101
|
],
|
|
102
102
|
async handler(input, ctx) {
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
// Resolve the location once into a discriminated shape so the service branches below
|
|
104
|
+
// narrow without non-null assertions. Zip takes precedence over lat/lng, and the raw
|
|
105
|
+
// (untrimmed) zip_code is forwarded to match prior behavior.
|
|
106
|
+
const zip = input.zip_code;
|
|
107
|
+
const loc = zip !== undefined && zip.trim() !== ''
|
|
108
|
+
? { kind: 'zip', zipCode: zip }
|
|
109
|
+
: input.latitude !== undefined && input.longitude !== undefined
|
|
110
|
+
? { kind: 'latlng', latitude: input.latitude, longitude: input.longitude }
|
|
111
|
+
: undefined;
|
|
112
|
+
if (!loc) {
|
|
107
113
|
throw ctx.fail('no_location', 'Provide either zip_code or both latitude and longitude.', {
|
|
108
114
|
...ctx.recoveryFor('no_location'),
|
|
109
115
|
});
|
|
110
116
|
}
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
// forecast mode requires a date — validate up front so the error path is unchanged.
|
|
118
|
+
let forecastDate = '';
|
|
119
|
+
if (input.mode === 'forecast') {
|
|
120
|
+
if (input.forecast_date === undefined || input.forecast_date.trim() === '') {
|
|
121
|
+
throw ctx.fail('forecast_date_required', 'forecast_date (YYYY-MM-DD) is required when mode is "forecast".', {
|
|
122
|
+
...ctx.recoveryFor('forecast_date_required'),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
forecastDate = input.forecast_date;
|
|
116
126
|
}
|
|
117
127
|
ctx.log.info('epa_get_air_quality', {
|
|
118
128
|
mode: input.mode,
|
|
@@ -122,37 +132,29 @@ export const getAirQualityTool = tool('epa_get_air_quality', {
|
|
|
122
132
|
const service = getAirNowService();
|
|
123
133
|
let observations;
|
|
124
134
|
if (input.mode === 'current') {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, ctx);
|
|
134
|
-
}
|
|
135
|
+
observations =
|
|
136
|
+
loc.kind === 'zip'
|
|
137
|
+
? await service.getCurrentByZip({ zipCode: loc.zipCode, distanceMiles: input.distance_miles }, ctx)
|
|
138
|
+
: await service.getCurrentByLatLng({
|
|
139
|
+
latitude: loc.latitude,
|
|
140
|
+
longitude: loc.longitude,
|
|
141
|
+
distanceMiles: input.distance_miles,
|
|
142
|
+
}, ctx);
|
|
135
143
|
}
|
|
136
144
|
else {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
zipCode: input.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
latitude: input.latitude,
|
|
147
|
-
longitude: input.longitude,
|
|
148
|
-
date: input.forecast_date,
|
|
149
|
-
distanceMiles: input.distance_miles,
|
|
150
|
-
}, ctx);
|
|
151
|
-
}
|
|
145
|
+
observations =
|
|
146
|
+
loc.kind === 'zip'
|
|
147
|
+
? await service.getForecastByZip({ zipCode: loc.zipCode, date: forecastDate, distanceMiles: input.distance_miles }, ctx)
|
|
148
|
+
: await service.getForecastByLatLng({
|
|
149
|
+
latitude: loc.latitude,
|
|
150
|
+
longitude: loc.longitude,
|
|
151
|
+
date: forecastDate,
|
|
152
|
+
distanceMiles: input.distance_miles,
|
|
153
|
+
}, ctx);
|
|
152
154
|
}
|
|
153
155
|
ctx.log.info('epa_get_air_quality completed', { areas: observations.length });
|
|
154
156
|
if (observations.length === 0) {
|
|
155
|
-
const location =
|
|
157
|
+
const location = loc.kind === 'zip'
|
|
156
158
|
? `zip_code="${input.zip_code}"`
|
|
157
159
|
: `lat=${input.latitude}, lng=${input.longitude}`;
|
|
158
160
|
return {
|