@cyanheads/cyanheads-mcp-server 0.4.0 → 0.4.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.
- package/AGENTS.md +72 -31
- package/CLAUDE.md +72 -31
- package/Dockerfile +9 -9
- package/LICENSE +1 -1
- package/README.md +57 -47
- package/changelog/0.4.x/0.4.1.md +33 -0
- package/changelog/0.4.x/0.4.2.md +32 -0
- package/changelog/template.md +62 -40
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/describe-entry.tool.d.ts +1 -0
- package/dist/mcp-server/tools/definitions/describe-entry.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/describe-entry.tool.js +5 -2
- package/dist/mcp-server/tools/definitions/describe-entry.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-catalog.tool.d.ts +1 -0
- package/dist/mcp-server/tools/definitions/search-catalog.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-catalog.tool.js +5 -2
- package/dist/mcp-server/tools/definitions/search-catalog.tool.js.map +1 -1
- package/dist/services/catalog/catalog-service.d.ts.map +1 -1
- package/dist/services/catalog/catalog-service.js +12 -5
- package/dist/services/catalog/catalog-service.js.map +1 -1
- package/dist/services/catalog/embeddings-runtime.d.ts.map +1 -1
- package/dist/services/catalog/embeddings-runtime.js +3 -3
- package/dist/services/catalog/embeddings-runtime.js.map +1 -1
- package/dist/services/catalog/remote-catalog-provider.d.ts +2 -2
- package/dist/services/catalog/remote-catalog-provider.d.ts.map +1 -1
- package/dist/services/catalog/remote-catalog-provider.js +15 -17
- package/dist/services/catalog/remote-catalog-provider.js.map +1 -1
- package/dist/services/catalog/service-instance.js +1 -1
- package/dist/services/catalog/service-instance.js.map +1 -1
- package/dist/services/catalog/snippets.js +1 -1
- package/manifest.json +31 -2
- package/package.json +27 -11
- package/server.json +17 -3
package/AGENTS.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** cyanheads-mcp-server
|
|
4
|
-
**Version:** 0.4.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/
|
|
8
|
-
**Zod:** ^4.
|
|
4
|
+
**Version:** 0.4.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.6`
|
|
6
|
+
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/server` 2.0.0
|
|
8
|
+
**Zod:** ^4.6.5
|
|
9
9
|
|
|
10
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
11
|
|
|
@@ -48,8 +48,9 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
48
48
|
- **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.
|
|
49
49
|
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
50
50
|
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
51
|
-
- **
|
|
51
|
+
- **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.
|
|
52
52
|
- **Secrets in env vars only** — never hardcoded.
|
|
53
|
+
- **Cut noise.** Add only what earns its place: no speculative generality, no guards for states the framework already prevents (Zod-validated params, classified errors), no abstraction until a third caller proves it, no option nothing sets.
|
|
53
54
|
- **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.
|
|
54
55
|
|
|
55
56
|
---
|
|
@@ -104,7 +105,7 @@ export const itemData = resource('inventory://{itemId}', {
|
|
|
104
105
|
params: z.object({ itemId: z.string().describe('Item identifier') }),
|
|
105
106
|
auth: ['inventory:read'],
|
|
106
107
|
async handler(params, ctx) {
|
|
107
|
-
const item = await ctx.state.get(`item
|
|
108
|
+
const item = await ctx.state.get(`item/${params.itemId}`);
|
|
108
109
|
if (!item) throw notFound(`Item ${params.itemId} not found`, { itemId: params.itemId });
|
|
109
110
|
return item;
|
|
110
111
|
},
|
|
@@ -138,6 +139,7 @@ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
|
138
139
|
const ServerConfigSchema = z.object({
|
|
139
140
|
apiKey: z.string().describe('External API key'),
|
|
140
141
|
maxResults: z.coerce.number().default(100),
|
|
142
|
+
verboseLogging: z.stringbool().default(false).describe('Enable verbose logging'),
|
|
141
143
|
});
|
|
142
144
|
|
|
143
145
|
let _config: z.infer<typeof ServerConfigSchema> | undefined;
|
|
@@ -145,6 +147,7 @@ export function getServerConfig() {
|
|
|
145
147
|
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
146
148
|
apiKey: 'MY_API_KEY',
|
|
147
149
|
maxResults: 'MY_MAX_RESULTS',
|
|
150
|
+
verboseLogging: 'MY_VERBOSE_LOGGING',
|
|
148
151
|
});
|
|
149
152
|
return _config;
|
|
150
153
|
}
|
|
@@ -152,6 +155,30 @@ export function getServerConfig() {
|
|
|
152
155
|
|
|
153
156
|
`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.
|
|
154
157
|
|
|
158
|
+
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, so `=false` actually disables.
|
|
159
|
+
|
|
160
|
+
### Server identity and instructions
|
|
161
|
+
|
|
162
|
+
The canonical `createApp()` identity in this project is `name` + `title` only, both exactly `cyanheads-mcp-server`. The description derives from `package.json`, and the website derives from package metadata, so neither is duplicated in the identity block. `instructions` carries the fleet-discovery workflow as session-level context.
|
|
163
|
+
|
|
164
|
+
### Session posture and shutdown
|
|
165
|
+
|
|
166
|
+
Two more `createApp()` options shape how the server runs rather than how it presents itself:
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
await createApp({
|
|
170
|
+
sessionMode: 'stateless', // or { default: 'stateful', require: 'stateful' }
|
|
171
|
+
setup(core) { startMyWatcher(core.config); },
|
|
172
|
+
async teardown() { await stopMyWatcher(); },
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`sessionMode` declares the HTTP session posture in `src/` instead of leaving it to a deployment's `MCP_SESSION_MODE`, which still wins whenever it carries a meaningful value (an empty string and an unsubstituted `${…}` placeholder read as unset and fall through to the option). Add `require: 'stateful'` when a tool asks the caller for input mid-handler via `ctx.requestInput`: startup then fails with a `ConfigurationError` rather than serving a mode in which a 2025-era client can never answer the prompt. Stdio is never refused.
|
|
177
|
+
|
|
178
|
+
`teardown(core)` is the `setup()` counterpart — release a watcher, socket, or non-`unref()`'d timer there. It runs after the transport stops and before the logger closes, on every shutdown path, and a signal-triggered shutdown then exits the process explicitly (0, or 1 if a step never settles within the framework's 10 s ceiling).
|
|
179
|
+
|
|
180
|
+
This server declares `sessionMode: 'stateless'` — it holds no per-session state, so the session store and the per-session `McpServer` allocation are pure overhead and the process scales horizontally without them. `teardown` stops the catalog service's background refresh timer.
|
|
181
|
+
|
|
155
182
|
---
|
|
156
183
|
|
|
157
184
|
## Context
|
|
@@ -160,13 +187,15 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
160
187
|
|
|
161
188
|
| Property | Description |
|
|
162
189
|
|:---------|:------------|
|
|
163
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
164
|
-
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
165
|
-
| `ctx.
|
|
190
|
+
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino **and** `notifications/message` to the client, so treat it as client-visible. |
|
|
191
|
+
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
192
|
+
| `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. Always present. |
|
|
193
|
+
| `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. |
|
|
194
|
+
| `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). |
|
|
195
|
+
| `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
196
|
| `ctx.signal` | `AbortSignal` for cancellation. |
|
|
167
|
-
| `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
|
|
168
197
|
| `ctx.requestId` | Unique request ID. |
|
|
169
|
-
| `ctx.tenantId` | Tenant ID from JWT
|
|
198
|
+
| `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
|
|
170
199
|
|
|
171
200
|
---
|
|
172
201
|
|
|
@@ -174,9 +203,11 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
174
203
|
|
|
175
204
|
Handlers throw — the framework catches, classifies, and formats.
|
|
176
205
|
|
|
177
|
-
**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
|
|
206
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` 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, and the linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. Pass `ctx.recoveryFor('reason')` as the throw's data to put it on the wire (`data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim); override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Forwarding it is lint-enforced per throw site (`error-contract-recovery-unforwarded`). Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
178
207
|
|
|
179
208
|
```ts
|
|
209
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
210
|
+
|
|
180
211
|
errors: [
|
|
181
212
|
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound,
|
|
182
213
|
when: 'No item matched the query',
|
|
@@ -184,7 +215,7 @@ errors: [
|
|
|
184
215
|
],
|
|
185
216
|
async handler(input, ctx) {
|
|
186
217
|
const item = await db.find(input.id);
|
|
187
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}
|
|
218
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
|
|
188
219
|
return item;
|
|
189
220
|
}
|
|
190
221
|
```
|
|
@@ -247,9 +278,9 @@ src/
|
|
|
247
278
|
|
|
248
279
|
## Skills
|
|
249
280
|
|
|
250
|
-
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. `bun run list-skills` prints the full registry.
|
|
281
|
+
Skills are modular instructions in `framework-skills/` at the project root. Read them directly when a task matches — e.g., `framework-skills/add-tool/SKILL.md` when adding a tool. `bun run list-skills` prints the full registry. The directory is deliberately not `skills/`: Claude Code and Codex auto-load a plugin's root `skills/`, so a server that ships `.claude-plugin/` or `.codex-plugin/` would hand these development skills to every agent that installs it. Keep `skills/` free for skills meant for those agents.
|
|
251
282
|
|
|
252
|
-
**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.
|
|
283
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `framework-skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
253
284
|
|
|
254
285
|
Available skills:
|
|
255
286
|
|
|
@@ -268,8 +299,9 @@ Available skills:
|
|
|
268
299
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
269
300
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
270
301
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
271
|
-
| `git-wrapup` | Land working-tree changes as a
|
|
272
|
-
| `release-
|
|
302
|
+
| `git-wrapup` | Land working-tree changes as a commit stack — version bump, changelog, verify, commit by concern, release commit on top. No tag, no push to main; opens the release PR when the project declares release PR mode |
|
|
303
|
+
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review, fixes as ordinary commits on top of the stack, PR body kept in sync. Release PR mode only |
|
|
304
|
+
| `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
273
305
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
274
306
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
275
307
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
@@ -278,7 +310,7 @@ Available skills:
|
|
|
278
310
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
279
311
|
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
280
312
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
281
|
-
| `api-context` | Context interface, logger, state,
|
|
313
|
+
| `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
|
|
282
314
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
283
315
|
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
284
316
|
| `api-mirror` | MirrorService: persistent self-refreshing local mirror (embedded SQLite + FTS5) of a bulk upstream dataset — Tier 3 opt-in |
|
|
@@ -288,7 +320,7 @@ Available skills:
|
|
|
288
320
|
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
289
321
|
| `api-workers` | Cloudflare Workers runtime |
|
|
290
322
|
|
|
291
|
-
**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.
|
|
323
|
+
**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*, `framework-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.
|
|
292
324
|
|
|
293
325
|
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
294
326
|
|
|
@@ -304,9 +336,10 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
304
336
|
| `bun run rebuild` | Clean + build |
|
|
305
337
|
| `bun run clean` | Remove build artifacts |
|
|
306
338
|
| `bun run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
307
|
-
| `bun run audit:
|
|
339
|
+
| `bun run audit:fix` | `bun audit fix` — upgrade vulnerable packages to the lowest safe version within existing ranges (`--dry-run` previews, `--latest` rewrites ranges). First response when `devcheck` flags a transitive advisory; then `bun update <name>`, then `bun dedupe` |
|
|
340
|
+
| `bun run audit:refresh` | Delete `bun.lock` and reinstall. Last resort after `audit:fix`, `bun update <name>`, and `bun dedupe` — re-resolves every ranged dep (the framework pin included) and rewrites the lockfile as `lockfileVersion: 2` |
|
|
308
341
|
| `bun run lint:mcp` | Run the MCP definition linter standalone (rule catalog: `api-linter` skill) |
|
|
309
|
-
| `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity
|
|
342
|
+
| `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity (run by devcheck) |
|
|
310
343
|
| `bun run list-skills` | Print the skill registry |
|
|
311
344
|
| `bun run tree` | Generate directory structure doc |
|
|
312
345
|
| `bun run format` | Auto-fix formatting (safe fixes only) |
|
|
@@ -319,15 +352,17 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
319
352
|
| `bun run release:github` | Create GitHub Release from annotated tag (title format: `v<VERSION>: <subject>`) |
|
|
320
353
|
| `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
|
|
321
354
|
|
|
355
|
+
**CI is one file.** `.github/workflows/codeql.yml` (scaffolded) is the only GitHub Actions workflow: CodeQL is GitHub-owned end to end, and the file runs only while the repo's CodeQL *default setup* is turned off. Verification — `devcheck`, tests, the release gates — runs locally; don't add a workflow that re-runs it.
|
|
356
|
+
|
|
322
357
|
---
|
|
323
358
|
|
|
324
359
|
## Bundling
|
|
325
360
|
|
|
326
|
-
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips dependency-shipped agent docs (`
|
|
361
|
+
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips two classes of `node_modules/**` content that root-anchored `.mcpbignore` patterns cannot reach: dependency-shipped agent docs (`framework-skills/`, `skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. A server using DataCanvas therefore ships a portable bundle without the DuckDB native — `@duckdb/node-api` is an optional peer loaded lazily, so canvas tools report an actionable install hint and every other tool works normally. 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.
|
|
327
362
|
|
|
328
|
-
**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.
|
|
363
|
+
**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, that every `user_config` option is wired into `mcp_config.env` as `"X": "${user_config.X}"` (the host substitutes nothing else — `"${X}"` reaches the server as that literal string), and that an optional string option carries `"default": ""`.
|
|
329
364
|
|
|
330
|
-
**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`.
|
|
365
|
+
**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 `framework-skills/polish-docs-meta/references/readme.md`.
|
|
331
366
|
|
|
332
367
|
---
|
|
333
368
|
|
|
@@ -341,23 +376,29 @@ Each per-version file opens with YAML frontmatter:
|
|
|
341
376
|
---
|
|
342
377
|
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
343
378
|
breaking: false # optional — true flags breaking changes
|
|
344
|
-
security: false # optional — true
|
|
379
|
+
security: false # optional — true ONLY for a source-code security fix, never a dependency CVE bump
|
|
345
380
|
---
|
|
346
381
|
|
|
347
382
|
# 0.1.0 — YYYY-MM-DD
|
|
348
383
|
...
|
|
349
384
|
```
|
|
350
385
|
|
|
351
|
-
`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`.
|
|
386
|
+
`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 — set it only for a security fix in this server's *own source code*, never for a routine dependency or transitive CVE bump (record those under `## Dependencies`). When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
352
387
|
|
|
353
388
|
`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.
|
|
354
389
|
|
|
355
|
-
**Section order
|
|
390
|
+
**Section order:** the Keep a Changelog sequence — Added, Changed, Deprecated, Removed, Fixed, Security — then `Dependencies` last. Include only sections with entries — don't ship empty headers.
|
|
356
391
|
|
|
357
392
|
**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.
|
|
358
393
|
|
|
359
394
|
---
|
|
360
395
|
|
|
396
|
+
## Publishing
|
|
397
|
+
|
|
398
|
+
**Every release goes through a release PR, straight-through** — `git-wrapup`'s "Release PR mode", mode `straight-through`. One run: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-and-publish` then fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. A caller's brief may run a given release as `gated` instead — a `release-pr-review` pass on the open PR before `release-and-publish`. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
361
402
|
## Imports
|
|
362
403
|
|
|
363
404
|
```ts
|
|
@@ -384,7 +425,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
|
|
|
384
425
|
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
385
426
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
386
427
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
387
|
-
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` =
|
|
388
|
-
- [ ] `.codex-plugin/mcp.json` updated — server name key
|
|
389
|
-
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry
|
|
428
|
+
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = the unscoped repo name (never the npm scope — `lint:packaging` enforces this); `interface.shortDescription` from `package.json` description
|
|
429
|
+
- [ ] `.codex-plugin/mcp.json` updated — server name key is the unscoped repo name; every user-supplied variable (API key, contact email, instance URL) is listed in `env_vars` so Codex forwards it from the user's environment. Never write `"KEY": ""` into `env` — an empty value replaces the user's exported key and is read as unset
|
|
430
|
+
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `author`, `repository`, `license`, `keywords` from `package.json`; inline `mcpServers` entry keyed by the unscoped repo name. Every user-supplied variable is declared under `userConfig` (`type`, `title`, `description`; `sensitive: true` for keys and tokens; `required: true` or `default: ""`) and referenced from `env` as `"KEY": "${user_config.<option>}"` — mirror the `user_config` block in `manifest.json`. Never write `"KEY": ""` into `env`
|
|
390
431
|
- [ ] `npm run devcheck` passes
|
package/CLAUDE.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** cyanheads-mcp-server
|
|
4
|
-
**Version:** 0.4.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/
|
|
8
|
-
**Zod:** ^4.
|
|
4
|
+
**Version:** 0.4.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.6`
|
|
6
|
+
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/server` 2.0.0
|
|
8
|
+
**Zod:** ^4.6.5
|
|
9
9
|
|
|
10
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
11
|
|
|
@@ -48,8 +48,9 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
48
48
|
- **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.
|
|
49
49
|
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
50
50
|
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
51
|
-
- **
|
|
51
|
+
- **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.
|
|
52
52
|
- **Secrets in env vars only** — never hardcoded.
|
|
53
|
+
- **Cut noise.** Add only what earns its place: no speculative generality, no guards for states the framework already prevents (Zod-validated params, classified errors), no abstraction until a third caller proves it, no option nothing sets.
|
|
53
54
|
- **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.
|
|
54
55
|
|
|
55
56
|
---
|
|
@@ -104,7 +105,7 @@ export const itemData = resource('inventory://{itemId}', {
|
|
|
104
105
|
params: z.object({ itemId: z.string().describe('Item identifier') }),
|
|
105
106
|
auth: ['inventory:read'],
|
|
106
107
|
async handler(params, ctx) {
|
|
107
|
-
const item = await ctx.state.get(`item
|
|
108
|
+
const item = await ctx.state.get(`item/${params.itemId}`);
|
|
108
109
|
if (!item) throw notFound(`Item ${params.itemId} not found`, { itemId: params.itemId });
|
|
109
110
|
return item;
|
|
110
111
|
},
|
|
@@ -138,6 +139,7 @@ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
|
138
139
|
const ServerConfigSchema = z.object({
|
|
139
140
|
apiKey: z.string().describe('External API key'),
|
|
140
141
|
maxResults: z.coerce.number().default(100),
|
|
142
|
+
verboseLogging: z.stringbool().default(false).describe('Enable verbose logging'),
|
|
141
143
|
});
|
|
142
144
|
|
|
143
145
|
let _config: z.infer<typeof ServerConfigSchema> | undefined;
|
|
@@ -145,6 +147,7 @@ export function getServerConfig() {
|
|
|
145
147
|
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
146
148
|
apiKey: 'MY_API_KEY',
|
|
147
149
|
maxResults: 'MY_MAX_RESULTS',
|
|
150
|
+
verboseLogging: 'MY_VERBOSE_LOGGING',
|
|
148
151
|
});
|
|
149
152
|
return _config;
|
|
150
153
|
}
|
|
@@ -152,6 +155,30 @@ export function getServerConfig() {
|
|
|
152
155
|
|
|
153
156
|
`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.
|
|
154
157
|
|
|
158
|
+
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, so `=false` actually disables.
|
|
159
|
+
|
|
160
|
+
### Server identity and instructions
|
|
161
|
+
|
|
162
|
+
The canonical `createApp()` identity in this project is `name` + `title` only, both exactly `cyanheads-mcp-server`. The description derives from `package.json`, and the website derives from package metadata, so neither is duplicated in the identity block. `instructions` carries the fleet-discovery workflow as session-level context.
|
|
163
|
+
|
|
164
|
+
### Session posture and shutdown
|
|
165
|
+
|
|
166
|
+
Two more `createApp()` options shape how the server runs rather than how it presents itself:
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
await createApp({
|
|
170
|
+
sessionMode: 'stateless', // or { default: 'stateful', require: 'stateful' }
|
|
171
|
+
setup(core) { startMyWatcher(core.config); },
|
|
172
|
+
async teardown() { await stopMyWatcher(); },
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`sessionMode` declares the HTTP session posture in `src/` instead of leaving it to a deployment's `MCP_SESSION_MODE`, which still wins whenever it carries a meaningful value (an empty string and an unsubstituted `${…}` placeholder read as unset and fall through to the option). Add `require: 'stateful'` when a tool asks the caller for input mid-handler via `ctx.requestInput`: startup then fails with a `ConfigurationError` rather than serving a mode in which a 2025-era client can never answer the prompt. Stdio is never refused.
|
|
177
|
+
|
|
178
|
+
`teardown(core)` is the `setup()` counterpart — release a watcher, socket, or non-`unref()`'d timer there. It runs after the transport stops and before the logger closes, on every shutdown path, and a signal-triggered shutdown then exits the process explicitly (0, or 1 if a step never settles within the framework's 10 s ceiling).
|
|
179
|
+
|
|
180
|
+
This server declares `sessionMode: 'stateless'` — it holds no per-session state, so the session store and the per-session `McpServer` allocation are pure overhead and the process scales horizontally without them. `teardown` stops the catalog service's background refresh timer.
|
|
181
|
+
|
|
155
182
|
---
|
|
156
183
|
|
|
157
184
|
## Context
|
|
@@ -160,13 +187,15 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
160
187
|
|
|
161
188
|
| Property | Description |
|
|
162
189
|
|:---------|:------------|
|
|
163
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
164
|
-
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
165
|
-
| `ctx.
|
|
190
|
+
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. Dual-sink: Pino **and** `notifications/message` to the client, so treat it as client-visible. |
|
|
191
|
+
| `ctx.state` | Tenant-scoped KV — `.get(key)`, `.set(key, value, { ttl? })`, `.delete(key)`, `.getMany(keys)`, `.list(prefix, { cursor, limit })`. Accepts any serializable value. |
|
|
192
|
+
| `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. Always present. |
|
|
193
|
+
| `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. |
|
|
194
|
+
| `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). |
|
|
195
|
+
| `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
196
|
| `ctx.signal` | `AbortSignal` for cancellation. |
|
|
167
|
-
| `ctx.progress` | Task progress (present when `task: true`) — `.setTotal(n)`, `.increment()`, `.update(message)`. |
|
|
168
197
|
| `ctx.requestId` | Unique request ID. |
|
|
169
|
-
| `ctx.tenantId` | Tenant ID from JWT
|
|
198
|
+
| `ctx.tenantId` | Tenant ID from JWT; `'default'` for stdio or HTTP with auth off. |
|
|
170
199
|
|
|
171
200
|
---
|
|
172
201
|
|
|
@@ -174,9 +203,11 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
174
203
|
|
|
175
204
|
Handlers throw — the framework catches, classifies, and formats.
|
|
176
205
|
|
|
177
|
-
**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
|
|
206
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` 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, and the linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. Pass `ctx.recoveryFor('reason')` as the throw's data to put it on the wire (`data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim); override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Forwarding it is lint-enforced per throw site (`error-contract-recovery-unforwarded`). Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
178
207
|
|
|
179
208
|
```ts
|
|
209
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
210
|
+
|
|
180
211
|
errors: [
|
|
181
212
|
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound,
|
|
182
213
|
when: 'No item matched the query',
|
|
@@ -184,7 +215,7 @@ errors: [
|
|
|
184
215
|
],
|
|
185
216
|
async handler(input, ctx) {
|
|
186
217
|
const item = await db.find(input.id);
|
|
187
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}
|
|
218
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`, ctx.recoveryFor('no_match'));
|
|
188
219
|
return item;
|
|
189
220
|
}
|
|
190
221
|
```
|
|
@@ -247,9 +278,9 @@ src/
|
|
|
247
278
|
|
|
248
279
|
## Skills
|
|
249
280
|
|
|
250
|
-
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. `bun run list-skills` prints the full registry.
|
|
281
|
+
Skills are modular instructions in `framework-skills/` at the project root. Read them directly when a task matches — e.g., `framework-skills/add-tool/SKILL.md` when adding a tool. `bun run list-skills` prints the full registry. The directory is deliberately not `skills/`: Claude Code and Codex auto-load a plugin's root `skills/`, so a server that ships `.claude-plugin/` or `.codex-plugin/` would hand these development skills to every agent that installs it. Keep `skills/` free for skills meant for those agents.
|
|
251
282
|
|
|
252
|
-
**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.
|
|
283
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `framework-skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
253
284
|
|
|
254
285
|
Available skills:
|
|
255
286
|
|
|
@@ -268,8 +299,9 @@ Available skills:
|
|
|
268
299
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
269
300
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
270
301
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
271
|
-
| `git-wrapup` | Land working-tree changes as a
|
|
272
|
-
| `release-
|
|
302
|
+
| `git-wrapup` | Land working-tree changes as a commit stack — version bump, changelog, verify, commit by concern, release commit on top. No tag, no push to main; opens the release PR when the project declares release PR mode |
|
|
303
|
+
| `release-pr-review` | Review pass on an open release PR — simplifier + correctness review, fixes as ordinary commits on top of the stack, PR body kept in sync. Release PR mode only |
|
|
304
|
+
| `release-and-publish` | Fast-forward merge (release PR mode) + tag + push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
273
305
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
274
306
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
275
307
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
@@ -278,7 +310,7 @@ Available skills:
|
|
|
278
310
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
279
311
|
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
280
312
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
281
|
-
| `api-context` | Context interface, logger, state,
|
|
313
|
+
| `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
|
|
282
314
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
283
315
|
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
284
316
|
| `api-mirror` | MirrorService: persistent self-refreshing local mirror (embedded SQLite + FTS5) of a bulk upstream dataset — Tier 3 opt-in |
|
|
@@ -288,7 +320,7 @@ Available skills:
|
|
|
288
320
|
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
289
321
|
| `api-workers` | Cloudflare Workers runtime |
|
|
290
322
|
|
|
291
|
-
**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.
|
|
323
|
+
**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*, `framework-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.
|
|
292
324
|
|
|
293
325
|
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
294
326
|
|
|
@@ -304,9 +336,10 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
304
336
|
| `bun run rebuild` | Clean + build |
|
|
305
337
|
| `bun run clean` | Remove build artifacts |
|
|
306
338
|
| `bun run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
307
|
-
| `bun run audit:
|
|
339
|
+
| `bun run audit:fix` | `bun audit fix` — upgrade vulnerable packages to the lowest safe version within existing ranges (`--dry-run` previews, `--latest` rewrites ranges). First response when `devcheck` flags a transitive advisory; then `bun update <name>`, then `bun dedupe` |
|
|
340
|
+
| `bun run audit:refresh` | Delete `bun.lock` and reinstall. Last resort after `audit:fix`, `bun update <name>`, and `bun dedupe` — re-resolves every ranged dep (the framework pin included) and rewrites the lockfile as `lockfileVersion: 2` |
|
|
308
341
|
| `bun run lint:mcp` | Run the MCP definition linter standalone (rule catalog: `api-linter` skill) |
|
|
309
|
-
| `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity
|
|
342
|
+
| `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity (run by devcheck) |
|
|
310
343
|
| `bun run list-skills` | Print the skill registry |
|
|
311
344
|
| `bun run tree` | Generate directory structure doc |
|
|
312
345
|
| `bun run format` | Auto-fix formatting (safe fixes only) |
|
|
@@ -319,15 +352,17 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
319
352
|
| `bun run release:github` | Create GitHub Release from annotated tag (title format: `v<VERSION>: <subject>`) |
|
|
320
353
|
| `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
|
|
321
354
|
|
|
355
|
+
**CI is one file.** `.github/workflows/codeql.yml` (scaffolded) is the only GitHub Actions workflow: CodeQL is GitHub-owned end to end, and the file runs only while the repo's CodeQL *default setup* is turned off. Verification — `devcheck`, tests, the release gates — runs locally; don't add a workflow that re-runs it.
|
|
356
|
+
|
|
322
357
|
---
|
|
323
358
|
|
|
324
359
|
## Bundling
|
|
325
360
|
|
|
326
|
-
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips dependency-shipped agent docs (`
|
|
361
|
+
`npm run bundle` produces a `.mcpb` extension bundle for one-click install in Claude Desktop. The pack step is followed by `scripts/clean-mcpb.ts`, which prunes dev dependencies (`mcpb clean`) and strips two classes of `node_modules/**` content that root-anchored `.mcpbignore` patterns cannot reach: dependency-shipped agent docs (`framework-skills/`, `skills/`, `.claude/`, `.agents/`, `SKILL.md`) and platform-specific native bindings, which would otherwise lock the bundle to the platform it was packed on. A server using DataCanvas therefore ships a portable bundle without the DuckDB native — `@duckdb/node-api` is an optional peer loaded lazily, so canvas tools report an actionable install hint and every other tool works normally. 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.
|
|
327
362
|
|
|
328
|
-
**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.
|
|
363
|
+
**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, that every `user_config` option is wired into `mcp_config.env` as `"X": "${user_config.X}"` (the host substitutes nothing else — `"${X}"` reaches the server as that literal string), and that an optional string option carries `"default": ""`.
|
|
329
364
|
|
|
330
|
-
**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`.
|
|
365
|
+
**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 `framework-skills/polish-docs-meta/references/readme.md`.
|
|
331
366
|
|
|
332
367
|
---
|
|
333
368
|
|
|
@@ -341,23 +376,29 @@ Each per-version file opens with YAML frontmatter:
|
|
|
341
376
|
---
|
|
342
377
|
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
343
378
|
breaking: false # optional — true flags breaking changes
|
|
344
|
-
security: false # optional — true
|
|
379
|
+
security: false # optional — true ONLY for a source-code security fix, never a dependency CVE bump
|
|
345
380
|
---
|
|
346
381
|
|
|
347
382
|
# 0.1.0 — YYYY-MM-DD
|
|
348
383
|
...
|
|
349
384
|
```
|
|
350
385
|
|
|
351
|
-
`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`.
|
|
386
|
+
`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 — set it only for a security fix in this server's *own source code*, never for a routine dependency or transitive CVE bump (record those under `## Dependencies`). When both are set, badges render `· ⚠️ Breaking · 🛡️ Security`.
|
|
352
387
|
|
|
353
388
|
`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.
|
|
354
389
|
|
|
355
|
-
**Section order
|
|
390
|
+
**Section order:** the Keep a Changelog sequence — Added, Changed, Deprecated, Removed, Fixed, Security — then `Dependencies` last. Include only sections with entries — don't ship empty headers.
|
|
356
391
|
|
|
357
392
|
**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.
|
|
358
393
|
|
|
359
394
|
---
|
|
360
395
|
|
|
396
|
+
## Publishing
|
|
397
|
+
|
|
398
|
+
**Every release goes through a release PR, straight-through** — `git-wrapup`'s "Release PR mode", mode `straight-through`. One run: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-and-publish` then fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. A caller's brief may run a given release as `gated` instead — a `release-pr-review` pass on the open PR before `release-and-publish`. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
361
402
|
## Imports
|
|
362
403
|
|
|
363
404
|
```ts
|
|
@@ -384,7 +425,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
|
|
|
384
425
|
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
385
426
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
386
427
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
387
|
-
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` =
|
|
388
|
-
- [ ] `.codex-plugin/mcp.json` updated — server name key
|
|
389
|
-
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry
|
|
428
|
+
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = the unscoped repo name (never the npm scope — `lint:packaging` enforces this); `interface.shortDescription` from `package.json` description
|
|
429
|
+
- [ ] `.codex-plugin/mcp.json` updated — server name key is the unscoped repo name; every user-supplied variable (API key, contact email, instance URL) is listed in `env_vars` so Codex forwards it from the user's environment. Never write `"KEY": ""` into `env` — an empty value replaces the user's exported key and is read as unset
|
|
430
|
+
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `author`, `repository`, `license`, `keywords` from `package.json`; inline `mcpServers` entry keyed by the unscoped repo name. Every user-supplied variable is declared under `userConfig` (`type`, `title`, `description`; `sensitive: true` for keys and tokens; `required: true` or `default: ""`) and referenced from `env` as `"KEY": "${user_config.<option>}"` — mirror the `user_config` block in `manifest.json`. Never write `"KEY": ""` into `env`
|
|
390
431
|
- [ ] `npm run devcheck` passes
|
package/Dockerfile
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# This stage installs all dependencies (including dev), builds the TypeScript
|
|
5
5
|
# source code into JavaScript, and prepares the production assets.
|
|
6
6
|
# ==============================================================================
|
|
7
|
-
FROM oven/bun:1.
|
|
7
|
+
FROM --platform=$BUILDPLATFORM oven/bun:1.4.0 AS build
|
|
8
8
|
|
|
9
9
|
WORKDIR /usr/src/app
|
|
10
10
|
|
|
@@ -19,9 +19,8 @@ RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
|
19
19
|
# Copy the rest of the source code
|
|
20
20
|
COPY . .
|
|
21
21
|
|
|
22
|
-
# Build the application
|
|
23
|
-
|
|
24
|
-
RUN bun scripts/build.ts
|
|
22
|
+
# Build the application
|
|
23
|
+
RUN bun run build
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
# ==============================================================================
|
|
@@ -31,7 +30,7 @@ RUN bun scripts/build.ts
|
|
|
31
30
|
# application. It uses a slim base image and only includes production
|
|
32
31
|
# dependencies and build artifacts.
|
|
33
32
|
# ==============================================================================
|
|
34
|
-
FROM oven/bun:1.
|
|
33
|
+
FROM oven/bun:1.4.0-slim AS production
|
|
35
34
|
|
|
36
35
|
WORKDIR /usr/src/app
|
|
37
36
|
|
|
@@ -42,7 +41,7 @@ ENV NODE_ENV=production
|
|
|
42
41
|
# OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
|
|
43
42
|
ARG APP_VERSION
|
|
44
43
|
LABEL org.opencontainers.image.title="cyanheads-mcp-server"
|
|
45
|
-
LABEL org.opencontainers.image.description="Fleet discovery
|
|
44
|
+
LABEL org.opencontainers.image.description="Fleet discovery for the cyanheads MCP ecosystem — semantic search + install snippets."
|
|
46
45
|
LABEL org.opencontainers.image.licenses="Apache-2.0"
|
|
47
46
|
LABEL org.opencontainers.image.version="${APP_VERSION}"
|
|
48
47
|
LABEL org.opencontainers.image.source="https://github.com/cyanheads/cyanheads-mcp-server"
|
|
@@ -51,9 +50,10 @@ LABEL org.opencontainers.image.source="https://github.com/cyanheads/cyanheads-mc
|
|
|
51
50
|
COPY package.json bun.lock ./
|
|
52
51
|
|
|
53
52
|
# Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
|
|
54
|
-
# that are not needed in the final production image.
|
|
53
|
+
# that are not needed in the final production image. `--omit=peer` excludes the
|
|
54
|
+
# framework's optional peer tiers; direct runtime imports remain in dependencies.
|
|
55
55
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
56
|
-
bun install --production --frozen-lockfile --ignore-scripts
|
|
56
|
+
bun install --production --omit=peer --frozen-lockfile --ignore-scripts
|
|
57
57
|
|
|
58
58
|
# Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
|
|
59
59
|
# These are not bundled by default to keep the base image lean. Enable at build time
|
|
@@ -61,7 +61,7 @@ RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
|
61
61
|
ARG OTEL_ENABLED=true
|
|
62
62
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
63
63
|
if [ "$OTEL_ENABLED" = "true" ]; then \
|
|
64
|
-
bun add --omit=dev --ignore-scripts @hono/otel \
|
|
64
|
+
bun add --omit=dev --omit=peer --ignore-scripts @hono/otel \
|
|
65
65
|
@opentelemetry/instrumentation-http \
|
|
66
66
|
@opentelemetry/exporter-metrics-otlp-http \
|
|
67
67
|
@opentelemetry/exporter-trace-otlp-http \
|
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@ Apache License
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2026 Casey Hand @cyanheads
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|