data-gov-uk-mcp 1.0.4 → 1.0.6

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/README.md CHANGED
@@ -19,4 +19,9 @@ node dist/index.js
19
19
 
20
20
  Data comes from the public data.gov.uk CKAN API.
21
21
 
22
+ ## Licence — no paywall
22
23
 
24
+ Every tool in this package is free: no licence key, no premium tier, no hosted
25
+ licence gateway. The paywall machinery this repo once carried (per-tool licence
26
+ checks and paid hosted endpoints) was removed repo-wide on 2026-10-17. Nothing
27
+ that this package installs or calls asks you to pay.
package/dist/api.js CHANGED
@@ -85,3 +85,36 @@ export async function publisherDatasets(args) {
85
85
  }
86
86
  return lines.join('\n');
87
87
  }
88
+
89
+ const CKAN = 'https://ckan.publishing.service.gov.uk/api/3/action';
90
+ export async function datasetDetail(args = {}) {
91
+ const name = String(args?.name ?? '').trim();
92
+ if (!/^[a-z0-9][a-z0-9._-]*$/i.test(name))
93
+ throw new Error('Provide a dataset slug, the part after data.gov.uk/dataset/.');
94
+ const res = await fetch(`${CKAN}/package_show?id=${encodeURIComponent(name)}`, {
95
+ headers: { 'User-Agent': 'mrfentmen-data-gov-uk-mcp/1.0', Accept: 'application/json' },
96
+ signal: AbortSignal.timeout(30000),
97
+ });
98
+ if (!res.ok)
99
+ throw new Error(`data.gov.uk returned ${res.status}`);
100
+ const body = (await res.json());
101
+ if (!body.success || !body.result)
102
+ throw new Error(`data.gov.uk has no dataset "${name}"`);
103
+ const d = body.result;
104
+ const resources = Array.isArray(d.resources) ? d.resources : [];
105
+ const tags = (d.tags ?? []).map((t) => t.name).filter(Boolean);
106
+ const vocab = Object.entries(d.extras ?? {}).filter(([k]) => /vocab|theme/i.test(k)).slice(0, 5);
107
+ return [
108
+ `${d.title ?? name} — ${d.name}`,
109
+ `Publisher: ${d.organization?.title ?? 'unknown'} · state ${d.state ?? '?'} · version ${d.version ?? '?'}`,
110
+ `Licence: ${d.license_title ?? d.license_id ?? 'not stated'}`,
111
+ `Created: ${String(d.metadata_created ?? '').slice(0, 10) || '?'} · updated: ${String(d.metadata_modified ?? '').slice(0, 10) || '?'}`,
112
+ tags.length ? `Tags: ${tags.slice(0, 12).join(', ')}` : 'Tags: none',
113
+ vocab.length ? `Vocabularies: ${vocab.map(([k, v]) => `${k}=${String(v).slice(0, 60)}`).join(' · ')}` : '',
114
+ '',
115
+ `${resources.length} resource(s):`,
116
+ ...resources.slice(0, 25).map((r, i) => `${i + 1}. ${r.name ?? '(unnamed)'} [${r.format ?? '?'}]${r.size ? ` ${Math.round(Number(r.size) / 1024)} KB` : ''} — ${r.url}`),
117
+ resources.length > 25 ? `… ${resources.length - 25} more resource(s) on the dataset page.` : '',
118
+ `Page: https://www.data.gov.uk/dataset/${d.name}`,
119
+ ].filter(Boolean).join('\n');
120
+ }
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
- import { search, publisherDatasets } from "./api.js";
3
+ import { search, publisherDatasets, datasetDetail } from "./api.js";
4
4
  const text = (value) => ({ content: [{ type: "text", text: value }] });
5
5
  const textError = (t) => ({ content: [{ type: "text", text: t }], isError: true });
6
6
  const READ_ONLY = { readOnlyHint: true, openWorldHint: true };
@@ -26,9 +26,8 @@ export function createServer() {
26
26
  inputSchema: z.object({ name: z.string().describe("The dataset slug, the part after data.gov.uk/dataset/.") }),
27
27
  annotations: READ_ONLY,
28
28
  }, async (args) => {
29
- // TODO: implement detail locally (paywall removed)
30
29
  try {
31
- return textError("Not yet implemented: detail");
30
+ return text(await datasetDetail(args));
32
31
  }
33
32
  catch (e) {
34
33
  return textError(String(e));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.4",
2
+ "version": "1.0.6",
3
3
  "type": "module",
4
4
  "repository": {
5
5
  "type": "git",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/mrfentmen/data-gov-uk-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.0.1",
9
+ "version": "1.0.6",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "data-gov-uk-mcp",
14
- "version": "1.0.1",
14
+ "version": "1.0.6",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }