@cyanheads/aviation-weather-mcp-server 0.1.1

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 (49) hide show
  1. package/AGENTS.md +379 -0
  2. package/CLAUDE.md +379 -0
  3. package/Dockerfile +99 -0
  4. package/LICENSE +201 -0
  5. package/README.md +311 -0
  6. package/changelog/0.1.x/0.1.1.md +23 -0
  7. package/changelog/template.md +127 -0
  8. package/dist/config/server-config.d.ts +14 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +31 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +31 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/prompts/definitions/aviation-preflight-brief.prompt.d.ts +12 -0
  17. package/dist/mcp-server/prompts/definitions/aviation-preflight-brief.prompt.d.ts.map +1 -0
  18. package/dist/mcp-server/prompts/definitions/aviation-preflight-brief.prompt.js +65 -0
  19. package/dist/mcp-server/prompts/definitions/aviation-preflight-brief.prompt.js.map +1 -0
  20. package/dist/mcp-server/tools/definitions/aviation-find-stations.tool.d.ts +40 -0
  21. package/dist/mcp-server/tools/definitions/aviation-find-stations.tool.d.ts.map +1 -0
  22. package/dist/mcp-server/tools/definitions/aviation-find-stations.tool.js +130 -0
  23. package/dist/mcp-server/tools/definitions/aviation-find-stations.tool.js.map +1 -0
  24. package/dist/mcp-server/tools/definitions/aviation-get-advisories.tool.d.ts +49 -0
  25. package/dist/mcp-server/tools/definitions/aviation-get-advisories.tool.d.ts.map +1 -0
  26. package/dist/mcp-server/tools/definitions/aviation-get-advisories.tool.js +133 -0
  27. package/dist/mcp-server/tools/definitions/aviation-get-advisories.tool.js.map +1 -0
  28. package/dist/mcp-server/tools/definitions/aviation-get-metar.tool.d.ts +42 -0
  29. package/dist/mcp-server/tools/definitions/aviation-get-metar.tool.d.ts.map +1 -0
  30. package/dist/mcp-server/tools/definitions/aviation-get-metar.tool.js +129 -0
  31. package/dist/mcp-server/tools/definitions/aviation-get-metar.tool.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/aviation-get-pireps.tool.d.ts +60 -0
  33. package/dist/mcp-server/tools/definitions/aviation-get-pireps.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/aviation-get-pireps.tool.js +238 -0
  35. package/dist/mcp-server/tools/definitions/aviation-get-pireps.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/aviation-get-taf.tool.d.ts +42 -0
  37. package/dist/mcp-server/tools/definitions/aviation-get-taf.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/aviation-get-taf.tool.js +140 -0
  39. package/dist/mcp-server/tools/definitions/aviation-get-taf.tool.js.map +1 -0
  40. package/dist/services/aviation-weather/aviation-weather-service.d.ts +60 -0
  41. package/dist/services/aviation-weather/aviation-weather-service.d.ts.map +1 -0
  42. package/dist/services/aviation-weather/aviation-weather-service.js +512 -0
  43. package/dist/services/aviation-weather/aviation-weather-service.js.map +1 -0
  44. package/dist/services/aviation-weather/types.d.ts +283 -0
  45. package/dist/services/aviation-weather/types.d.ts.map +1 -0
  46. package/dist/services/aviation-weather/types.js +7 -0
  47. package/dist/services/aviation-weather/types.js.map +1 -0
  48. package/package.json +107 -0
  49. package/server.json +127 -0
