@pipeworx/mcp-govdata-de 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 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,57 @@
1
+ # mcp-govdata-de
2
+
3
+ GovData.de MCP — Germany's national open-data portal (CKAN API).
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 965+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+ | `list_organizations` | List publishing organizations (federal ministries, Länder, municipalities, agencies) on GovData.de (CKAN organization_list). |
12
+ | `list_groups` | List thematic groups/categories on GovData.de (CKAN group_list), e.g. transport, environment, health, education. |
13
+
14
+ ## Quick Start
15
+
16
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
17
+
18
+ ```json
19
+ {
20
+ "mcpServers": {
21
+ "govdata-de": {
22
+ "url": "https://gateway.pipeworx.io/govdata-de/mcp"
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ Or connect to the full Pipeworx gateway for access to all 965+ data sources:
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "pipeworx": {
34
+ "url": "https://gateway.pipeworx.io/mcp"
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ ## Using with ask_pipeworx
41
+
42
+ Instead of calling tools directly, you can ask questions in plain English:
43
+
44
+ ```
45
+ ask_pipeworx({ question: "your question about Govdata De data" })
46
+ ```
47
+
48
+ The gateway picks the right tool and fills the arguments automatically.
49
+
50
+ ## More
51
+
52
+ - [All tools and guides](https://github.com/pipeworx-io/examples)
53
+ - [pipeworx.io](https://pipeworx.io)
54
+
55
+ ## License
56
+
57
+ MIT
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@pipeworx/mcp-govdata-de",
3
+ "version": "0.1.0",
4
+ "description": "GovData.de MCP — Germany's national open-data portal (CKAN API).",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "govdata-de"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-govdata-de"
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/govdata-de",
4
+ "title": "Govdata De",
5
+ "description": "GovData.de MCP — Germany's national open-data portal (CKAN API).",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/govdata-de",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-govdata-de",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/govdata-de/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,137 @@
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
+ * GovData.de MCP — Germany's national open-data portal (CKAN API).
21
+ *
22
+ * GovData (govdata.de) is the German federal data portal ("Datenportal für
23
+ * Deutschland"). It federates open datasets published by federal, state
24
+ * (Länder) and municipal authorities. Auth: none (keyless).
25
+ * Docs: https://docs.ckan.org/en/latest/api/ (stock CKAN action API).
26
+ *
27
+ * Notes for callers:
28
+ * - Almost all metadata (dataset titles, descriptions, organization display
29
+ * names, group names) is in GERMAN (UTF-8). Free-text `query`/`q` arguments
30
+ * may be passed in German or English; German keywords match far more
31
+ * datasets. e.g. "Verkehr" (transport), "Haushalt" (budget), "Umwelt"
32
+ * (environment), "Gesundheit" (health). Records come back as UTF-8 JSON.
33
+ * - GovData is a metadata aggregator: most resources link out to files on the
34
+ * publishing authority's own portal rather than hosting tabular data, so the
35
+ * CKAN datastore is generally NOT active here. There is therefore no
36
+ * datastore_query tool — fetch a dataset's resource URLs via dataset_details
37
+ * and read the underlying file directly.
38
+ */
39
+
40
+
41
+ const BASE = 'https://www.govdata.de/ckan/api/3/action';
42
+ const UA = 'pipeworx-mcp-govdata-de/1.0 (+https://pipeworx.io)';
43
+
44
+ const tools: McpToolExport['tools'] = [
45
+ {
46
+ name: 'search_datasets',
47
+ description:
48
+ 'Search the GovData.de catalogue (CKAN package_search) — German federal/state/municipal open data. Returns matching datasets with titles/descriptions (mostly German). Query may be German or English; German keywords match more.',
49
+ inputSchema: {
50
+ type: 'object',
51
+ properties: {
52
+ query: { type: 'string', description: 'Search terms, German or English. e.g. "Verkehr", "Umwelt", "Haushalt", "health".' },
53
+ fq: { type: 'string', description: 'Solr filter query, e.g. "organization:bund" or "res_format:CSV" or "groups:gesu".' },
54
+ rows: { type: 'number', description: 'Max results, 1-1000 (default 25).' },
55
+ start: { type: 'number', description: '0-based offset for paging.' },
56
+ sort: { type: 'string', description: 'Sort spec, e.g. "metadata_modified desc".' },
57
+ },
58
+ required: ['query'],
59
+ },
60
+ },
61
+ {
62
+ name: 'dataset_details',
63
+ description:
64
+ 'Full dataset record by id or slug (CKAN package_show), including its resources. Read each resource\'s "url" to download the underlying file (CSV/JSON/etc.) — GovData links out to the publishing authority rather than hosting tabular data.',
65
+ inputSchema: {
66
+ type: 'object',
67
+ properties: { id: { type: 'string', description: 'Dataset id (UUID) or slug from search_datasets results.' } },
68
+ required: ['id'],
69
+ },
70
+ },
71
+ {
72
+ name: 'list_organizations',
73
+ description: 'List publishing organizations (federal ministries, Länder, municipalities, agencies) on GovData.de (CKAN organization_list).',
74
+ inputSchema: {
75
+ type: 'object',
76
+ properties: { limit: { type: 'number', description: 'Max orgs, 1-1000 (default 100).' } },
77
+ },
78
+ },
79
+ {
80
+ name: 'list_groups',
81
+ description: 'List thematic groups/categories on GovData.de (CKAN group_list), e.g. transport, environment, health, education.',
82
+ inputSchema: {
83
+ type: 'object',
84
+ properties: { limit: { type: 'number', description: 'Max groups, 1-1000 (default 100).' } },
85
+ },
86
+ },
87
+ ];
88
+
89
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
90
+ switch (name) {
91
+ case 'search_datasets': {
92
+ const params = new URLSearchParams({
93
+ q: reqStr(args, 'query', '"Verkehr" or "health"'),
94
+ rows: String(clamp(args.rows, 25, 1, 1000)),
95
+ start: String(Math.max(0, (args.start as number) ?? 0)),
96
+ });
97
+ if (args.fq) params.set('fq', String(args.fq));
98
+ if (args.sort) params.set('sort', String(args.sort));
99
+ return ckanGet(`/package_search?${params}`);
100
+ }
101
+ case 'dataset_details':
102
+ return ckanGet(`/package_show?id=${encodeURIComponent(reqStr(args, 'id', 'a dataset id or slug'))}`);
103
+ case 'list_organizations': {
104
+ const params = new URLSearchParams({ all_fields: 'true', limit: String(clamp(args.limit, 100, 1, 1000)) });
105
+ return ckanGet(`/organization_list?${params}`);
106
+ }
107
+ case 'list_groups': {
108
+ const params = new URLSearchParams({ all_fields: 'true', limit: String(clamp(args.limit, 100, 1, 1000)) });
109
+ return ckanGet(`/group_list?${params}`);
110
+ }
111
+ default:
112
+ throw new Error(`Unknown tool: ${name}`);
113
+ }
114
+ }
115
+
116
+ async function ckanGet(path: string): Promise<unknown> {
117
+ const res = await fetch(`${BASE}${path}`, { headers: { Accept: 'application/json', 'User-Agent': UA } });
118
+ if (!res.ok) throw new Error(`GovData: ${res.status} ${await res.text().then((t) => t.slice(0, 200))}`);
119
+ const json = (await res.json()) as { success?: boolean; error?: { message?: string }; result?: unknown };
120
+ if (json.success === false) throw new Error(`GovData: ${json.error?.message ?? 'request failed'}`);
121
+ return json.result ?? json;
122
+ }
123
+
124
+ function clamp(v: unknown, dflt: number, lo: number, hi: number): number {
125
+ const n = typeof v === 'number' ? v : dflt;
126
+ return Math.min(hi, Math.max(lo, n));
127
+ }
128
+
129
+ function reqStr(args: Record<string, unknown>, key: string, example: string): string {
130
+ const v = args[key];
131
+ if (typeof v !== 'string' || !v.trim()) {
132
+ throw new Error(`Required argument "${key}" is missing. Pass a string like ${example}.`);
133
+ }
134
+ return v;
135
+ }
136
+
137
+ 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
+ }