@cyanheads/eurostat-mcp-server 0.6.0 → 0.6.2

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.
Files changed (65) hide show
  1. package/AGENTS.md +386 -0
  2. package/CLAUDE.md +32 -9
  3. package/Dockerfile +5 -5
  4. package/README.md +15 -13
  5. package/changelog/0.1.x/0.1.0.md +20 -0
  6. package/changelog/0.1.x/0.1.1.md +21 -0
  7. package/changelog/0.1.x/0.1.10.md +24 -0
  8. package/changelog/0.1.x/0.1.11.md +15 -0
  9. package/changelog/0.1.x/0.1.12.md +28 -0
  10. package/changelog/0.1.x/0.1.13.md +20 -0
  11. package/changelog/0.1.x/0.1.14.md +38 -0
  12. package/changelog/0.1.x/0.1.15.md +13 -0
  13. package/changelog/0.1.x/0.1.16.md +36 -0
  14. package/changelog/0.1.x/0.1.2.md +17 -0
  15. package/changelog/0.1.x/0.1.3.md +12 -0
  16. package/changelog/0.1.x/0.1.4.md +17 -0
  17. package/changelog/0.1.x/0.1.5.md +11 -0
  18. package/changelog/0.1.x/0.1.6.md +14 -0
  19. package/changelog/0.1.x/0.1.7.md +16 -0
  20. package/changelog/0.1.x/0.1.8.md +19 -0
  21. package/changelog/0.1.x/0.1.9.md +20 -0
  22. package/changelog/0.2.x/0.2.0.md +29 -0
  23. package/changelog/0.3.x/0.3.0.md +17 -0
  24. package/changelog/0.4.x/0.4.0.md +24 -0
  25. package/changelog/0.5.x/0.5.0.md +20 -0
  26. package/changelog/0.6.x/0.6.0.md +20 -0
  27. package/changelog/0.6.x/0.6.1.md +30 -0
  28. package/changelog/0.6.x/0.6.2.md +21 -0
  29. package/changelog/template.md +168 -0
  30. package/dist/mcp-server/resources/definitions/eurostat-dataset.resource.js +2 -2
  31. package/dist/mcp-server/resources/definitions/eurostat-dataset.resource.js.map +1 -1
  32. package/dist/mcp-server/tools/definitions/eurostat-download-dataset.tool.d.ts +3 -0
  33. package/dist/mcp-server/tools/definitions/eurostat-download-dataset.tool.d.ts.map +1 -1
  34. package/dist/mcp-server/tools/definitions/eurostat-download-dataset.tool.js +16 -4
  35. package/dist/mcp-server/tools/definitions/eurostat-download-dataset.tool.js.map +1 -1
  36. package/dist/mcp-server/tools/definitions/eurostat-get-dataset-info.tool.js +2 -2
  37. package/dist/mcp-server/tools/definitions/eurostat-get-dataset-info.tool.js.map +1 -1
  38. package/dist/mcp-server/tools/definitions/eurostat-get-dimension-values.tool.d.ts +13 -1
  39. package/dist/mcp-server/tools/definitions/eurostat-get-dimension-values.tool.d.ts.map +1 -1
  40. package/dist/mcp-server/tools/definitions/eurostat-get-dimension-values.tool.js +24 -3
  41. package/dist/mcp-server/tools/definitions/eurostat-get-dimension-values.tool.js.map +1 -1
  42. package/dist/mcp-server/tools/definitions/eurostat-query-dataset.tool.d.ts +4 -3
  43. package/dist/mcp-server/tools/definitions/eurostat-query-dataset.tool.d.ts.map +1 -1
  44. package/dist/mcp-server/tools/definitions/eurostat-query-dataset.tool.js +40 -21
  45. package/dist/mcp-server/tools/definitions/eurostat-query-dataset.tool.js.map +1 -1
  46. package/dist/services/eurostat-bulk/eurostat-bulk-service.d.ts.map +1 -1
  47. package/dist/services/eurostat-bulk/eurostat-bulk-service.js +1 -4
  48. package/dist/services/eurostat-bulk/eurostat-bulk-service.js.map +1 -1
  49. package/dist/services/eurostat-catalogue/eurostat-catalogue-service.d.ts.map +1 -1
  50. package/dist/services/eurostat-catalogue/eurostat-catalogue-service.js +3 -6
  51. package/dist/services/eurostat-catalogue/eurostat-catalogue-service.js.map +1 -1
  52. package/dist/services/eurostat-data/eurostat-data-service.d.ts +17 -55
  53. package/dist/services/eurostat-data/eurostat-data-service.d.ts.map +1 -1
  54. package/dist/services/eurostat-data/eurostat-data-service.js +90 -160
  55. package/dist/services/eurostat-data/eurostat-data-service.js.map +1 -1
  56. package/dist/services/eurostat-data/sdmx-metadata.d.ts +16 -0
  57. package/dist/services/eurostat-data/sdmx-metadata.d.ts.map +1 -0
  58. package/dist/services/eurostat-data/sdmx-metadata.js +330 -0
  59. package/dist/services/eurostat-data/sdmx-metadata.js.map +1 -0
  60. package/dist/services/eurostat-data/types.d.ts +21 -19
  61. package/dist/services/eurostat-data/types.d.ts.map +1 -1
  62. package/dist/services/eurostat-data/types.js +3 -3
  63. package/dist/services/eurostat-data/types.js.map +1 -1
  64. package/package.json +20 -12
  65. package/server.json +3 -3
package/AGENTS.md ADDED
@@ -0,0 +1,386 @@
1
+ # Agent Protocol
2
+
3
+ **Server:** @cyanheads/eurostat-mcp-server
4
+ **Version:** 0.6.2
5
+ **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.12.3`
6
+ **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
+ **MCP SDK:** `@modelcontextprotocol/server` `^2.0.0`
8
+ **Zod:** `^4.4.3`
9
+
10
+ > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
11
+
12
+ ---
13
+
14
+ ## What's Next?
15
+
16
+ When the user asks what to do next, what's left, or needs direction, suggest relevant options based on the current project state:
17
+
18
+ 1. **Re-run the `setup` skill** — ensures CLAUDE.md, skills, structure, and metadata are populated and up to date with the current codebase
19
+ 2. **Run the `design-mcp-server` skill** — if the tool/resource surface hasn't been mapped yet, work through domain design
20
+ 3. **Add tools/resources/prompts** — scaffold new definitions using the `add-tool`, `add-app-tool`, `add-resource`, `add-prompt` skills
21
+ 4. **Add services** — scaffold domain service integrations using the `add-service` skill
22
+ 5. **Add tests** — scaffold tests for existing definitions using the `add-test` skill
23
+ 6. **Field-test definitions** — exercise tools/resources/prompts with real inputs using the `field-test` skill, get a report of issues and pain points
24
+ 7. **Run `devcheck`** — lint, format, typecheck, and security audit
25
+ 8. **Run the `security-pass` skill** — audit handlers for MCP-specific security gaps: output injection, scope blast radius, input sinks, tenant isolation
26
+ 9. **Run the `polish-docs-meta` skill** — finalize README, CHANGELOG, metadata, and agent protocol for shipping
27
+ 10. **Run the `maintenance` skill** — investigate changelogs, adopt upstream changes, and sync skills after `bun update --latest`
28
+
29
+ Tailor suggestions to what's actually missing or stale — don't recite the full list every time.
30
+
31
+ ---
32
+
33
+ ## Core Rules
34
+
35
+ - **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
36
+ - **Use `ctx.log`** for request-scoped logging. No `console` calls.
37
+ - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
38
+ - **Need input the caller didn't supply?** `return ctx.requestInput(...)` and read `ctx.inputs` when the handler is re-entered. Never `await` for user input mid-handler.
39
+ - **Secrets in env vars only** — never hardcoded.
40
+ - **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
41
+
42
+ ---
43
+
44
+ ## Patterns
45
+
46
+ ### Tool
47
+
48
+ ```ts
49
+ import { tool, z } from '@cyanheads/mcp-ts-core';
50
+
51
+ export const searchItems = tool('search_items', {
52
+ description: 'Search inventory items by query.',
53
+ annotations: { readOnlyHint: true },
54
+ input: z.object({
55
+ query: z.string().describe('Search terms'),
56
+ limit: z.number().default(10).describe('Max results'),
57
+ }),
58
+ output: z.object({
59
+ items: z.array(z.object({
60
+ id: z.string().describe('Item ID'),
61
+ name: z.string().describe('Item name'),
62
+ })).describe('Matching items'),
63
+ }),
64
+ auth: ['inventory:read'],
65
+
66
+ async handler(input, ctx) {
67
+ const items = await findItems(input.query, input.limit);
68
+ ctx.log.info('Search completed', { query: input.query, count: items.length });
69
+ return { items };
70
+ },
71
+
72
+ // format() populates content[] — the markdown twin of structuredContent.
73
+ // Different clients read different surfaces (Claude Code → structuredContent,
74
+ // Claude Desktop → content[]); both must carry the same data.
75
+ // Enforced at lint time: every field in `output` must appear in the rendered text.
76
+ format: (result) => [{
77
+ type: 'text',
78
+ text: result.items.map(i => `**${i.id}**: ${i.name}`).join('\n'),
79
+ }],
80
+ });
81
+ ```
82
+
83
+ ### Resource
84
+
85
+ ```ts
86
+ import { resource, z } from '@cyanheads/mcp-ts-core';
87
+ import { notFound } from '@cyanheads/mcp-ts-core/errors';
88
+
89
+ export const itemData = resource('inventory://{itemId}', {
90
+ description: 'Fetch an inventory item by ID.',
91
+ params: z.object({ itemId: z.string().describe('Item identifier') }),
92
+ auth: ['inventory:read'],
93
+ async handler(params, ctx) {
94
+ const item = await ctx.state.get(`item/${params.itemId}`);
95
+ if (!item) throw notFound(`Item ${params.itemId} not found`, { itemId: params.itemId });
96
+ return item;
97
+ },
98
+ });
99
+ ```
100
+
101
+ ### Prompt
102
+
103
+ ```ts
104
+ import { prompt, z } from '@cyanheads/mcp-ts-core';
105
+
106
+ export const reviewCode = prompt('review_code', {
107
+ description: 'Review code for issues and best practices.',
108
+ args: z.object({
109
+ code: z.string().describe('Code to review'),
110
+ language: z.string().optional().describe('Programming language'),
111
+ }),
112
+ generate: (args) => [
113
+ { role: 'user', content: { type: 'text', text: `Review this ${args.language ?? ''} code:\n${args.code}` } },
114
+ ],
115
+ });
116
+ ```
117
+
118
+ ### Server config
119
+
120
+ ```ts
121
+ // src/config/server-config.ts — lazy-parsed, separate from framework config
122
+ import { z } from '@cyanheads/mcp-ts-core';
123
+ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
124
+
125
+ const ServerConfigSchema = z.object({
126
+ apiKey: z.string().describe('External API key'),
127
+ maxResults: z.coerce.number().default(100),
128
+ verboseLogging: z.stringbool().default(false).describe('Enable verbose logging'),
129
+ });
130
+
131
+ let _config: z.infer<typeof ServerConfigSchema> | undefined;
132
+ export function getServerConfig() {
133
+ _config ??= parseEnvConfig(ServerConfigSchema, {
134
+ apiKey: 'MY_API_KEY',
135
+ maxResults: 'MY_MAX_RESULTS',
136
+ verboseLogging: 'MY_VERBOSE_LOGGING',
137
+ });
138
+ return _config;
139
+ }
140
+ ```
141
+
142
+ `parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
143
+
144
+ For env booleans use `z.stringbool()`, never `z.coerce.boolean()` — `Boolean("false")` is `true`, so a coerced flag can't be disabled through the environment. `z.stringbool()` parses `true/false/1/0/yes/no/on/off` and rejects anything else.
145
+
146
+ ### Server identity and instructions
147
+
148
+ `createApp()` accepts optional identity fields forwarded to the SDK's `initialize` response and the server manifest. Keep this server's in-code identity to `name: 'eurostat-mcp-server'` and `title: 'eurostat-mcp-server'`; package metadata remains authoritative for the description and website.
149
+
150
+ `instructions` is optional server-level orientation, sent on every `initialize` as session-level context. Use it for deployment guidance and cross-tool workflows instead of repeating the same context across tool descriptions.
151
+
152
+ ---
153
+
154
+ ## Context
155
+
156
+ Handlers receive a unified `ctx` object. Key properties:
157
+
158
+ | Property | Description |
159
+ |:---------|:------------|
160
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino and client `notifications/message`, so treat it as client-visible. |
161
+ | `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
162
+ | `ctx.requestInput` | Suspend and ask the caller for more input — `return ctx.requestInput({ inputRequests: { key: inputRequired.elicit({ message, requestedSchema }) } })`. Never returns; the handler is re-entered with the answers. |
163
+ | `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. |
164
+ | `ctx.enrich` | Success-path agent context (empty-result notices, query echo, pagination totals) — `ctx.enrich(...)` or `.notice()` / `.total()` / `.echo()` / `.truncated()`. Reaches `structuredContent` and `content[]`; lands only when the definition declares an `enrichment` block (no-op otherwise). |
165
+ | `ctx.content` | Non-text content blocks — `.image(data, mimeType)`, `.audio(data, mimeType)`, or `ctx.content(block)` for a raw block. Prepended to `content[]` after `format()`; never enters `structuredContent`. |
166
+ | `ctx.signal` | `AbortSignal` for cancellation. |
167
+ | `ctx.requestId` | Unique request ID. |
168
+ | `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
169
+
170
+ ---
171
+
172
+ ## Errors
173
+
174
+ Handlers throw — the framework catches, classifies, and formats.
175
+
176
+ **Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required descriptive metadata for the agent's next move (≥ 5 words, lint-validated); for the wire `data.recovery.hint` (mirrored into `content[]` text), pass explicitly at the throw site when dynamic context matters: `ctx.fail('reason', msg, { recovery: { hint: '...' } })`. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
177
+
178
+ ```ts
179
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
180
+
181
+ errors: [
182
+ { reason: 'no_match', code: JsonRpcErrorCode.NotFound,
183
+ when: 'No item matched the query',
184
+ recovery: 'Broaden the query or check the spelling and try again.' },
185
+ ],
186
+ async handler(input, ctx) {
187
+ const item = await db.find(input.id);
188
+ if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
189
+ return item;
190
+ }
191
+ ```
192
+
193
+ **Declare contracts inline on each tool.** The contract is part of the tool's public surface — one file should give the full picture. Don't extract a shared `errors[]` constant; per-tool repetition is the intended cost of locality.
194
+
195
+ **Fallback (no contract entry fits):** throw via factories or plain `Error`.
196
+
197
+ ```ts
198
+ // Error factories — explicit code
199
+ import { notFound, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
200
+ throw notFound('Item not found', { itemId });
201
+ throw serviceUnavailable('API unavailable', { url }, { cause: err });
202
+
203
+ // Plain Error — framework auto-classifies from message patterns
204
+ throw new Error('Item not found'); // → NotFound
205
+ throw new Error('Invalid query format'); // → ValidationError
206
+
207
+ // McpError — when no factory exists for the code
208
+ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
209
+ throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
210
+ ```
211
+
212
+ See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table, all available factories, and the contract reference.
213
+
214
+ ---
215
+
216
+ ## Structure
217
+
218
+ ```text
219
+ src/
220
+ index.ts # createApp() entry point
221
+ config/
222
+ server-config.ts # Server-specific env vars (Zod schema)
223
+ services/
224
+ [domain]/
225
+ [domain]-service.ts # Domain service (init/accessor pattern)
226
+ types.ts # Domain types
227
+ mcp-server/
228
+ tools/definitions/
229
+ [tool-name].tool.ts # Tool definitions
230
+ resources/definitions/
231
+ [resource-name].resource.ts # Resource definitions
232
+ prompts/definitions/
233
+ [prompt-name].prompt.ts # Prompt definitions
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Naming
239
+
240
+ | What | Convention | Example |
241
+ |:-----|:-----------|:--------|
242
+ | Files | kebab-case with suffix | `search-docs.tool.ts` |
243
+ | Tool/resource/prompt names | snake_case | `search_docs` |
244
+ | Directories | kebab-case | `src/services/doc-search/` |
245
+ | Descriptions | Single string or template literal, no `+` concatenation | `'Search items by query and filter.'` |
246
+
247
+ ---
248
+
249
+ ## Skills
250
+
251
+ Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
252
+
253
+ **Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). This makes skills available as context without needing to reference `skills/` paths manually. After framework updates, run the `maintenance` skill — it re-syncs the agent directory automatically (Phase B).
254
+
255
+ Available skills:
256
+
257
+ | Skill | Purpose |
258
+ |:------|:--------|
259
+ | `setup` | Post-init project orientation |
260
+ | `design-mcp-server` | Design tool surface, resources, and services for a new server |
261
+ | `add-tool` | Scaffold a new tool definition |
262
+ | `add-app-tool` | Scaffold an MCP App tool + paired UI resource |
263
+ | `add-resource` | Scaffold a new resource definition |
264
+ | `add-prompt` | Scaffold a new prompt definition |
265
+ | `add-service` | Scaffold a new service integration |
266
+ | `add-test` | Scaffold test file for a tool, resource, or service |
267
+ | `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
268
+ | `tool-defs-analysis` | Read-only audit of definition language: voice, leaks, defaults, recovery hints, examples |
269
+ | `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
270
+ | `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
271
+ | `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
272
+ | `maintenance` | Investigate changelogs, adopt upstream changes, and sync skills after `bun update --latest` |
273
+ | `git-wrapup` | Version bump, changelog, commit, and tag — stops before push/publish |
274
+ | `release-and-publish` | Ship a release: verification gate, push commits+tags, publish to npm / MCP Registry / GHCR / `.mcpb` bundle on GitHub Releases |
275
+ | `api-auth` | Auth modes, scopes, JWT/OAuth |
276
+ | `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
277
+ | `api-config` | AppConfig, parseConfig, env vars |
278
+ | `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
279
+ | `api-errors` | McpError, JsonRpcErrorCode, error patterns |
280
+ | `api-linter` | Definition lint rules reference (`format-parity`, `schema-*`, `server-json-*`, …) |
281
+ | `api-services` | LLM, Speech, Graph services |
282
+ | `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
283
+ | `api-testing` | createMockContext, test patterns |
284
+ | `api-utils` | Formatting, parsing, security, pagination, scheduling, telemetry helpers |
285
+ | `api-mirror` | MirrorService: persistent SQLite-backed local mirror of bulk upstream datasets — Tier 3 opt-in |
286
+ | `api-workers` | Cloudflare Workers runtime |
287
+ | `orchestrations` | Chain task skills into a gated multi-phase pipeline when sub-agents are available |
288
+ | `techniques` | Catalog of response/data-shaping techniques — overflow handling, payload shaping, retrieval patterns |
289
+ | `report-issue-framework` | File bug/feature request against @cyanheads/mcp-ts-core |
290
+ | `report-issue-local` | File bug/feature request against this server's repo |
291
+
292
+ When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
293
+
294
+ ---
295
+
296
+ ## Commands
297
+
298
+ | Command | Purpose |
299
+ |:--------|:--------|
300
+ | `bun run build` | Compile TypeScript |
301
+ | `bun run rebuild` | Clean + build |
302
+ | `bun run clean` | Remove build artifacts |
303
+ | `bun run devcheck` | Lint + format + typecheck + security + packaging alignment |
304
+ | `bun run audit:refresh` | Delete `bun.lock`, reinstall, and re-run `bun audit`. Use when `devcheck` flags a transitive advisory — Bun's `update` is sticky on transitive resolutions, so the advisory may be a stale-lockfile false positive. If it survives the refresh, it's real. |
305
+ | `bun run tree` | Generate directory structure doc |
306
+ | `bun run format` | Auto-fix formatting |
307
+ | `bun run format:unsafe` | Apply behavior-changing Biome fixes for manual review |
308
+ | `bun run test` | Run tests |
309
+ | `bun run lint:mcp` | Validate MCP definitions against spec |
310
+ | `bun run lint:packaging` | Validate env var alignment between `manifest.json` and `server.json` (skipped cleanly when `manifest.json` is absent) |
311
+ | `bun run list-skills` | List skills in `skills/` with name + description |
312
+ | `bun run release:github` | Create GitHub Release from the latest annotated tag (attach `.mcpb`, enforce title format) |
313
+ | `bun run bundle` | Build and pack as `dist/eurostat-mcp-server.mcpb` for one-click Claude Desktop install |
314
+ | `bun run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
315
+ | `bun run changelog:check` | Verify `CHANGELOG.md` is in sync with `changelog/` |
316
+ | `bun run start:stdio` | Production mode (stdio) |
317
+ | `bun run start:http` | Production mode (HTTP) |
318
+
319
+ ---
320
+
321
+ ## Bundling
322
+
323
+ `bun run bundle` produces `dist/eurostat-mcp-server.mcpb` for one-click install in Claude Desktop. MCPB is stdio-only — HTTP and Docker deployments are unaffected.
324
+
325
+ **Adding an env var requires both files:** `server.json` stdio `environmentVariables[]` (registry discovery) and `manifest.json` `mcp_config.env` (bundle install UX, plus `user_config` if user-prompted). `bun run lint:packaging` (run by `devcheck`) verifies the env var names align.
326
+
327
+ **README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and config-generation commands are ship-time concerns — see the `polish-docs-meta` skill (`skills/polish-docs-meta/references/readme.md`).
328
+
329
+ ---
330
+
331
+ ## Changelog
332
+
333
+ The source of truth is one file per release under `changelog/<major.minor>.x/<version>.md`. `CHANGELOG.md` is a generated navigation index; never hand-edit it. `changelog/template.md` is a pristine framework reference and must remain synced from the installed package.
334
+
335
+ Per-version frontmatter requires a one-line `summary`; use `breaking: true` only for consumer-facing breaks and `security: true` only for a security fix in this server's own source. Optional `agent-notes` carry downstream adoption instructions and do not render in `CHANGELOG.md`.
336
+
337
+ ---
338
+
339
+ ## Publishing
340
+
341
+ Run the `release-and-publish` skill after git wrapup — it runs the verification gate (`devcheck`, `rebuild`, `test`), pushes commits and tags, and publishes to npm, the MCP Registry, GHCR, and attaches the `.mcpb` bundle to the GitHub Release, halting on the first failure. For reference, the underlying commands are:
342
+
343
+ ```bash
344
+ bun publish --access public
345
+
346
+ docker buildx build --platform linux/amd64,linux/arm64 \
347
+ -t ghcr.io/cyanheads/eurostat-mcp-server:<version> \
348
+ -t ghcr.io/cyanheads/eurostat-mcp-server:latest \
349
+ --push .
350
+
351
+ mcp-publisher publish
352
+ ```
353
+
354
+ ---
355
+
356
+ ## Imports
357
+
358
+ ```ts
359
+ // Framework — z is re-exported, no separate zod import needed
360
+ import { tool, z } from '@cyanheads/mcp-ts-core';
361
+ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
362
+
363
+ // Server's own code — via path alias
364
+ import { getMyService } from '@/services/my-domain/my-service.js';
365
+ ```
366
+
367
+ ---
368
+
369
+ ## Checklist
370
+
371
+ - [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, `z.bigint()`, `z.symbol()`, `z.void()`, `z.map()`, `z.set()`, `z.function()`, `z.nan()`)
372
+ - [ ] Optional nested objects: handler guards for empty inner values from form-based clients (`if (input.obj?.field && ...)`, not just `if (input.obj)`). When regex/length constraints matter, use `z.union([z.literal(''), z.string().regex(...).describe(...)])` — literal variants are exempt from `describe-on-fields`.
373
+ - [ ] JSDoc `@fileoverview` + `@module` on every file
374
+ - [ ] `ctx.log` for logging, `ctx.state` for storage
375
+ - [ ] Missing input reads `ctx.inputs` first, then returns `ctx.requestInput(...)`
376
+ - [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
377
+ - [ ] `format()` renders all data the LLM needs — different clients forward different surfaces (Claude Code → `structuredContent`, Claude Desktop → `content[]`); both must carry the same data
378
+ - [ ] If wrapping external API: raw/domain/output schemas reviewed against real upstream sparsity/nullability before finalizing required vs optional fields
379
+ - [ ] If wrapping external API: normalization and `format()` preserve uncertainty; do not fabricate facts from missing upstream data
380
+ - [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
381
+ - [ ] Registered in `createApp()` arrays (directly or via barrel exports)
382
+ - [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
383
+ - [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = package name; `interface.shortDescription` from `package.json` description
384
+ - [ ] `.codex-plugin/mcp.json` updated — server name key matches `package.json` name; env vars added for any required API keys
385
+ - [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry with server name key, env vars for any required API keys
386
+ - [ ] `bun run devcheck` passes
package/CLAUDE.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # Agent Protocol
2
2
 
3
3
  **Server:** @cyanheads/eurostat-mcp-server
4
- **Version:** 0.6.0
5
- **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.1`
4
+ **Version:** 0.6.2
5
+ **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.12.3`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
+ **MCP SDK:** `@modelcontextprotocol/server` `^2.0.0`
7
8
  **Zod:** `^4.4.3`
8
9
 
9
10
  > **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
@@ -34,7 +35,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
34
35
  - **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
35
36
  - **Use `ctx.log`** for request-scoped logging. No `console` calls.
36
37
  - **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
37
- - **Check `ctx.elicit`** for presence before calling.
38
+ - **Need input the caller didn't supply?** `return ctx.requestInput(...)` and read `ctx.inputs` when the handler is re-entered. Never `await` for user input mid-handler.
38
39
  - **Secrets in env vars only** — never hardcoded.
39
40
  - **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
40
41
 
@@ -90,7 +91,7 @@ export const itemData = resource('inventory://{itemId}', {
90
91
  params: z.object({ itemId: z.string().describe('Item identifier') }),
91
92
  auth: ['inventory:read'],
92
93
  async handler(params, ctx) {
93
- const item = await ctx.state.get(`item:${params.itemId}`);
94
+ const item = await ctx.state.get(`item/${params.itemId}`);
94
95
  if (!item) throw notFound(`Item ${params.itemId} not found`, { itemId: params.itemId });
95
96
  return item;
96
97
  },
@@ -124,6 +125,7 @@ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
124
125
  const ServerConfigSchema = z.object({
125
126
  apiKey: z.string().describe('External API key'),
126
127
  maxResults: z.coerce.number().default(100),
128
+ verboseLogging: z.stringbool().default(false).describe('Enable verbose logging'),
127
129
  });
128
130
 
129
131
  let _config: z.infer<typeof ServerConfigSchema> | undefined;
@@ -131,6 +133,7 @@ export function getServerConfig() {
131
133
  _config ??= parseEnvConfig(ServerConfigSchema, {
132
134
  apiKey: 'MY_API_KEY',
133
135
  maxResults: 'MY_MAX_RESULTS',
136
+ verboseLogging: 'MY_VERBOSE_LOGGING',
134
137
  });
135
138
  return _config;
136
139
  }
@@ -138,6 +141,14 @@ export function getServerConfig() {
138
141
 
139
142
  `parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
140
143
 
144
+ For env booleans use `z.stringbool()`, never `z.coerce.boolean()` — `Boolean("false")` is `true`, so a coerced flag can't be disabled through the environment. `z.stringbool()` parses `true/false/1/0/yes/no/on/off` and rejects anything else.
145
+
146
+ ### Server identity and instructions
147
+
148
+ `createApp()` accepts optional identity fields forwarded to the SDK's `initialize` response and the server manifest. Keep this server's in-code identity to `name: 'eurostat-mcp-server'` and `title: 'eurostat-mcp-server'`; package metadata remains authoritative for the description and website.
149
+
150
+ `instructions` is optional server-level orientation, sent on every `initialize` as session-level context. Use it for deployment guidance and cross-tool workflows instead of repeating the same context across tool descriptions.
151
+
141
152
  ---
142
153
 
143
154
  ## Context
@@ -146,13 +157,13 @@ Handlers receive a unified `ctx` object. Key properties:
146
157
 
147
158
  | Property | Description |
148
159
  |:---------|:------------|
149
- | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
160
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino and client `notifications/message`, so treat it as client-visible. |
150
161
  | `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
151
- | `ctx.elicit` | Ask user for structured input — form call `(message, schema)` or `.url(message, url)` for an external link. **Check for presence first:** `if (ctx.elicit) { ... }` |
162
+ | `ctx.requestInput` | Suspend and ask the caller for more input — `return ctx.requestInput({ inputRequests: { key: inputRequired.elicit({ message, requestedSchema }) } })`. Never returns; the handler is re-entered with the answers. |
163
+ | `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. |
152
164
  | `ctx.enrich` | Success-path agent context (empty-result notices, query echo, pagination totals) — `ctx.enrich(...)` or `.notice()` / `.total()` / `.echo()` / `.truncated()`. Reaches `structuredContent` and `content[]`; lands only when the definition declares an `enrichment` block (no-op otherwise). |
153
165
  | `ctx.content` | Non-text content blocks — `.image(data, mimeType)`, `.audio(data, mimeType)`, or `ctx.content(block)` for a raw block. Prepended to `content[]` after `format()`; never enters `structuredContent`. |
154
166
  | `ctx.signal` | `AbortSignal` for cancellation. |
155
- | `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
156
167
  | `ctx.requestId` | Unique request ID. |
157
168
  | `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
158
169
 
@@ -174,7 +185,7 @@ errors: [
174
185
  ],
175
186
  async handler(input, ctx) {
176
187
  const item = await db.find(input.id);
177
- if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
188
+ if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
178
189
  return item;
179
190
  }
180
191
  ```
@@ -264,7 +275,7 @@ Available skills:
264
275
  | `api-auth` | Auth modes, scopes, JWT/OAuth |
265
276
  | `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
266
277
  | `api-config` | AppConfig, parseConfig, env vars |
267
- | `api-context` | Context interface, logger, state, progress |
278
+ | `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
268
279
  | `api-errors` | McpError, JsonRpcErrorCode, error patterns |
269
280
  | `api-linter` | Definition lint rules reference (`format-parity`, `schema-*`, `server-json-*`, …) |
270
281
  | `api-services` | LLM, Speech, Graph services |
@@ -293,12 +304,15 @@ When you complete a skill's checklist, check the boxes and add a completion time
293
304
  | `bun run audit:refresh` | Delete `bun.lock`, reinstall, and re-run `bun audit`. Use when `devcheck` flags a transitive advisory — Bun's `update` is sticky on transitive resolutions, so the advisory may be a stale-lockfile false positive. If it survives the refresh, it's real. |
294
305
  | `bun run tree` | Generate directory structure doc |
295
306
  | `bun run format` | Auto-fix formatting |
307
+ | `bun run format:unsafe` | Apply behavior-changing Biome fixes for manual review |
296
308
  | `bun run test` | Run tests |
297
309
  | `bun run lint:mcp` | Validate MCP definitions against spec |
298
310
  | `bun run lint:packaging` | Validate env var alignment between `manifest.json` and `server.json` (skipped cleanly when `manifest.json` is absent) |
299
311
  | `bun run list-skills` | List skills in `skills/` with name + description |
300
312
  | `bun run release:github` | Create GitHub Release from the latest annotated tag (attach `.mcpb`, enforce title format) |
301
313
  | `bun run bundle` | Build and pack as `dist/eurostat-mcp-server.mcpb` for one-click Claude Desktop install |
314
+ | `bun run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
315
+ | `bun run changelog:check` | Verify `CHANGELOG.md` is in sync with `changelog/` |
302
316
  | `bun run start:stdio` | Production mode (stdio) |
303
317
  | `bun run start:http` | Production mode (HTTP) |
304
318
 
@@ -314,6 +328,14 @@ When you complete a skill's checklist, check the boxes and add a completion time
314
328
 
315
329
  ---
316
330
 
331
+ ## Changelog
332
+
333
+ The source of truth is one file per release under `changelog/<major.minor>.x/<version>.md`. `CHANGELOG.md` is a generated navigation index; never hand-edit it. `changelog/template.md` is a pristine framework reference and must remain synced from the installed package.
334
+
335
+ Per-version frontmatter requires a one-line `summary`; use `breaking: true` only for consumer-facing breaks and `security: true` only for a security fix in this server's own source. Optional `agent-notes` carry downstream adoption instructions and do not render in `CHANGELOG.md`.
336
+
337
+ ---
338
+
317
339
  ## Publishing
318
340
 
319
341
  Run the `release-and-publish` skill after git wrapup — it runs the verification gate (`devcheck`, `rebuild`, `test`), pushes commits and tags, and publishes to npm, the MCP Registry, GHCR, and attaches the `.mcpb` bundle to the GitHub Release, halting on the first failure. For reference, the underlying commands are:
@@ -350,6 +372,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
350
372
  - [ ] Optional nested objects: handler guards for empty inner values from form-based clients (`if (input.obj?.field && ...)`, not just `if (input.obj)`). When regex/length constraints matter, use `z.union([z.literal(''), z.string().regex(...).describe(...)])` — literal variants are exempt from `describe-on-fields`.
351
373
  - [ ] JSDoc `@fileoverview` + `@module` on every file
352
374
  - [ ] `ctx.log` for logging, `ctx.state` for storage
375
+ - [ ] Missing input reads `ctx.inputs` first, then returns `ctx.requestInput(...)`
353
376
  - [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
354
377
  - [ ] `format()` renders all data the LLM needs — different clients forward different surfaces (Claude Code → `structuredContent`, Claude Desktop → `content[]`); both must carry the same data
355
378
  - [ ] If wrapping external API: raw/domain/output schemas reviewed against real upstream sparsity/nullability before finalizing required vs optional fields
package/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # ==============================================================================
2
2
  # Build Stage
3
3
  # ==============================================================================
4
- FROM oven/bun:1.3.14 AS build
4
+ FROM --platform=$BUILDPLATFORM oven/bun:1.4.0 AS build
5
5
 
6
6
  WORKDIR /usr/src/app
7
7
 
@@ -27,7 +27,7 @@ RUN bun run build
27
27
  # application. It uses a slim base image and only includes production
28
28
  # dependencies and build artifacts.
29
29
  # ==============================================================================
30
- FROM oven/bun:1.3.14-slim AS production
30
+ FROM oven/bun:1.4.0-slim AS production
31
31
 
32
32
  WORKDIR /usr/src/app
33
33
 
@@ -38,7 +38,7 @@ ENV NODE_ENV=production
38
38
  # OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
39
39
  ARG APP_VERSION
40
40
  LABEL org.opencontainers.image.title="@cyanheads/eurostat-mcp-server"
41
- LABEL org.opencontainers.image.description="Search and query 8,933 Eurostat datasets — EU economy, demography, trade, health, and NUTS regional data via MCP. STDIO or Streamable HTTP."
41
+ LABEL org.opencontainers.image.description="Search and query the Eurostat catalogue — EU economy, demography, trade, health, and NUTS regional data via MCP. STDIO or Streamable HTTP."
42
42
  LABEL org.opencontainers.image.licenses="Apache-2.0"
43
43
  LABEL org.opencontainers.image.version="${APP_VERSION}"
44
44
  LABEL org.opencontainers.image.source="https://github.com/cyanheads/eurostat-mcp-server"
@@ -52,7 +52,7 @@ COPY package.json bun.lock ./
52
52
  # the canvas is gated at runtime by CANVAS_PROVIDER_TYPE, not at build time, so the
53
53
  # image always carries the binding and a deployment turns the feature on with an env var.
54
54
  RUN --mount=type=cache,target=/root/.bun/install/cache \
55
- bun install --production --frozen-lockfile --ignore-scripts
55
+ bun install --production --omit=peer --frozen-lockfile --ignore-scripts
56
56
 
57
57
  # Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
58
58
  # These are not bundled by default to keep the base image lean. Enable at build time
@@ -60,7 +60,7 @@ RUN --mount=type=cache,target=/root/.bun/install/cache \
60
60
  ARG OTEL_ENABLED=true
61
61
  RUN --mount=type=cache,target=/root/.bun/install/cache \
62
62
  if [ "$OTEL_ENABLED" = "true" ]; then \
63
- bun add --omit=dev --ignore-scripts @hono/otel \
63
+ bun add --omit=dev --omit=peer --ignore-scripts @hono/otel \
64
64
  @opentelemetry/instrumentation-http \
65
65
  @opentelemetry/exporter-metrics-otlp-http \
66
66
  @opentelemetry/exporter-trace-otlp-http \