package/CLAUDE.md ADDED
@@ -0,0 +1,379 @@
1
+ # Developer Protocol
2
+
3
+ **Server:** `@cyanheads/aviation-weather-mcp-server`
4
+ **Version:** 0.1.1
5
+ **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.9.21`
6
+ **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
+ **MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.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's next or needs direction, suggest options based on the current project state. Common next steps:
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
+ - **Check `ctx.elicit` / `ctx.sample`** for presence before calling.
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
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
51
+ import { getAviationWeatherService } from '@/services/aviation-weather/aviation-weather-service.js';
52
+
53
+ export const aviationGetMetar = tool('aviation_get_metar', {
54
+ description: 'Get current weather observations (METARs) for one or more airports.',
55
+ annotations: { readOnlyHint: true, idempotentHint: true },
56
+ input: z.object({
57
+ station_ids: z
58
+ .array(z.string().regex(/^[A-Z]{4}$/).describe('4-letter ICAO station ID.'))
59
+ .min(1).max(10)
60
+ .describe('ICAO station IDs to query. 1–10 stations per call.'),
61
+ hours: z.number().int().min(1).max(12).default(1)
62
+ .describe('Hours of observation history to return (1–12).'),
63
+ }),
64
+ output: z.object({
65
+ observations: z.array(z.object({
66
+ station_id: z.string().describe('ICAO station identifier.'),
67
+ flight_category: z.string().describe('VFR, MVFR, IFR, or LIFR.'),
68
+ raw_metar: z.string().describe('Raw METAR string.'),
69
+ })).describe('Decoded METAR observations.'),
70
+ }),
71
+ errors: [
72
+ {
73
+ reason: 'no_stations_found',
74
+ code: JsonRpcErrorCode.NotFound,
75
+ when: 'None of the requested station IDs returned data.',
76
+ recovery: 'Verify ICAO IDs with aviation_find_stations.',
77
+ },
78
+ ],
79
+ async handler(input, ctx) {
80
+ const svc = getAviationWeatherService();
81
+ const raw = await svc.fetchMetar(input.station_ids, input.hours);
82
+ if (!raw.length) throw ctx.fail('no_stations_found', `No METARs found for ${input.station_ids.join(', ')}`);
83
+ ctx.log.info('METARs fetched', { count: raw.length });
84
+ return { observations: raw };
85
+ },
86
+ format: (result) => [{
87
+ type: 'text',
88
+ text: result.observations.map(o => `**${o.station_id}** (${o.flight_category}): ${o.raw_metar}`).join('\n'),
89
+ }],
90
+ });
91
+ ```
92
+
93
+ ### Prompt
94
+
95
+ ```ts
96
+ import { prompt, z } from '@cyanheads/mcp-ts-core';
97
+
98
+ export const aviationPreflightBrief = prompt('aviation_preflight_brief', {
99
+ description: 'Structure a preflight weather briefing for one or more airports.',
100
+ args: z.object({
101
+ departure_icao: z.string().describe('Departure airport ICAO ID (e.g., KSEA).'),
102
+ destination_icao: z.string().describe('Destination airport ICAO ID (e.g., KJFK).'),
103
+ alternates: z.string().optional().describe('Comma-separated alternate airport ICAO IDs.'),
104
+ }),
105
+ generate: (args) => [
106
+ { role: 'user', content: { type: 'text', text:
107
+ `Provide a preflight weather briefing for ${args.departure_icao} → ${args.destination_icao}` +
108
+ (args.alternates ? ` (alternates: ${args.alternates})` : '') + '.\n' +
109
+ 'Call aviation_get_metar, aviation_get_taf, and aviation_get_advisories in sequence, then synthesize a go/no-go picture.'
110
+ }},
111
+ ],
112
+ });
113
+ ```
114
+
115
+ ### Server config
116
+
117
+ ```ts
118
+ // src/config/server-config.ts
119
+ import { z } from '@cyanheads/mcp-ts-core';
120
+ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
121
+
122
+ const ServerConfigSchema = z.object({
123
+ awcBaseUrl: z.string().url().default('https://aviationweather.gov/api/data')
124
+ .describe('Base URL for the AWC Data API'),
125
+ awcTimeoutMs: z.coerce.number().int().min(1000).max(60000).default(10000)
126
+ .describe('Request timeout in milliseconds'),
127
+ });
128
+
129
+ let _config: z.infer<typeof ServerConfigSchema> | undefined;
130
+ export function getServerConfig() {
131
+ _config ??= parseEnvConfig(ServerConfigSchema, {
132
+ awcBaseUrl: 'AWC_BASE_URL',
133
+ awcTimeoutMs: 'AWC_TIMEOUT_MS',
134
+ });
135
+ return _config;
136
+ }
137
+ ```
138
+
139
+ `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
+
141
+ ### Server instructions
142
+
143
+ `createApp({ instructions })` — optional server-level orientation, sent to clients on every `initialize` as session-level context. Use it for deployment guidance (connection aliases, regional notes, scope hints) instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
144
+
145
+ ---
146
+
147
+ ## Context
148
+
149
+ Handlers receive a unified `ctx` object. Key properties:
150
+
151
+ | Property | Description |
152
+ |:---------|:------------|
153
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
154
+ | `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
155
+ | `ctx.elicit` | Ask user for structured input. **Check for presence first:** `if (ctx.elicit) { ... }` |
156
+ | `ctx.sample` | Request LLM completion from the client. **Check for presence first:** `if (ctx.sample) { ... }` |
157
+ | `ctx.signal` | `AbortSignal` for cancellation. |
158
+ | `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
159
+ | `ctx.requestId` | Unique request ID. |
160
+ | `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio. |
161
+
162
+ ---
163
+
164
+ ## Errors
165
+
166
+ Handlers throw — the framework catches, classifies, and formats.
167
+
168
+ **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.
169
+
170
+ ```ts
171
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
172
+
173
+ errors: [
174
+ { reason: 'no_match', code: JsonRpcErrorCode.NotFound,
175
+ when: 'No item matched the query',
176
+ recovery: 'Broaden the query or check the spelling and try again.' },
177
+ ],
178
+ async handler(input, ctx) {
179
+ const item = await db.find(input.id);
180
+ if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
181
+ return item;
182
+ }
183
+ ```
184
+
185
+ **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.
186
+
187
+ **Fallback (no contract entry fits):** throw via factories or plain `Error`.
188
+
189
+ ```ts
190
+ // Error factories — explicit code
191
+ import { notFound, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
192
+ throw notFound('Item not found', { itemId });
193
+ throw serviceUnavailable('API unavailable', { url }, { cause: err });
194
+
195
+ // Plain Error — framework auto-classifies from message patterns
196
+ throw new Error('Item not found'); // → NotFound
197
+ throw new Error('Invalid query format'); // → ValidationError
198
+
199
+ // McpError — when no factory exists for the code
200
+ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
201
+ throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
202
+ ```
203
+
204
+ See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table, all available factories, and the contract reference.
205
+
206
+ ---
207
+
208
+ ## Structure
209
+
210
+ ```text
211
+ src/
212
+ index.ts # createApp() entry point
213
+ config/
214
+ server-config.ts # AWC_BASE_URL and AWC_TIMEOUT_MS (Zod schema)
215
+ services/
216
+ aviation-weather/
217
+ aviation-weather-service.ts # AWC Data API client (fetch, retry, normalize)
218
+ types.ts # Raw API response shapes + normalized output types
219
+ mcp-server/
220
+ tools/definitions/
221
+ aviation-find-stations.tool.ts # aviation_find_stations
222
+ aviation-get-advisories.tool.ts # aviation_get_advisories
223
+ aviation-get-metar.tool.ts # aviation_get_metar
224
+ aviation-get-pireps.tool.ts # aviation_get_pireps
225
+ aviation-get-taf.tool.ts # aviation_get_taf
226
+ aviation-preflight-brief.prompt.ts # aviation_preflight_brief
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Naming
232
+
233
+ | What | Convention | Example |
234
+ |:-----|:-----------|:--------|
235
+ | Files | kebab-case with suffix | `search-docs.tool.ts` |
236
+ | Tool/resource/prompt names | snake_case | `search_docs` |
237
+ | Directories | kebab-case | `src/services/doc-search/` |
238
+ | Descriptions | Single string or template literal, no `+` concatenation | `'Search items by query and filter.'` |
239
+
240
+ ---
241
+
242
+ ## Skills
243
+
244
+ 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.
245
+
246
+ **Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
247
+
248
+ Available skills:
249
+
250
+ | Skill | Purpose |
251
+ |:------|:--------|
252
+ | `setup` | Post-init project orientation |
253
+ | `design-mcp-server` | Design tool surface, resources, and services for a new server |
254
+ | `add-tool` | Scaffold a new tool definition |
255
+ | `add-app-tool` | Scaffold an MCP App tool + paired UI resource |
256
+ | `add-resource` | Scaffold a new resource definition |
257
+ | `add-prompt` | Scaffold a new prompt definition |
258
+ | `add-service` | Scaffold a new service integration |
259
+ | `add-test` | Scaffold test file for a tool, resource, or service |
260
+ | `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
261
+ | `tool-defs-analysis` | Read-only audit of MCP definition language across the surface — voice, leaks, defaults, recovery hints, output descriptions |
262
+ | `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
263
+ | `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
264
+ | `devcheck` | Lint, format, typecheck, audit |
265
+ | `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
266
+ | `git-wrapup` | Land working-tree changes as a versioned commit + annotated tag — version bump, changelog, verify, tag. Local only. |
267
+ | `release-and-publish` | Push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
268
+ | `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
269
+ | `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
270
+ | `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
271
+ | `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
272
+ | `api-auth` | Auth modes, scopes, JWT/OAuth |
273
+ | `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
274
+ | `api-config` | AppConfig, parseConfig, env vars |
275
+ | `api-context` | Context interface, logger, state, progress |
276
+ | `api-errors` | McpError, JsonRpcErrorCode, error patterns |
277
+ | `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
278
+ | `api-services` | LLM, Speech, Graph services |
279
+ | `api-testing` | createMockContext, test patterns |
280
+ | `api-utils` | Formatting, parsing, security, pagination, scheduling, telemetry helpers |
281
+ | `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
282
+ | `api-workers` | Cloudflare Workers runtime |
283
+
284
+ **Chaining skills into pipelines.** When the user wants a multi-phase effort — build this server out, QA-and-fix the surface, update-and-ship — *and you can spawn sub-agents*, `skills/orchestrations/SKILL.md` sequences the task skills above into a gated pipeline with verification at each step. Read it to drive the run. Optional: skip it if you can't orchestrate sub-agents, and ignore it entirely if you were *spawned* as one — you've already been scoped to a single phase.
285
+
286
+ When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
287
+
288
+ ---
289
+
290
+ ## Commands
291
+
292
+ **Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work. `bun` is slightly faster for script invocation but not required.
293
+
294
+ | Command | Purpose |
295
+ |:--------|:--------|
296
+ | `npm run build` | Compile TypeScript |
297
+ | `npm run rebuild` | Clean + build |
298
+ | `npm run clean` | Remove build artifacts |
299
+ | `npm run devcheck` | Lint + format + typecheck + security + changelog sync |
300
+ | `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. |
301
+ | `npm run tree` | Generate directory structure doc |
302
+ | `npm run format` | Auto-fix formatting (safe fixes only) |
303
+ | `npm run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior |
304
+ | `npm test` | Run tests |
305
+ | `npm run start:stdio` | Production mode (stdio) |
306
+ | `npm run start:http` | Production mode (HTTP) |
307
+ | `npm run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
308
+ | `npm run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
309
+ | `npm run bundle` | Build and pack as `.mcpb` for one-click Claude Desktop install |
310
+
311
+ ---
312
+
313
+ ## Bundling
314
+
315
+ `npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. MCPB is stdio-only — HTTP and Cloudflare Workers deployments are unaffected. Consumers who don't need it can delete `manifest.json` and `.mcpbignore`; `lint:packaging` skips cleanly.
316
+
317
+ **Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match.
318
+
319
+ **README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
320
+
321
+ ---
322
+
323
+ ## Changelog
324
+
325
+ Directory-based, grouped by minor series via the `.x` semver-wildcard convention. Source of truth: `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.1.x/0.1.0.md`) — one file per release, shipped in the npm package. At release, author the per-version file with a concrete version and date, then run `npm run changelog:build` to regenerate the rollup. `changelog/template.md` is a **pristine format reference** — never edited or moved; read it for the frontmatter + section layout when scaffolding. `CHANGELOG.md` is a **navigation index** (header + link + summary per version), regenerated by `npm run changelog:build` — devcheck hard-fails on drift; never hand-edit it.
326
+
327
+ Each per-version file opens with YAML frontmatter:
328
+
329
+ ```markdown
330
+ ---
331
+ summary: "One-line headline, ≤350 chars" # required — powers the rollup index
332
+ breaking: false # optional — true flags breaking changes
333
+ security: false # optional — true flags security fixes
334
+ ---
335
+
336
+ # 0.1.0 — YYYY-MM-DD
337
+ ...
338
+ ```
339
+
340
+ `breaking: true` renders a `· ⚠️ Breaking` badge — use it when consumers must update code on upgrade (signature changes, removed APIs, config renames). `security: true` renders a `· 🛡️ Security` badge and pairs with a `## Security` body section. When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
341
+
342
+ `agent-notes` is an optional free-form field for maintenance agents processing the release downstream. Content here won't appear in the rendered CHANGELOG — it's consumed by agents running the `maintenance` skill. Use it for adoption instructions that don't fit the human-facing sections: new files to create, fields to populate, one-time migration steps. Omit entirely when there's nothing to say.
343
+
344
+ **Section order** (Keep a Changelog): Added, Changed, Deprecated, Removed, Fixed, Security. Include only sections with entries — don't ship empty headers.
345
+
346
+ **Tag annotations** render as GitHub Release bodies via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject omits the version number (GitHub prepends it). See `changelog/template.md` for the full format reference.
347
+
348
+ ---
349
+
350
+ ## Imports
351
+
352
+ ```ts
353
+ // Framework — z is re-exported, no separate zod import needed
354
+ import { tool, z } from '@cyanheads/mcp-ts-core';
355
+ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
356
+
357
+ // Server's own code — via path alias
358
+ import { getMyService } from '@/services/my-domain/my-service.js';
359
+ ```
360
+
361
+ ---
362
+
363
+ ## Checklist
364
+
365
+ - [ ] 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()`)
366
+ - [ ] 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`.
367
+ - [ ] JSDoc `@fileoverview` + `@module` on every file
368
+ - [ ] `ctx.log` for logging, `ctx.state` for storage
369
+ - [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
370
+ - [ ] `format()` renders all data the LLM needs — different clients forward different surfaces (Claude Code → `structuredContent`, Claude Desktop → `content[]`); both must carry the same data
371
+ - [ ] If wrapping external API: raw/domain/output schemas reviewed against real upstream sparsity/nullability before finalizing required vs optional fields
372
+ - [ ] If wrapping external API: normalization and `format()` preserve uncertainty; do not fabricate facts from missing upstream data
373
+ - [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
374
+ - [ ] Registered in `createApp()` arrays (directly or via barrel exports)
375
+ - [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
376
+ - [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = package name; `interface.shortDescription` from `package.json` description
377
+ - [ ] `.codex-plugin/mcp.json` updated — server name key matches `package.json` name; env vars added for any required API keys
378
+ - [ ] `.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
379
+ - [ ] `npm run devcheck` passes
package/Dockerfile ADDED
@@ -0,0 +1,99 @@
1
+ # ==============================================================================
2
+ # Build Stage
3
+ #
4
+ # This stage installs all dependencies (including dev), builds the TypeScript
5
+ # source code into JavaScript, and prepares the production assets.
6
+ # ==============================================================================
7
+ FROM oven/bun:1.3 AS build
8
+
9
+ WORKDIR /usr/src/app
10
+
11
+ # Copy dependency manifests for optimized layer caching
12
+ COPY package.json bun.lock ./
13
+
14
+ # Install all dependencies (including dev dependencies for building)
15
+ RUN bun install --frozen-lockfile
16
+
17
+ # Copy the rest of the source code
18
+ COPY . .
19
+
20
+ # Build the application
21
+ RUN bun run build
22
+
23
+
24
+ # ==============================================================================
25
+ # Production Stage
26
+ #
27
+ # This stage creates a minimal, optimized, and secure image for running the
28
+ # application. It uses a slim base image and only includes production
29
+ # dependencies and build artifacts.
30
+ # ==============================================================================
31
+ FROM oven/bun:1.3-slim AS production
32
+
33
+ WORKDIR /usr/src/app
34
+
35
+ # Set the environment to production for performance and to ensure only
36
+ # production dependencies are installed.
37
+ ENV NODE_ENV=production
38
+
39
+ # OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
40
+ LABEL org.opencontainers.image.title="@cyanheads/aviation-weather-mcp-server"
41
+ LABEL org.opencontainers.image.description="Fetch METARs, TAFs, PIREPs, and SIGMETs/AIRMETs from the NWS Aviation Weather Center via MCP. STDIO or Streamable HTTP."
42
+ LABEL org.opencontainers.image.source="https://github.com/cyanheads/aviation-weather-mcp-server"
43
+ LABEL org.opencontainers.image.licenses="Apache-2.0"
44
+
45
+ # Copy dependency manifests
46
+ COPY package.json bun.lock ./
47
+
48
+ # Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
49
+ # that are not needed in the final production image.
50
+ RUN bun install --production --frozen-lockfile --ignore-scripts
51
+
52
+ # Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
53
+ # These are not bundled by default to keep the base image lean. Enable at build time
54
+ # with: docker build --build-arg OTEL_ENABLED=true
55
+ ARG OTEL_ENABLED=true
56
+ RUN if [ "$OTEL_ENABLED" = "true" ]; then \
57
+ bun add @hono/otel \
58
+ @opentelemetry/instrumentation-http \
59
+ @opentelemetry/exporter-metrics-otlp-http \
60
+ @opentelemetry/exporter-trace-otlp-http \
61
+ @opentelemetry/instrumentation-pino \
62
+ @opentelemetry/resources \
63
+ @opentelemetry/sdk-metrics \
64
+ @opentelemetry/sdk-node \
65
+ @opentelemetry/sdk-trace-node \
66
+ @opentelemetry/semantic-conventions; \
67
+ fi
68
+
69
+ # Copy the compiled application code from the build stage
70
+ COPY --from=build /usr/src/app/dist ./dist
71
+
72
+ # The 'oven/bun' image already provides a non-root user named 'bun'.
73
+ # We will use this existing user for enhanced security.
74
+
75
+ # Create and set permissions for the log directory, assigning ownership to the 'bun' user.
76
+ RUN mkdir -p /var/log/aviation-weather-mcp-server && chown -R bun:bun /var/log/aviation-weather-mcp-server
77
+
78
+ # Switch to the non-root user
79
+ USER bun
80
+
81
+ # Define an argument for the port, allowing it to be overridden at build time.
82
+ # The `PORT` variable is often injected by cloud environments at runtime.
83
+ ARG PORT
84
+
85
+ # Set runtime environment variables
86
+ # Note: PORT is an automatic variable in many cloud environments (e.g., Cloud Run)
87
+ ENV MCP_HTTP_PORT=${PORT:-3010}
88
+ ENV MCP_HTTP_HOST="0.0.0.0"
89
+ ENV MCP_TRANSPORT_TYPE="http"
90
+ ENV MCP_SESSION_MODE="stateless"
91
+ ENV MCP_LOG_LEVEL="info"
92
+ ENV LOGS_DIR="/var/log/aviation-weather-mcp-server"
93
+ ENV MCP_FORCE_CONSOLE_LOGGING="true"
94
+
95
+ # Expose the port the server listens on
96
+ EXPOSE ${MCP_HTTP_PORT}
97
+
98
+ # The command to start the server
99
+ CMD ["bun", "run", "dist/index.js"]