@pipeworx/mcp-noaa 0.1.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/LICENSE +21 -0
- package/README.md +35 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +250 -0
- package/tsconfig.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pipeworx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# mcp-noaa
|
|
2
|
+
|
|
3
|
+
NOAA Weather MCP — National Weather Service forecasts and alerts
|
|
4
|
+
|
|
5
|
+
Part of the [Pipeworx](https://pipeworx.io) open MCP gateway.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `get_stations` | List weather observation stations for a US state. |
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Add to your MCP client config:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"noaa": {
|
|
21
|
+
"url": "https://gateway.pipeworx.io/noaa/mcp"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or use the CLI:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx pipeworx use noaa
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-noaa",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "NOAA Weather MCP — National Weather Service forecasts and alerts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "noaa"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-noaa"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.7.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pipeworx-io/noaa",
|
|
4
|
+
"title": "noaa",
|
|
5
|
+
"description": "NOAA Weather MCP — National Weather Service forecasts and alerts",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/noaa",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-noaa",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/noaa/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
interface McpToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface McpToolExport {
|
|
12
|
+
tools: McpToolDefinition[];
|
|
13
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* NOAA Weather MCP — National Weather Service forecasts and alerts
|
|
18
|
+
*
|
|
19
|
+
* Tools:
|
|
20
|
+
* - get_forecast: Get a multi-day weather forecast for a lat/lon location
|
|
21
|
+
* - get_alerts: Get active weather alerts for a US state
|
|
22
|
+
* - get_stations: List weather observation stations for a US state
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const BASE = 'https://api.weather.gov';
|
|
27
|
+
const USER_AGENT = 'pipeworx-mcp/1.0 (https://pipeworx.io)';
|
|
28
|
+
|
|
29
|
+
const tools: McpToolExport['tools'] = [
|
|
30
|
+
{
|
|
31
|
+
name: 'get_forecast',
|
|
32
|
+
description:
|
|
33
|
+
'Get a multi-day weather forecast for a latitude/longitude location using the National Weather Service.',
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
lat: {
|
|
38
|
+
type: 'number',
|
|
39
|
+
description: 'Latitude of the location (e.g. 37.7749)',
|
|
40
|
+
},
|
|
41
|
+
lon: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
description: 'Longitude of the location (e.g. -122.4194)',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
required: ['lat', 'lon'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'get_alerts',
|
|
51
|
+
description:
|
|
52
|
+
'Get currently active weather alerts for a US state (e.g. CA, NY, TX).',
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
state: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'Two-letter US state code (e.g. "CA", "NY")',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ['state'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'get_stations',
|
|
66
|
+
description: 'List weather observation stations for a US state.',
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: {
|
|
70
|
+
state: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: 'Two-letter US state code (e.g. "CA", "NY")',
|
|
73
|
+
},
|
|
74
|
+
limit: {
|
|
75
|
+
type: 'number',
|
|
76
|
+
description: 'Maximum number of stations to return (default: 20)',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
required: ['state'],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
interface NwsPointsResponse {
|
|
85
|
+
properties: {
|
|
86
|
+
forecast: string;
|
|
87
|
+
forecastHourly: string;
|
|
88
|
+
relativeLocation?: {
|
|
89
|
+
properties?: {
|
|
90
|
+
city?: string;
|
|
91
|
+
state?: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface NwsForecastPeriod {
|
|
98
|
+
name: string;
|
|
99
|
+
startTime: string;
|
|
100
|
+
endTime: string;
|
|
101
|
+
isDaytime: boolean;
|
|
102
|
+
temperature: number;
|
|
103
|
+
temperatureUnit: string;
|
|
104
|
+
windSpeed: string;
|
|
105
|
+
windDirection: string;
|
|
106
|
+
shortForecast: string;
|
|
107
|
+
detailedForecast: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface NwsForecastResponse {
|
|
111
|
+
properties: {
|
|
112
|
+
periods: NwsForecastPeriod[];
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface NwsAlertFeature {
|
|
117
|
+
properties: {
|
|
118
|
+
id: string;
|
|
119
|
+
event: string;
|
|
120
|
+
headline?: string;
|
|
121
|
+
description?: string;
|
|
122
|
+
severity: string;
|
|
123
|
+
urgency: string;
|
|
124
|
+
certainty: string;
|
|
125
|
+
effective: string;
|
|
126
|
+
expires: string;
|
|
127
|
+
areaDesc?: string;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface NwsAlertsResponse {
|
|
132
|
+
features: NwsAlertFeature[];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface NwsStationFeature {
|
|
136
|
+
properties: {
|
|
137
|
+
stationIdentifier: string;
|
|
138
|
+
name: string;
|
|
139
|
+
timeZone?: string;
|
|
140
|
+
};
|
|
141
|
+
geometry?: {
|
|
142
|
+
coordinates?: [number, number];
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface NwsStationsResponse {
|
|
147
|
+
features: NwsStationFeature[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
151
|
+
const headers = { 'User-Agent': USER_AGENT, Accept: 'application/geo+json' };
|
|
152
|
+
|
|
153
|
+
switch (name) {
|
|
154
|
+
case 'get_forecast': {
|
|
155
|
+
const lat = args.lat as number;
|
|
156
|
+
const lon = args.lon as number;
|
|
157
|
+
|
|
158
|
+
// Step 1: resolve the grid point
|
|
159
|
+
const pointRes = await fetch(`${BASE}/points/${lat},${lon}`, { headers });
|
|
160
|
+
if (!pointRes.ok) {
|
|
161
|
+
throw new Error(`NWS points lookup failed: ${pointRes.status} — coordinates may be outside the US`);
|
|
162
|
+
}
|
|
163
|
+
const pointData = (await pointRes.json()) as NwsPointsResponse;
|
|
164
|
+
const forecastUrl = pointData.properties.forecast;
|
|
165
|
+
const location = pointData.properties.relativeLocation?.properties;
|
|
166
|
+
|
|
167
|
+
// Step 2: fetch the forecast
|
|
168
|
+
const forecastRes = await fetch(forecastUrl, { headers });
|
|
169
|
+
if (!forecastRes.ok) throw new Error(`NWS forecast fetch failed: ${forecastRes.status}`);
|
|
170
|
+
const forecastData = (await forecastRes.json()) as NwsForecastResponse;
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
location: {
|
|
174
|
+
lat,
|
|
175
|
+
lon,
|
|
176
|
+
city: location?.city ?? null,
|
|
177
|
+
state: location?.state ?? null,
|
|
178
|
+
},
|
|
179
|
+
periods: forecastData.properties.periods.map((p) => ({
|
|
180
|
+
name: p.name,
|
|
181
|
+
start_time: p.startTime,
|
|
182
|
+
end_time: p.endTime,
|
|
183
|
+
is_daytime: p.isDaytime,
|
|
184
|
+
temperature: p.temperature,
|
|
185
|
+
temperature_unit: p.temperatureUnit,
|
|
186
|
+
wind_speed: p.windSpeed,
|
|
187
|
+
wind_direction: p.windDirection,
|
|
188
|
+
short_forecast: p.shortForecast,
|
|
189
|
+
detailed_forecast: p.detailedForecast,
|
|
190
|
+
})),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
case 'get_alerts': {
|
|
195
|
+
const state = (args.state as string).toUpperCase();
|
|
196
|
+
|
|
197
|
+
const params = new URLSearchParams({ area: state });
|
|
198
|
+
const res = await fetch(`${BASE}/alerts/active?${params}`, { headers });
|
|
199
|
+
if (!res.ok) throw new Error(`NWS alerts error: ${res.status}`);
|
|
200
|
+
|
|
201
|
+
const data = (await res.json()) as NwsAlertsResponse;
|
|
202
|
+
|
|
203
|
+
return {
|
|
204
|
+
state,
|
|
205
|
+
count: data.features.length,
|
|
206
|
+
alerts: data.features.map((f) => ({
|
|
207
|
+
id: f.properties.id,
|
|
208
|
+
event: f.properties.event,
|
|
209
|
+
headline: f.properties.headline ?? null,
|
|
210
|
+
severity: f.properties.severity,
|
|
211
|
+
urgency: f.properties.urgency,
|
|
212
|
+
certainty: f.properties.certainty,
|
|
213
|
+
effective: f.properties.effective,
|
|
214
|
+
expires: f.properties.expires,
|
|
215
|
+
area: f.properties.areaDesc ?? null,
|
|
216
|
+
description: f.properties.description ?? null,
|
|
217
|
+
})),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
case 'get_stations': {
|
|
222
|
+
const state = (args.state as string).toUpperCase();
|
|
223
|
+
const limit = Math.max(1, Math.min(500, (args.limit as number) ?? 20));
|
|
224
|
+
|
|
225
|
+
const params = new URLSearchParams({ state, limit: String(limit) });
|
|
226
|
+
const res = await fetch(`${BASE}/stations?${params}`, { headers });
|
|
227
|
+
if (!res.ok) throw new Error(`NWS stations error: ${res.status}`);
|
|
228
|
+
|
|
229
|
+
const data = (await res.json()) as NwsStationsResponse;
|
|
230
|
+
|
|
231
|
+
return {
|
|
232
|
+
state,
|
|
233
|
+
count: data.features.length,
|
|
234
|
+
stations: data.features.map((f) => ({
|
|
235
|
+
id: f.properties.stationIdentifier,
|
|
236
|
+
name: f.properties.name,
|
|
237
|
+
time_zone: f.properties.timeZone ?? null,
|
|
238
|
+
coordinates: f.geometry?.coordinates
|
|
239
|
+
? { lon: f.geometry.coordinates[0], lat: f.geometry.coordinates[1] }
|
|
240
|
+
: null,
|
|
241
|
+
})),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
default:
|
|
246
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export default { tools, callTool } satisfies McpToolExport;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|