@pipeworx/mcp-emsc 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 +55 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +196 -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,55 @@
|
|
|
1
|
+
# mcp-emsc
|
|
2
|
+
|
|
3
|
+
EMSC (European-Mediterranean Seismological Centre) MCP — wraps the
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 693+ live data sources.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"mcpServers": {
|
|
19
|
+
"emsc": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/emsc/mcp"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or connect to the full Pipeworx gateway for access to all 693+ data sources:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"pipeworx": {
|
|
32
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Using with ask_pipeworx
|
|
39
|
+
|
|
40
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
ask_pipeworx({ question: "your question about Emsc data" })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
47
|
+
|
|
48
|
+
## More
|
|
49
|
+
|
|
50
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
51
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-emsc",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "EMSC (European-Mediterranean Seismological Centre) MCP — wraps the",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "emsc"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-emsc"
|
|
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/emsc",
|
|
4
|
+
"title": "Emsc",
|
|
5
|
+
"description": "EMSC (European-Mediterranean Seismological Centre) MCP — wraps the",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/emsc",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-emsc",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/emsc/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
meter?: { credits: number };
|
|
15
|
+
cost?: Record<string, unknown>;
|
|
16
|
+
provider?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* EMSC (European-Mediterranean Seismological Centre) MCP — wraps the
|
|
21
|
+
* seismicportal.eu FDSN event web service (no auth required).
|
|
22
|
+
*
|
|
23
|
+
* FDSN-standard event API. Global coverage with especially strong
|
|
24
|
+
* Europe/Mediterranean reporting — complements USGS. All times are UTC ISO
|
|
25
|
+
* 8601, depth is in km, and `flynn_region` is the human-readable place name.
|
|
26
|
+
*
|
|
27
|
+
* Tools:
|
|
28
|
+
* - search_earthquakes: full FDSN filter search (time range, magnitude,
|
|
29
|
+
* bounding box OR center+radius, ordering)
|
|
30
|
+
* - recent_earthquakes: convenience — last N days above a minimum magnitude
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const BASE = 'https://www.seismicportal.eu/fdsnws/event/1';
|
|
35
|
+
const UA = 'pipeworx-mcp-emsc/1.0 (+https://pipeworx.io)';
|
|
36
|
+
|
|
37
|
+
const tools: McpToolExport['tools'] = [
|
|
38
|
+
{
|
|
39
|
+
name: 'search_earthquakes',
|
|
40
|
+
description:
|
|
41
|
+
'Search seismic events from EMSC (European-Mediterranean Seismological Centre) via the FDSN-standard seismicportal.eu API. Global coverage with especially strong Europe/Mediterranean reporting — complements USGS. Filter by UTC time range, magnitude, and location (either a bounding box OR a center point + radius in degrees). Times are UTC ISO 8601, depth in km, and place names come from the Flynn-Engdahl region. Example: search_earthquakes({ start: "2026-01-01", end: "2026-02-01", minmag: 5.0, orderby: "magnitude" }) or search_earthquakes({ lat: 38.0, lon: 23.7, maxradius: 5, minmag: 3 }).',
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
properties: {
|
|
45
|
+
start: { type: 'string', description: 'Start of UTC time window, ISO 8601 (e.g. "2026-01-01" or "2026-01-01T00:00:00").' },
|
|
46
|
+
end: { type: 'string', description: 'End of UTC time window, ISO 8601.' },
|
|
47
|
+
minmag: { type: 'number', description: 'Minimum magnitude (optional).' },
|
|
48
|
+
maxmag: { type: 'number', description: 'Maximum magnitude (optional).' },
|
|
49
|
+
minlat: { type: 'number', description: 'Bounding box southern latitude, -90 to 90 (optional).' },
|
|
50
|
+
maxlat: { type: 'number', description: 'Bounding box northern latitude, -90 to 90 (optional).' },
|
|
51
|
+
minlon: { type: 'number', description: 'Bounding box western longitude, -180 to 180 (optional).' },
|
|
52
|
+
maxlon: { type: 'number', description: 'Bounding box eastern longitude, -180 to 180 (optional).' },
|
|
53
|
+
lat: { type: 'number', description: 'Center latitude for circular search (use with lon + maxradius).' },
|
|
54
|
+
lon: { type: 'number', description: 'Center longitude for circular search (use with lat + maxradius).' },
|
|
55
|
+
maxradius: { type: 'number', description: 'Maximum radius in degrees from center lat/lon (optional).' },
|
|
56
|
+
minradius: { type: 'number', description: 'Minimum radius in degrees from center lat/lon (optional).' },
|
|
57
|
+
limit: { type: 'number', description: 'Maximum number of results, 1-1000 (default: 50).' },
|
|
58
|
+
orderby: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
enum: ['time', 'time-asc', 'magnitude', 'magnitude-asc'],
|
|
61
|
+
description: 'Result ordering (default: "time", i.e. newest first).',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
required: [],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'recent_earthquakes',
|
|
69
|
+
description:
|
|
70
|
+
'Get recent earthquakes from EMSC (European-Mediterranean Seismological Centre): the last N days above a minimum magnitude, newest first. Convenience wrapper over the FDSN event API. Global coverage, strong in Europe/Mediterranean. Times are UTC ISO 8601, depth in km. Example: recent_earthquakes({ days: 7, minmag: 4 }).',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: {
|
|
74
|
+
days: { type: 'number', description: 'How many days back to look (default: 7).' },
|
|
75
|
+
minmag: { type: 'number', description: 'Minimum magnitude to include (default: 4).' },
|
|
76
|
+
limit: { type: 'number', description: 'Maximum number of results, 1-1000 (default: 50).' },
|
|
77
|
+
},
|
|
78
|
+
required: [],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
84
|
+
switch (name) {
|
|
85
|
+
case 'search_earthquakes':
|
|
86
|
+
return searchEarthquakes(args);
|
|
87
|
+
case 'recent_earthquakes':
|
|
88
|
+
return recentEarthquakes(args);
|
|
89
|
+
default:
|
|
90
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function clampLimit(v: unknown, fallback: number): number {
|
|
95
|
+
const n = typeof v === 'number' ? v : fallback;
|
|
96
|
+
return Math.min(1000, Math.max(1, Math.floor(n)));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async function searchEarthquakes(args: Record<string, unknown>) {
|
|
100
|
+
const params = new URLSearchParams({ format: 'json' });
|
|
101
|
+
|
|
102
|
+
const passthrough = [
|
|
103
|
+
'start', 'end', 'minmag', 'maxmag',
|
|
104
|
+
'minlat', 'maxlat', 'minlon', 'maxlon',
|
|
105
|
+
'lat', 'lon', 'maxradius', 'minradius', 'orderby',
|
|
106
|
+
] as const;
|
|
107
|
+
for (const key of passthrough) {
|
|
108
|
+
if (args[key] != null) params.set(key, String(args[key]));
|
|
109
|
+
}
|
|
110
|
+
if (!params.has('orderby')) params.set('orderby', 'time');
|
|
111
|
+
params.set('limit', String(clampLimit(args.limit, 50)));
|
|
112
|
+
|
|
113
|
+
return emscQuery(params);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function recentEarthquakes(args: Record<string, unknown>) {
|
|
117
|
+
const days = typeof args.days === 'number' ? args.days : 7;
|
|
118
|
+
const minmag = typeof args.minmag === 'number' ? args.minmag : 4;
|
|
119
|
+
const start = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString();
|
|
120
|
+
|
|
121
|
+
const params = new URLSearchParams({
|
|
122
|
+
format: 'json',
|
|
123
|
+
start,
|
|
124
|
+
minmag: String(minmag),
|
|
125
|
+
orderby: 'time',
|
|
126
|
+
limit: String(clampLimit(args.limit, 50)),
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return emscQuery(params);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function emscQuery(params: URLSearchParams) {
|
|
133
|
+
const res = await fetch(`${BASE}/query?${params}`, {
|
|
134
|
+
headers: { Accept: 'application/json', 'User-Agent': UA },
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// FDSN returns 204 No Content when a valid query matches zero events.
|
|
138
|
+
if (res.status === 204) return { count: 0, earthquakes: [] };
|
|
139
|
+
|
|
140
|
+
if (!res.ok) {
|
|
141
|
+
const body = await res.text();
|
|
142
|
+
throw new Error(`EMSC: ${res.status} ${body.slice(0, 200)}`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const data = (await res.json()) as EmscResponse;
|
|
146
|
+
return formatQuakes(data);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface EmscResponse {
|
|
150
|
+
type: string;
|
|
151
|
+
metadata?: { count?: number };
|
|
152
|
+
features: Array<{
|
|
153
|
+
id: string;
|
|
154
|
+
geometry: { coordinates: [number, number, number] };
|
|
155
|
+
properties: {
|
|
156
|
+
mag: number | null;
|
|
157
|
+
magtype: string | null;
|
|
158
|
+
time: string;
|
|
159
|
+
lastupdate: string | null;
|
|
160
|
+
lat: number;
|
|
161
|
+
lon: number;
|
|
162
|
+
depth: number | null;
|
|
163
|
+
flynn_region: string | null;
|
|
164
|
+
evtype: string | null;
|
|
165
|
+
auth: string | null;
|
|
166
|
+
source_catalog: string | null;
|
|
167
|
+
unid: string;
|
|
168
|
+
};
|
|
169
|
+
}>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function formatQuakes(data: EmscResponse) {
|
|
173
|
+
const features = data.features ?? [];
|
|
174
|
+
return {
|
|
175
|
+
count: data.metadata?.count ?? features.length,
|
|
176
|
+
earthquakes: features.map((f) => {
|
|
177
|
+
const p = f.properties;
|
|
178
|
+
return {
|
|
179
|
+
id: f.id,
|
|
180
|
+
magnitude: p.mag,
|
|
181
|
+
magnitude_type: p.magtype,
|
|
182
|
+
place: p.flynn_region,
|
|
183
|
+
time: p.time,
|
|
184
|
+
updated: p.lastupdate,
|
|
185
|
+
latitude: p.lat,
|
|
186
|
+
longitude: p.lon,
|
|
187
|
+
depth_km: p.depth,
|
|
188
|
+
event_type: p.evtype,
|
|
189
|
+
author: p.auth,
|
|
190
|
+
catalog: p.source_catalog,
|
|
191
|
+
};
|
|
192
|
+
}),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export default { tools, callTool, meter: { credits: 1 } } 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
|
+
}
|