mcp-server-environment-agency 1.0.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/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +857 -0
- package/build/index.js.map +1 -0
- package/eslint.json +19 -0
- package/gitignore.txt +89 -0
- package/license.txt +21 -0
- package/local-testing-guide.md +224 -0
- package/package.json +55 -0
- package/prettier.json +8 -0
- package/readme-md.md +243 -0
- package/src/index.ts +1029 -0
- package/test-script.js +91 -0
- package/tsconfig.json +21 -0
package/readme-md.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Environment Agency Flood Monitoring MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server that provides access to the UK Environment Agency's Real Time Flood Monitoring API. This server allows you to access near real-time flood warnings, water level measurements, flow data, and monitoring station information.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Flood Warnings & Alerts**: Get current flood warnings and alerts with severity levels
|
|
8
|
+
- **Flood Areas**: Access information about flood alert and warning areas
|
|
9
|
+
- **Monitoring Stations**: Find water level and flow monitoring stations across the UK
|
|
10
|
+
- **Real-time Measurements**: Access water levels, flows, and other measurements updated every 15 minutes
|
|
11
|
+
- **Historical Data**: Retrieve historical readings and measurements
|
|
12
|
+
- **Geographic Filtering**: Filter data by location using latitude, longitude, and distance
|
|
13
|
+
- **No API Key Required**: Uses open government data with no registration needed
|
|
14
|
+
|
|
15
|
+
## Data Attribution
|
|
16
|
+
|
|
17
|
+
This server uses Environment Agency flood and river level data from the real-time data API (Beta), provided under the Open Government Licence.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g mcp-server-environment-agency
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
### Claude Desktop Configuration
|
|
28
|
+
|
|
29
|
+
Add this to your Claude Desktop configuration file:
|
|
30
|
+
|
|
31
|
+
#### macOS
|
|
32
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
33
|
+
|
|
34
|
+
#### Windows
|
|
35
|
+
`%APPDATA%/Claude/claude_desktop_config.json`
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"environment-agency": {
|
|
41
|
+
"command": "npx",
|
|
42
|
+
"args": ["-y", "mcp-server-environment-agency"]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Available Tools
|
|
49
|
+
|
|
50
|
+
### Flood Warning Tools
|
|
51
|
+
|
|
52
|
+
- **get_flood_warnings**: Get current flood warnings and alerts
|
|
53
|
+
- **get_flood_warning**: Get details of a specific flood warning
|
|
54
|
+
- **get_flood_areas**: Get flood areas (regions where warnings may apply)
|
|
55
|
+
- **get_flood_area**: Get details of a specific flood area
|
|
56
|
+
|
|
57
|
+
### Monitoring Station Tools
|
|
58
|
+
|
|
59
|
+
- **get_monitoring_stations**: Get monitoring stations that measure water levels, flows, etc.
|
|
60
|
+
- **get_monitoring_station**: Get detailed information about a specific monitoring station
|
|
61
|
+
- **get_measures**: Get measurement types available across all stations
|
|
62
|
+
- **get_station_measures**: Get all measurement types from a specific station
|
|
63
|
+
|
|
64
|
+
### Reading Tools
|
|
65
|
+
|
|
66
|
+
- **get_readings**: Get measurement readings from all stations
|
|
67
|
+
- **get_measure_readings**: Get readings for a specific measurement type
|
|
68
|
+
- **get_station_readings**: Get all readings from a specific monitoring station
|
|
69
|
+
|
|
70
|
+
## Usage Examples
|
|
71
|
+
|
|
72
|
+
### Get Current Flood Warnings
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// Get all current flood warnings
|
|
76
|
+
get_flood_warnings({})
|
|
77
|
+
|
|
78
|
+
// Get severe flood warnings only
|
|
79
|
+
get_flood_warnings({
|
|
80
|
+
min_severity: 1
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// Get flood warnings in Somerset
|
|
84
|
+
get_flood_warnings({
|
|
85
|
+
county: "Somerset"
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// Get flood warnings near a location
|
|
89
|
+
get_flood_warnings({
|
|
90
|
+
lat: 51.5074,
|
|
91
|
+
long: -0.1278,
|
|
92
|
+
dist: 10
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Find Monitoring Stations
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
// Find all stations measuring water levels
|
|
100
|
+
get_monitoring_stations({
|
|
101
|
+
parameter: "level"
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
// Find stations near London
|
|
105
|
+
get_monitoring_stations({
|
|
106
|
+
lat: 51.5074,
|
|
107
|
+
long: -0.1278,
|
|
108
|
+
dist: 25
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
// Search for stations on River Thames
|
|
112
|
+
get_monitoring_stations({
|
|
113
|
+
search: "River Thames"
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// Find groundwater monitoring stations
|
|
117
|
+
get_monitoring_stations({
|
|
118
|
+
qualifier: "Groundwater"
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Get Real-time Data
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// Get latest readings from all stations
|
|
126
|
+
get_readings({
|
|
127
|
+
latest: true,
|
|
128
|
+
limit: 100
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
// Get latest flow readings
|
|
132
|
+
get_readings({
|
|
133
|
+
latest: true,
|
|
134
|
+
parameter: "flow"
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
// Get today's readings from a specific station
|
|
138
|
+
get_station_readings({
|
|
139
|
+
station_id: "1491TH",
|
|
140
|
+
today: true
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
// Get readings from the last week
|
|
144
|
+
get_readings({
|
|
145
|
+
startdate: "2024-01-01",
|
|
146
|
+
enddate: "2024-01-07",
|
|
147
|
+
parameter: "level"
|
|
148
|
+
})
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Data Types and Severity Levels
|
|
152
|
+
|
|
153
|
+
### Flood Warning Severity Levels
|
|
154
|
+
|
|
155
|
+
1. **Severe Flood Warning**: Severe Flooding, Danger to Life
|
|
156
|
+
2. **Flood Warning**: Flooding is Expected, Immediate Action Required
|
|
157
|
+
3. **Flood Alert**: Flooding is Possible, Be Prepared
|
|
158
|
+
4. **Warning no Longer in Force**: The warning is no longer in force
|
|
159
|
+
|
|
160
|
+
### Measurement Parameters
|
|
161
|
+
|
|
162
|
+
- **Water Level** (`level`): Water levels at monitoring stations
|
|
163
|
+
- **Flow** (`flow`): Water flow rates
|
|
164
|
+
- **Temperature** (`temperature`): Air temperature
|
|
165
|
+
- **Wind** (`wind`): Wind direction and speed
|
|
166
|
+
|
|
167
|
+
### Station Types
|
|
168
|
+
|
|
169
|
+
- **SingleLevel**: Single water level measurement
|
|
170
|
+
- **MultiTraceLevel**: Multiple level measurements
|
|
171
|
+
- **Coastal**: Coastal monitoring stations
|
|
172
|
+
- **Groundwater**: Groundwater level monitoring
|
|
173
|
+
- **Meteorological**: Weather measurements
|
|
174
|
+
|
|
175
|
+
## API Updates and Reliability
|
|
176
|
+
|
|
177
|
+
- Data is updated every 15 minutes
|
|
178
|
+
- The API may redirect during high load - the client follows redirects automatically
|
|
179
|
+
- Responses may be cached for short periods
|
|
180
|
+
- No service level guarantee - not suitable for safety-critical applications
|
|
181
|
+
|
|
182
|
+
## Rate Limits and Best Practices
|
|
183
|
+
|
|
184
|
+
- For tracking all measurements, use a single call every 15 minutes: `get_readings({ latest: true })`
|
|
185
|
+
- Use geographic and parameter filters to reduce response sizes
|
|
186
|
+
- The API has built-in limits: default 500 items, maximum 10,000 for readings
|
|
187
|
+
- Use pagination with `limit` and `offset` parameters for large datasets
|
|
188
|
+
|
|
189
|
+
## Examples of Common Use Cases
|
|
190
|
+
|
|
191
|
+
### Monitor Flood Risk in an Area
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
// 1. Get current warnings
|
|
195
|
+
const warnings = get_flood_warnings({
|
|
196
|
+
county: "Yorkshire",
|
|
197
|
+
min_severity: 3
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// 2. Find nearby monitoring stations
|
|
201
|
+
const stations = get_monitoring_stations({
|
|
202
|
+
lat: 53.8008,
|
|
203
|
+
long: -1.5491,
|
|
204
|
+
dist: 20,
|
|
205
|
+
parameter: "level"
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// 3. Get latest readings
|
|
209
|
+
const readings = get_readings({
|
|
210
|
+
latest: true,
|
|
211
|
+
lat: 53.8008,
|
|
212
|
+
long: -1.5491,
|
|
213
|
+
dist: 20
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Track a Specific River
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
// Find stations on River Severn
|
|
221
|
+
const stations = get_monitoring_stations({
|
|
222
|
+
river_name: "Severn"
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// Get latest readings from all Severn stations
|
|
226
|
+
const readings = get_readings({
|
|
227
|
+
latest: true,
|
|
228
|
+
station_reference: "station_ref_from_above"
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Historical Analysis
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
// Get a week of data for analysis
|
|
236
|
+
const historical = get_readings({
|
|
237
|
+
startdate: "2024-01-01",
|
|
238
|
+
enddate: "2024-01-07",
|
|
239
|
+
parameter: "level",
|
|
240
|
+
sorted: true,
|
|
241
|
+
limit: 1000
|
|
242
|
+
});
|
|
243
|
+
```
|