@cyanheads/noaa-marine-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 (57) hide show
  1. package/AGENTS.md +387 -0
  2. package/CLAUDE.md +387 -0
  3. package/Dockerfile +99 -0
  4. package/LICENSE +201 -0
  5. package/README.md +300 -0
  6. package/changelog/0.1.x/0.1.1.md +28 -0
  7. package/changelog/template.md +127 -0
  8. package/dist/config/server-config.d.ts +12 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +20 -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 +40 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/resources/definitions/noaa-marine-station.resource.d.ts +9 -0
  17. package/dist/mcp-server/resources/definitions/noaa-marine-station.resource.d.ts.map +1 -0
  18. package/dist/mcp-server/resources/definitions/noaa-marine-station.resource.js +96 -0
  19. package/dist/mcp-server/resources/definitions/noaa-marine-station.resource.js.map +1 -0
  20. package/dist/mcp-server/tools/definitions/noaa-marine-find-stations.tool.d.ts +105 -0
  21. package/dist/mcp-server/tools/definitions/noaa-marine-find-stations.tool.d.ts.map +1 -0
  22. package/dist/mcp-server/tools/definitions/noaa-marine-find-stations.tool.js +338 -0
  23. package/dist/mcp-server/tools/definitions/noaa-marine-find-stations.tool.js.map +1 -0
  24. package/dist/mcp-server/tools/definitions/noaa-marine-get-conditions.tool.d.ts +40 -0
  25. package/dist/mcp-server/tools/definitions/noaa-marine-get-conditions.tool.d.ts.map +1 -0
  26. package/dist/mcp-server/tools/definitions/noaa-marine-get-conditions.tool.js +164 -0
  27. package/dist/mcp-server/tools/definitions/noaa-marine-get-conditions.tool.js.map +1 -0
  28. package/dist/mcp-server/tools/definitions/noaa-marine-get-currents.tool.d.ts +59 -0
  29. package/dist/mcp-server/tools/definitions/noaa-marine-get-currents.tool.d.ts.map +1 -0
  30. package/dist/mcp-server/tools/definitions/noaa-marine-get-currents.tool.js +227 -0
  31. package/dist/mcp-server/tools/definitions/noaa-marine-get-currents.tool.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/noaa-marine-get-tide-predictions.tool.d.ts +60 -0
  33. package/dist/mcp-server/tools/definitions/noaa-marine-get-tide-predictions.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/noaa-marine-get-tide-predictions.tool.js +180 -0
  35. package/dist/mcp-server/tools/definitions/noaa-marine-get-tide-predictions.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/noaa-marine-get-water-level.tool.d.ts +65 -0
  37. package/dist/mcp-server/tools/definitions/noaa-marine-get-water-level.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/noaa-marine-get-water-level.tool.js +232 -0
  39. package/dist/mcp-server/tools/definitions/noaa-marine-get-water-level.tool.js.map +1 -0
  40. package/dist/services/coops/coops-service.d.ts +74 -0
  41. package/dist/services/coops/coops-service.d.ts.map +1 -0
  42. package/dist/services/coops/coops-service.js +217 -0
  43. package/dist/services/coops/coops-service.js.map +1 -0
  44. package/dist/services/coops/types.d.ts +66 -0
  45. package/dist/services/coops/types.d.ts.map +1 -0
  46. package/dist/services/coops/types.js +6 -0
  47. package/dist/services/coops/types.js.map +1 -0
  48. package/dist/services/ndbc/ndbc-service.d.ts +28 -0
  49. package/dist/services/ndbc/ndbc-service.d.ts.map +1 -0
  50. package/dist/services/ndbc/ndbc-service.js +213 -0
  51. package/dist/services/ndbc/ndbc-service.js.map +1 -0
  52. package/dist/services/ndbc/types.d.ts +60 -0
  53. package/dist/services/ndbc/types.d.ts.map +1 -0
  54. package/dist/services/ndbc/types.js +6 -0
  55. package/dist/services/ndbc/types.js.map +1 -0
  56. package/package.json +105 -0
  57. package/server.json +113 -0
package/AGENTS.md ADDED
@@ -0,0 +1,387 @@
1
+ # Developer Protocol
2
+
3
+ **Server:** noaa-marine-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 { getCoopsService } from '@/services/coops/coops-service.js';
52
+
53
+ export const noaaMarineGetTidePredictions = tool('noaa_marine_get_tide_predictions', {
54
+ description: 'High/low tide predictions for a CO-OPS tide station over a date range.',
55
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
56
+ input: z.object({
57
+ station_id: z.string().describe('CO-OPS station ID (numeric, e.g. 9447130). Use noaa_marine_find_stations first.'),
58
+ begin_date: z.string().describe('Start date YYYYMMDD'),
59
+ end_date: z.string().describe('End date YYYYMMDD'),
60
+ datum: z.enum(['MLLW','MHHW','MSL','MTL','MHW','MLW','CD','STND']).default('MLLW').describe('Tidal datum. MLLW = US nautical chart datum (default).'),
61
+ interval: z.enum(['hilo','6min']).default('hilo').describe('hilo = high/low events; 6min = continuous curve.'),
62
+ }),
63
+ output: z.object({
64
+ station_id: z.string().describe('Station ID echoed for chaining'),
65
+ station_name: z.string().describe('Station name'),
66
+ datum: z.string().describe('Datum used'),
67
+ predictions: z.array(z.object({
68
+ time: z.string().describe('ISO datetime'),
69
+ height: z.number().describe('Water height in feet (MLLW default)'),
70
+ type: z.enum(['H','L']).optional().describe('H = high, L = low (hilo only)'),
71
+ })).describe('Tide prediction events'),
72
+ }),
73
+ errors: [
74
+ { reason: 'station_not_found', code: JsonRpcErrorCode.InvalidParams,
75
+ when: 'CO-OPS returned an error for the station ID',
76
+ recovery: 'Verify the station ID using noaa_marine_find_stations with types: ["tide"].' },
77
+ { reason: 'no_predictions', code: JsonRpcErrorCode.NotFound,
78
+ when: 'Station exists but CO-OPS returned no prediction data for the date range',
79
+ recovery: 'Station may be inactive or wrong type — use find_stations to confirm capabilities.' },
80
+ ],
81
+ async handler(input, ctx) {
82
+ const svc = getCoopsService();
83
+ const result = await svc.getTidePredictions(input);
84
+ ctx.log.info('Tide predictions fetched', { station_id: input.station_id, count: result.predictions.length });
85
+ return result;
86
+ },
87
+ format: (r) => [{
88
+ type: 'text',
89
+ text: `**${r.station_name}** (${r.station_id}) — datum: ${r.datum}\n` +
90
+ r.predictions.map(p => `${p.time}: ${p.height} ft${p.type ? ` (${p.type})` : ''}`).join('\n'),
91
+ }],
92
+ });
93
+ ```
94
+
95
+ ### Resource
96
+
97
+ ```ts
98
+ import { resource, z } from '@cyanheads/mcp-ts-core';
99
+ import { notFound } from '@cyanheads/mcp-ts-core/errors';
100
+ import { getCoopsService } from '@/services/coops/coops-service.js';
101
+ import { getNdbcService } from '@/services/ndbc/ndbc-service.js';
102
+
103
+ export const noaaMarineStationResource = resource('noaa-marine://station/{station_id}', {
104
+ name: 'noaa_marine_station',
105
+ description: 'Metadata for a CO-OPS or NDBC station by ID: name, coordinates, source, capabilities, and state.',
106
+ mimeType: 'application/json',
107
+ params: z.object({
108
+ station_id: z.string().describe('CO-OPS numeric/alphanumeric ID or 5-char NDBC buoy ID.'),
109
+ }),
110
+ async handler(params, ctx) {
111
+ const coopsSvc = getCoopsService();
112
+ const ndbcSvc = getNdbcService();
113
+ const station = await coopsSvc.getStation(params.station_id) ?? ndbcSvc.getStation(params.station_id);
114
+ if (!station) throw notFound(`Station ${params.station_id} not found`);
115
+ return station;
116
+ },
117
+ });
118
+ ```
119
+
120
+ ### Server config
121
+
122
+ ```ts
123
+ // src/config/server-config.ts — lazy-parsed, separate from framework config
124
+ import { z } from '@cyanheads/mcp-ts-core';
125
+ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
126
+
127
+ const ServerConfigSchema = z.object({
128
+ applicationId: z
129
+ .string()
130
+ .default('noaa-marine-mcp-server')
131
+ .describe('Courtesy identifier sent as application= on CO-OPS requests.'),
132
+ });
133
+
134
+ let _config: z.infer<typeof ServerConfigSchema> | undefined;
135
+ export function getServerConfig() {
136
+ _config ??= parseEnvConfig(ServerConfigSchema, {
137
+ applicationId: 'NOAA_APPLICATION_ID',
138
+ });
139
+ return _config;
140
+ }
141
+ ```
142
+
143
+ `parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`NOAA_APPLICATION_ID`) not the path (`applicationId`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
144
+
145
+ ### Server instructions
146
+
147
+ `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.
148
+
149
+ ---
150
+
151
+ ## Context
152
+
153
+ Handlers receive a unified `ctx` object. Key properties:
154
+
155
+ | Property | Description |
156
+ |:---------|:------------|
157
+ | `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
158
+ | `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
159
+ | `ctx.elicit` | Ask user for structured input. **Check for presence first:** `if (ctx.elicit) { ... }` |
160
+ | `ctx.sample` | Request LLM completion from the client. **Check for presence first:** `if (ctx.sample) { ... }` |
161
+ | `ctx.signal` | `AbortSignal` for cancellation. |
162
+ | `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
163
+ | `ctx.requestId` | Unique request ID. |
164
+ | `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio. |
165
+
166
+ ---
167
+
168
+ ## Errors
169
+
170
+ Handlers throw — the framework catches, classifies, and formats.
171
+
172
+ **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.
173
+
174
+ ```ts
175
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
176
+
177
+ errors: [
178
+ { reason: 'no_match', code: JsonRpcErrorCode.NotFound,
179
+ when: 'No item matched the query',
180
+ recovery: 'Broaden the query or check the spelling and try again.' },
181
+ ],
182
+ async handler(input, ctx) {
183
+ const item = await db.find(input.id);
184
+ if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
185
+ return item;
186
+ }
187
+ ```
188
+
189
+ **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.
190
+
191
+ **Fallback (no contract entry fits):** throw via factories or plain `Error`.
192
+
193
+ ```ts
194
+ // Error factories — explicit code
195
+ import { notFound, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
196
+ throw notFound('Item not found', { itemId });
197
+ throw serviceUnavailable('API unavailable', { url }, { cause: err });
198
+
199
+ // Plain Error — framework auto-classifies from message patterns
200
+ throw new Error('Item not found'); // → NotFound
201
+ throw new Error('Invalid query format'); // → ValidationError
202
+
203
+ // McpError — when no factory exists for the code
204
+ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
205
+ throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
206
+ ```
207
+
208
+ See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table, all available factories, and the contract reference.
209
+
210
+ ---
211
+
212
+ ## Structure
213
+
214
+ ```text
215
+ src/
216
+ index.ts # createApp() entry point — registers tools, resource, services
217
+ config/
218
+ server-config.ts # NOAA_APPLICATION_ID env var (optional, defaults to server name)
219
+ services/
220
+ coops/
221
+ coops-service.ts # CO-OPS Tides & Currents API (station cache, data fetch)
222
+ types.ts # CO-OPS domain types
223
+ ndbc/
224
+ ndbc-service.ts # NDBC buoy service (active stations XML, realtime text)
225
+ types.ts # NDBC domain types
226
+ mcp-server/
227
+ tools/definitions/
228
+ noaa-marine-find-stations.tool.ts # noaa_marine_find_stations
229
+ noaa-marine-get-tide-predictions.tool.ts # noaa_marine_get_tide_predictions
230
+ noaa-marine-get-water-level.tool.ts # noaa_marine_get_water_level
231
+ noaa-marine-get-currents.tool.ts # noaa_marine_get_currents
232
+ noaa-marine-get-conditions.tool.ts # noaa_marine_get_conditions
233
+ resources/definitions/
234
+ noaa-marine-station.resource.ts # noaa-marine://station/{station_id}
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Naming
240
+
241
+ | What | Convention | Example |
242
+ |:-----|:-----------|:--------|
243
+ | Files | kebab-case with suffix | `search-docs.tool.ts` |
244
+ | Tool/resource/prompt names | snake_case | `search_docs` |
245
+ | Directories | kebab-case | `src/services/doc-search/` |
246
+ | Descriptions | Single string or template literal, no `+` concatenation | `'Search items by query and filter.'` |
247
+
248
+ ---
249
+
250
+ ## Skills
251
+
252
+ 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.
253
+
254
+ **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.
255
+
256
+ Available skills:
257
+
258
+ | Skill | Purpose |
259
+ |:------|:--------|
260
+ | `setup` | Post-init project orientation |
261
+ | `design-mcp-server` | Design tool surface, resources, and services for a new server |
262
+ | `add-tool` | Scaffold a new tool definition |
263
+ | `add-app-tool` | Scaffold an MCP App tool + paired UI resource |
264
+ | `add-resource` | Scaffold a new resource definition |
265
+ | `add-prompt` | Scaffold a new prompt definition |
266
+ | `add-service` | Scaffold a new service integration |
267
+ | `add-test` | Scaffold test file for a tool, resource, or service |
268
+ | `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
269
+ | `tool-defs-analysis` | Read-only audit of MCP definition language across the surface — voice, leaks, defaults, recovery hints, output descriptions |
270
+ | `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
271
+ | `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
272
+ | `devcheck` | Lint, format, typecheck, audit |
273
+ | `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
274
+ | `git-wrapup` | Land working-tree changes as a versioned commit + annotated tag — version bump, changelog, verify, tag. Local only. |
275
+ | `release-and-publish` | Push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
276
+ | `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
277
+ | `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
278
+ | `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
279
+ | `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
280
+ | `api-auth` | Auth modes, scopes, JWT/OAuth |
281
+ | `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
282
+ | `api-config` | AppConfig, parseConfig, env vars |
283
+ | `api-context` | Context interface, logger, state, progress |
284
+ | `api-errors` | McpError, JsonRpcErrorCode, error patterns |
285
+ | `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
286
+ | `api-services` | LLM, Speech, Graph services |
287
+ | `api-testing` | createMockContext, test patterns |
288
+ | `api-utils` | Formatting, parsing, security, pagination, scheduling, telemetry helpers |
289
+ | `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
290
+ | `api-workers` | Cloudflare Workers runtime |
291
+
292
+ **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.
293
+
294
+ When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
295
+
296
+ ---
297
+
298
+ ## Commands
299
+
300
+ **Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work. `bun` is slightly faster for script invocation but not required.
301
+
302
+ | Command | Purpose |
303
+ |:--------|:--------|
304
+ | `npm run build` | Compile TypeScript |
305
+ | `npm run rebuild` | Clean + build |
306
+ | `npm run clean` | Remove build artifacts |
307
+ | `npm run devcheck` | Lint + format + typecheck + security + changelog sync |
308
+ | `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. |
309
+ | `npm run tree` | Generate directory structure doc |
310
+ | `npm run format` | Auto-fix formatting (safe fixes only) |
311
+ | `npm run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior |
312
+ | `npm test` | Run tests |
313
+ | `npm run start:stdio` | Production mode (stdio) |
314
+ | `npm run start:http` | Production mode (HTTP) |
315
+ | `npm run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
316
+ | `npm run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
317
+ | `npm run bundle` | Build and pack as `.mcpb` for one-click Claude Desktop install |
318
+
319
+ ---
320
+
321
+ ## Bundling
322
+
323
+ `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.
324
+
325
+ **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.
326
+
327
+ **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`.
328
+
329
+ ---
330
+
331
+ ## Changelog
332
+
333
+ 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.
334
+
335
+ Each per-version file opens with YAML frontmatter:
336
+
337
+ ```markdown
338
+ ---
339
+ summary: "One-line headline, ≤350 chars" # required — powers the rollup index
340
+ breaking: false # optional — true flags breaking changes
341
+ security: false # optional — true flags security fixes
342
+ ---
343
+
344
+ # 0.1.0 — YYYY-MM-DD
345
+ ...
346
+ ```
347
+
348
+ `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`.
349
+
350
+ `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.
351
+
352
+ **Section order** (Keep a Changelog): Added, Changed, Deprecated, Removed, Fixed, Security. Include only sections with entries — don't ship empty headers.
353
+
354
+ **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.
355
+
356
+ ---
357
+
358
+ ## Imports
359
+
360
+ ```ts
361
+ // Framework — z is re-exported, no separate zod import needed
362
+ import { tool, z } from '@cyanheads/mcp-ts-core';
363
+ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
364
+
365
+ // Server's own code — via path alias
366
+ import { getMyService } from '@/services/my-domain/my-service.js';
367
+ ```
368
+
369
+ ---
370
+
371
+ ## Checklist
372
+
373
+ - [ ] 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()`)
374
+ - [ ] 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`.
375
+ - [ ] JSDoc `@fileoverview` + `@module` on every file
376
+ - [ ] `ctx.log` for logging, `ctx.state` for storage
377
+ - [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
378
+ - [ ] `format()` renders all data the LLM needs — different clients forward different surfaces (Claude Code → `structuredContent`, Claude Desktop → `content[]`); both must carry the same data
379
+ - [ ] If wrapping external API: raw/domain/output schemas reviewed against real upstream sparsity/nullability before finalizing required vs optional fields
380
+ - [ ] If wrapping external API: normalization and `format()` preserve uncertainty; do not fabricate facts from missing upstream data
381
+ - [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
382
+ - [ ] Registered in `createApp()` arrays (directly or via barrel exports)
383
+ - [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
384
+ - [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = package name; `interface.shortDescription` from `package.json` description
385
+ - [ ] `.codex-plugin/mcp.json` updated — server name key matches `package.json` name; env vars added for any required API keys
386
+ - [ ] `.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
387
+ - [ ] `npm run devcheck` passes