@pipeworx/mcp-energi-data-dk 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 +181 -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-energi-data-dk
|
|
2
|
+
|
|
3
|
+
Energi Data Service (Energinet) MCP — Denmark's official open energy data.
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 790+ 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
|
+
"energi-data-dk": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/energi-data-dk/mcp"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or connect to the full Pipeworx gateway for access to all 790+ 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 Energi Data Dk 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-energi-data-dk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Energi Data Service (Energinet) MCP — Denmark's official open energy data.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "energi-data-dk"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-energi-data-dk"
|
|
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/energi-data-dk",
|
|
4
|
+
"title": "Energi Data Dk",
|
|
5
|
+
"description": "Energi Data Service (Energinet) MCP — Denmark's official open energy data.",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/energi-data-dk",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-energi-data-dk",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/energi-data-dk/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
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
|
+
* Energi Data Service (Energinet) MCP — Denmark's official open energy data.
|
|
21
|
+
* Keyless. Electricity day-ahead spot prices by bidding zone, real-time grid
|
|
22
|
+
* CO2 emission intensity, and production/consumption. DK1 = west Denmark,
|
|
23
|
+
* DK2 = east Denmark.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const BASE = 'https://api.energidataservice.dk';
|
|
28
|
+
const UA = 'pipeworx/1.0 (+https://pipeworx.io)';
|
|
29
|
+
|
|
30
|
+
const tools: McpToolExport['tools'] = [
|
|
31
|
+
{
|
|
32
|
+
name: 'spot_prices',
|
|
33
|
+
description:
|
|
34
|
+
'Day-ahead electricity spot prices from Energi Data Service (Energinet, Denmark/Nordic). ' +
|
|
35
|
+
'Prices per bidding zone (PriceArea) in DKK and EUR per MWh, hourly. ' +
|
|
36
|
+
'Bidding zones: DK1 (west Denmark), DK2 (east Denmark), DE (Germany), NO2, SE3, SE4, and others. ' +
|
|
37
|
+
'Omit "area" to get all zones. Keyless official open data.',
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
area: { type: 'string', description: 'Bidding zone, e.g. "DK1", "DK2", "DE". Omit for all areas.' },
|
|
42
|
+
limit: { type: 'number', description: 'Max records (default 24, i.e. last 24 hourly rows).' },
|
|
43
|
+
start: { type: 'string', description: 'ISO date/time lower bound, e.g. "2026-06-01" or "2026-06-01T00:00".' },
|
|
44
|
+
end: { type: 'string', description: 'ISO date/time upper bound.' },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'co2_intensity',
|
|
50
|
+
description:
|
|
51
|
+
'Real-time grid CO2 emission intensity (grams CO2 per kWh) from Energi Data Service (Energinet, Denmark), ' +
|
|
52
|
+
'sampled every 5 minutes per bidding zone. Areas: DK1 (west Denmark), DK2 (east Denmark). ' +
|
|
53
|
+
'Lower values mean cleaner electricity right now. Keyless official open data.',
|
|
54
|
+
inputSchema: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
area: { type: 'string', description: 'Bidding zone "DK1" or "DK2". Omit for both.' },
|
|
58
|
+
limit: { type: 'number', description: 'Max records (default 12, i.e. last hour at 5-min resolution).' },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'query_dataset',
|
|
64
|
+
description:
|
|
65
|
+
'Generic escape hatch for any of the ~100 Energi Data Service (Energinet, Denmark) datasets. ' +
|
|
66
|
+
'Examples: "ProductionConsumptionSettlement" (production/consumption by type per area+hour), ' +
|
|
67
|
+
'"CO2EmisProg" (CO2 prognosis), "Elspotprices", "CO2Emis". ' +
|
|
68
|
+
'Returns the raw records array for the dataset. Keyless official open data.',
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
properties: {
|
|
72
|
+
dataset: { type: 'string', description: 'Dataset name, e.g. "ProductionConsumptionSettlement".' },
|
|
73
|
+
limit: { type: 'number', description: 'Max records (default 20).' },
|
|
74
|
+
sort: { type: 'string', description: 'Sort expression, e.g. "HourUTC DESC".' },
|
|
75
|
+
start: { type: 'string', description: 'ISO date/time lower bound.' },
|
|
76
|
+
end: { type: 'string', description: 'ISO date/time upper bound.' },
|
|
77
|
+
filter: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
description: 'Column→value[] filter, e.g. {"PriceArea":["DK1"]}. Values are arrays.',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
required: ['dataset'],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
88
|
+
try {
|
|
89
|
+
switch (name) {
|
|
90
|
+
case 'spot_prices': {
|
|
91
|
+
const area = optStr(args.area);
|
|
92
|
+
const limit = optNum(args.limit, 24);
|
|
93
|
+
const params = new URLSearchParams();
|
|
94
|
+
params.set('limit', String(limit));
|
|
95
|
+
params.set('sort', 'HourUTC DESC');
|
|
96
|
+
if (area) params.set('filter', JSON.stringify({ PriceArea: [area] }));
|
|
97
|
+
const start = optStr(args.start);
|
|
98
|
+
const end = optStr(args.end);
|
|
99
|
+
if (start) params.set('start', start);
|
|
100
|
+
if (end) params.set('end', end);
|
|
101
|
+
const data = await edsGet('Elspotprices', params);
|
|
102
|
+
const records = recordsOf(data);
|
|
103
|
+
return {
|
|
104
|
+
count: records.length,
|
|
105
|
+
prices: records.map((r) => ({
|
|
106
|
+
hour_utc: r.HourUTC,
|
|
107
|
+
hour_dk: r.HourDK,
|
|
108
|
+
area: r.PriceArea,
|
|
109
|
+
price_dkk: r.SpotPriceDKK,
|
|
110
|
+
price_eur: r.SpotPriceEUR,
|
|
111
|
+
})),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
case 'co2_intensity': {
|
|
115
|
+
const area = optStr(args.area);
|
|
116
|
+
const limit = optNum(args.limit, 12);
|
|
117
|
+
const params = new URLSearchParams();
|
|
118
|
+
params.set('limit', String(limit));
|
|
119
|
+
params.set('sort', 'Minutes5UTC DESC');
|
|
120
|
+
if (area) params.set('filter', JSON.stringify({ PriceArea: [area] }));
|
|
121
|
+
const data = await edsGet('CO2Emis', params);
|
|
122
|
+
const records = recordsOf(data);
|
|
123
|
+
return {
|
|
124
|
+
count: records.length,
|
|
125
|
+
emissions: records.map((r) => ({
|
|
126
|
+
time_utc: r.Minutes5UTC,
|
|
127
|
+
area: r.PriceArea,
|
|
128
|
+
co2_g_per_kwh: r.CO2Emission,
|
|
129
|
+
})),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
case 'query_dataset': {
|
|
133
|
+
const dataset = optStr(args.dataset);
|
|
134
|
+
if (!dataset) return { error: 'Required argument "dataset" is missing. Pass a dataset name like "ProductionConsumptionSettlement".' };
|
|
135
|
+
const limit = optNum(args.limit, 20);
|
|
136
|
+
const params = new URLSearchParams();
|
|
137
|
+
params.set('limit', String(limit));
|
|
138
|
+
const sort = optStr(args.sort);
|
|
139
|
+
const start = optStr(args.start);
|
|
140
|
+
const end = optStr(args.end);
|
|
141
|
+
if (sort) params.set('sort', sort);
|
|
142
|
+
if (start) params.set('start', start);
|
|
143
|
+
if (end) params.set('end', end);
|
|
144
|
+
const filter = args.filter;
|
|
145
|
+
if (filter && typeof filter === 'object') params.set('filter', JSON.stringify(filter));
|
|
146
|
+
const data = await edsGet(dataset, params);
|
|
147
|
+
const records = recordsOf(data);
|
|
148
|
+
return { dataset, count: records.length, records };
|
|
149
|
+
}
|
|
150
|
+
default:
|
|
151
|
+
return { error: `Unknown tool: ${name}` };
|
|
152
|
+
}
|
|
153
|
+
} catch (e) {
|
|
154
|
+
return { error: e instanceof Error ? e.message : String(e) };
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async function edsGet(dataset: string, params: URLSearchParams): Promise<unknown> {
|
|
159
|
+
// URLSearchParams.toString() encodes all values (filter JSON, spaces in sort, etc.).
|
|
160
|
+
const url = `${BASE}/dataset/${encodeURIComponent(dataset)}?${params.toString()}`;
|
|
161
|
+
const res = await fetch(url, { headers: { Accept: 'application/json', 'User-Agent': UA } });
|
|
162
|
+
if (!res.ok) throw new Error(`Energi Data Service: ${res.status} ${(await res.text()).slice(0, 200)}`);
|
|
163
|
+
return res.json();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function recordsOf(data: unknown): Array<Record<string, any>> {
|
|
167
|
+
if (data && typeof data === 'object' && Array.isArray((data as any).records)) {
|
|
168
|
+
return (data as any).records as Array<Record<string, any>>;
|
|
169
|
+
}
|
|
170
|
+
return [];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function optStr(v: unknown): string | undefined {
|
|
174
|
+
return typeof v === 'string' && v.trim() ? v.trim() : undefined;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function optNum(v: unknown, def: number): number {
|
|
178
|
+
return typeof v === 'number' && Number.isFinite(v) ? v : def;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
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
|
+
}
|