@cyanheads/seerr-mcp-server 0.1.2 → 0.1.4
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 +47 -28
- package/CLAUDE.md +47 -28
- package/Dockerfile +17 -5
- package/README.md +52 -55
- package/changelog/0.1.x/0.1.3.md +36 -0
- package/changelog/0.1.x/0.1.4.md +34 -0
- package/changelog/template.md +62 -40
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/resources/definitions/index.d.ts +1 -0
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/request.resource.d.ts +2 -0
- package/dist/mcp-server/resources/definitions/request.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/request.resource.js +2 -0
- package/dist/mcp-server/resources/definitions/request.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-media.tool.d.ts +2 -0
- package/dist/mcp-server/tools/definitions/get-media.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-media.tool.js +2 -0
- package/dist/mcp-server/tools/definitions/get-media.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +4 -1
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/request-media.tool.d.ts +10 -5
- package/dist/mcp-server/tools/definitions/request-media.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/request-media.tool.js +48 -16
- package/dist/mcp-server/tools/definitions/request-media.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/request-status.tool.d.ts +2 -0
- package/dist/mcp-server/tools/definitions/request-status.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/request-status.tool.js +2 -0
- package/dist/mcp-server/tools/definitions/request-status.tool.js.map +1 -1
- package/dist/services/seerr/seerr-service.d.ts.map +1 -1
- package/dist/services/seerr/seerr-service.js +5 -2
- package/dist/services/seerr/seerr-service.js.map +1 -1
- package/dist/services/seerr/titles.d.ts.map +1 -1
- package/dist/services/seerr/titles.js +16 -5
- package/dist/services/seerr/titles.js.map +1 -1
- package/package.json +21 -10
- package/server.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** seerr-mcp-server
|
|
4
|
-
**Version:** 0.1.
|
|
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.1.4
|
|
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
|
|
|
@@ -19,8 +19,8 @@ A workflow MCP server over a self-hosted Jellyseerr/Overseerr instance: **search
|
|
|
19
19
|
|
|
20
20
|
**Two invariants that must never regress:**
|
|
21
21
|
|
|
22
|
-
1. **Guarded write.** `seerr_request_media` is the only mutation. It defaults to `mode: preview` (resolve + validate, no POST); the real write fires only on `mode: request
|
|
23
|
-
2. **PII/infra redaction.** Every raw Jellyseerr payload is projected through `src/services/seerr/normalizers.ts` — the single choke point — before output. It allow-lists fields: `User` → `{ id, displayName }`, and drops operator email, Plex/Jellyfin tokens, `serviceUrl`, `vapidPublic`, and filesystem paths (gated behind `includePaths`). The base URL and API key live only in config and never appear in output. Redaction lives in normalizers, not `format()`, so both `structuredContent` and `content[]` are clean.
|
|
22
|
+
1. **Guarded write.** `seerr_request_media` is the only mutation. It defaults to `mode: preview` (resolve + validate, no POST); the real write fires only on `mode: request` and only once the handler is re-entered with a schema-valid acceptance on `ctx.inputs`, with `destructiveHint: true` surfacing the risk in client-side approval flows. There is no branch that proceeds without an acceptance — a client that never answers leaves the write un-run. Capability validation (4K/seasons/partial) runs locally against cached settings before any POST. The session mode must resolve to `stateful`: the round trip needs a live session for 2025-era clients, and `stateless` refuses it. `src/index.ts` declares `sessionMode: { default: 'stateful', require: 'stateful' }`, so a `stateless` HTTP deployment fails startup with a `ConfigurationError` instead of degrading the tool; stdio is never refused.
|
|
23
|
+
2. **PII/infra redaction.** Every raw Jellyseerr payload is projected through `src/services/seerr/normalizers.ts` — the single choke point — before output. It allow-lists fields: `User` → `{ id, displayName }`, and drops operator email, Plex/Jellyfin tokens, `serviceUrl`, `vapidPublic`, and filesystem paths (gated behind `includePaths`). The base URL and API key live only in config and never appear in output. Redaction lives in normalizers, not `format()`, so both `structuredContent` and `content[]` are clean. `ctx.log` is a third output surface — it is dual-sink as of mcp-ts-core 0.12.0, mirroring every call to the client as `notifications/message` — so log only classified reasons and the caller's own inputs, never a raw upstream or network message.
|
|
24
24
|
|
|
25
25
|
The authoritative tool surface, live API quirks, and status-decoding tables are in [`docs/design.md`](docs/design.md).
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ The authoritative tool surface, live API quirks, and status-decoding tables are
|
|
|
31
31
|
- **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.
|
|
32
32
|
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
33
33
|
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
34
|
-
- **
|
|
34
|
+
- **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.
|
|
35
35
|
- **Secrets in env vars only** — never hardcoded.
|
|
36
36
|
- **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.
|
|
37
37
|
|
|
@@ -158,6 +158,7 @@ await createApp({
|
|
|
158
158
|
title: 'seerr-mcp-server',
|
|
159
159
|
tools: allToolDefinitions,
|
|
160
160
|
resources: allResourceDefinitions,
|
|
161
|
+
sessionMode: { default: 'stateful', require: 'stateful' },
|
|
161
162
|
instructions:
|
|
162
163
|
'Local Seerr request workflow. Search first (seerr_search_media), confirm the exact title ' +
|
|
163
164
|
'(seerr_get_media), then request via seerr_request_media — which defaults to mode:preview and ' +
|
|
@@ -170,6 +171,12 @@ await createApp({
|
|
|
170
171
|
|
|
171
172
|
`instructions` is optional server-level orientation, sent on every `initialize` as session-level context. Use it for deployment guidance instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
172
173
|
|
|
174
|
+
### Session posture and shutdown
|
|
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). `require: 'stateful'` is set here because `seerr_request_media` asks the caller for input mid-handler via `ctx.requestInput`: startup 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. This server declares none: `SeerrService` holds only config strings and issues per-call `fetch`es, and the settings cache lives in `ctx.state`, which the framework disposes.
|
|
179
|
+
|
|
173
180
|
---
|
|
174
181
|
|
|
175
182
|
## Context
|
|
@@ -178,10 +185,12 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
178
185
|
|
|
179
186
|
| Property | Description |
|
|
180
187
|
|:---------|:------------|
|
|
181
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
188
|
+
| `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. |
|
|
182
189
|
| `ctx.state` | Tenant-scoped KV — used to cache `/settings/public` + `/status` with a short TTL so capability checks don't round-trip on every preview. |
|
|
183
|
-
| `ctx.
|
|
190
|
+
| `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. The guarded-write confirmation on `mode: request` runs through it. |
|
|
191
|
+
| `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. Pass the schema to `.accepted()`: the SDK never re-validates what the client sent back. |
|
|
184
192
|
| `ctx.enrich` | Output enrichment — `.total(n)`, `.echo(query)`, `.truncated({ shown, cap })`, `.notice(msg)` for capped-list disclosure and effective-query echo. |
|
|
193
|
+
| `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`. |
|
|
185
194
|
| `ctx.fail` / `ctx.recoveryFor` | Typed-error contract throw + recovery-metadata lookup against each tool's `errors[]`. |
|
|
186
195
|
| `ctx.signal` | `AbortSignal` for cancellation. |
|
|
187
196
|
| `ctx.requestId` | Unique request ID. |
|
|
@@ -193,7 +202,7 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
193
202
|
|
|
194
203
|
Handlers throw — the framework catches, classifies, and formats.
|
|
195
204
|
|
|
196
|
-
**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
|
|
205
|
+
**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, 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. Spread `ctx.recoveryFor('reason')` into 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 — this server's `media_not_found` / `request_not_found` entries are all raised by the `services/seerr/errors.ts` classifier and carry the marker. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
197
206
|
|
|
198
207
|
```ts
|
|
199
208
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
@@ -205,7 +214,7 @@ errors: [
|
|
|
205
214
|
],
|
|
206
215
|
async handler(input, ctx) {
|
|
207
216
|
const item = await db.find(input.id);
|
|
208
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}
|
|
217
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`, { ...ctx.recoveryFor('no_match') });
|
|
209
218
|
return item;
|
|
210
219
|
}
|
|
211
220
|
```
|
|
@@ -268,9 +277,9 @@ src/
|
|
|
268
277
|
|
|
269
278
|
## Skills
|
|
270
279
|
|
|
271
|
-
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.
|
|
280
|
+
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.
|
|
272
281
|
|
|
273
|
-
**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.
|
|
282
|
+
**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.
|
|
274
283
|
|
|
275
284
|
Available skills:
|
|
276
285
|
|
|
@@ -290,8 +299,9 @@ Available skills:
|
|
|
290
299
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
291
300
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
292
301
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
293
|
-
| `git-wrapup` | Land working-tree changes as a
|
|
294
|
-
| `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` |
|
|
295
305
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
296
306
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
297
307
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
@@ -299,7 +309,7 @@ Available skills:
|
|
|
299
309
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
300
310
|
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
301
311
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
302
|
-
| `api-context` | Context interface, logger, state,
|
|
312
|
+
| `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
|
|
303
313
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
304
314
|
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
305
315
|
| `api-mirror` | MirrorService — persistent self-refreshing local mirror of a bulk upstream dataset (not used by this server) |
|
|
@@ -309,7 +319,7 @@ Available skills:
|
|
|
309
319
|
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
310
320
|
| `api-workers` | Cloudflare Workers runtime |
|
|
311
321
|
|
|
312
|
-
**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.
|
|
322
|
+
**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.
|
|
313
323
|
|
|
314
324
|
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
315
325
|
|
|
@@ -325,7 +335,8 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
325
335
|
| `bun run rebuild` | Clean + build |
|
|
326
336
|
| `bun run clean` | Remove build artifacts |
|
|
327
337
|
| `bun run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
328
|
-
| `bun run audit:
|
|
338
|
+
| `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` |
|
|
339
|
+
| `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` |
|
|
329
340
|
| `bun run lint:mcp` | Run the MCP definition linter standalone (rule catalog: `api-linter` skill) |
|
|
330
341
|
| `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity (run by devcheck) |
|
|
331
342
|
| `bun run list-skills` | Print the skill registry |
|
|
@@ -339,15 +350,17 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
339
350
|
| `bun run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
|
|
340
351
|
| `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
|
|
341
352
|
|
|
353
|
+
**CI is one file.** `.github/workflows/codeql.yml` 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.
|
|
354
|
+
|
|
342
355
|
---
|
|
343
356
|
|
|
344
357
|
## Bundling
|
|
345
358
|
|
|
346
|
-
`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 (`
|
|
359
|
+
`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. 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.
|
|
347
360
|
|
|
348
|
-
**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.
|
|
361
|
+
**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": ""`.
|
|
349
362
|
|
|
350
|
-
**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`.
|
|
363
|
+
**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`.
|
|
351
364
|
|
|
352
365
|
---
|
|
353
366
|
|
|
@@ -361,23 +374,29 @@ Each per-version file opens with YAML frontmatter:
|
|
|
361
374
|
---
|
|
362
375
|
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
363
376
|
breaking: false # optional — true flags breaking changes
|
|
364
|
-
security: false # optional — true
|
|
377
|
+
security: false # optional — true ONLY for a source-code security fix, never a dependency CVE bump
|
|
365
378
|
---
|
|
366
379
|
|
|
367
380
|
# 0.1.0 — YYYY-MM-DD
|
|
368
381
|
...
|
|
369
382
|
```
|
|
370
383
|
|
|
371
|
-
`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`.
|
|
384
|
+
`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`.
|
|
372
385
|
|
|
373
386
|
`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.
|
|
374
387
|
|
|
375
|
-
**Section order
|
|
388
|
+
**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.
|
|
376
389
|
|
|
377
390
|
**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.
|
|
378
391
|
|
|
379
392
|
---
|
|
380
393
|
|
|
394
|
+
## Publishing
|
|
395
|
+
|
|
396
|
+
**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.
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
381
400
|
## Imports
|
|
382
401
|
|
|
383
402
|
```ts
|
|
@@ -404,7 +423,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
|
|
|
404
423
|
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
405
424
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
406
425
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
407
|
-
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` =
|
|
408
|
-
- [ ] `.codex-plugin/mcp.json` updated — server name key
|
|
409
|
-
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry
|
|
426
|
+
- [ ] `.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
|
|
427
|
+
- [ ] `.codex-plugin/mcp.json` updated — server name key is the unscoped repo name; every user-supplied variable (API key, 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
|
|
428
|
+
- [ ] `.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`
|
|
410
429
|
- [ ] `npm run devcheck` passes
|
package/CLAUDE.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** seerr-mcp-server
|
|
4
|
-
**Version:** 0.1.
|
|
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.1.4
|
|
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
|
|
|
@@ -19,8 +19,8 @@ A workflow MCP server over a self-hosted Jellyseerr/Overseerr instance: **search
|
|
|
19
19
|
|
|
20
20
|
**Two invariants that must never regress:**
|
|
21
21
|
|
|
22
|
-
1. **Guarded write.** `seerr_request_media` is the only mutation. It defaults to `mode: preview` (resolve + validate, no POST); the real write fires only on `mode: request
|
|
23
|
-
2. **PII/infra redaction.** Every raw Jellyseerr payload is projected through `src/services/seerr/normalizers.ts` — the single choke point — before output. It allow-lists fields: `User` → `{ id, displayName }`, and drops operator email, Plex/Jellyfin tokens, `serviceUrl`, `vapidPublic`, and filesystem paths (gated behind `includePaths`). The base URL and API key live only in config and never appear in output. Redaction lives in normalizers, not `format()`, so both `structuredContent` and `content[]` are clean.
|
|
22
|
+
1. **Guarded write.** `seerr_request_media` is the only mutation. It defaults to `mode: preview` (resolve + validate, no POST); the real write fires only on `mode: request` and only once the handler is re-entered with a schema-valid acceptance on `ctx.inputs`, with `destructiveHint: true` surfacing the risk in client-side approval flows. There is no branch that proceeds without an acceptance — a client that never answers leaves the write un-run. Capability validation (4K/seasons/partial) runs locally against cached settings before any POST. The session mode must resolve to `stateful`: the round trip needs a live session for 2025-era clients, and `stateless` refuses it. `src/index.ts` declares `sessionMode: { default: 'stateful', require: 'stateful' }`, so a `stateless` HTTP deployment fails startup with a `ConfigurationError` instead of degrading the tool; stdio is never refused.
|
|
23
|
+
2. **PII/infra redaction.** Every raw Jellyseerr payload is projected through `src/services/seerr/normalizers.ts` — the single choke point — before output. It allow-lists fields: `User` → `{ id, displayName }`, and drops operator email, Plex/Jellyfin tokens, `serviceUrl`, `vapidPublic`, and filesystem paths (gated behind `includePaths`). The base URL and API key live only in config and never appear in output. Redaction lives in normalizers, not `format()`, so both `structuredContent` and `content[]` are clean. `ctx.log` is a third output surface — it is dual-sink as of mcp-ts-core 0.12.0, mirroring every call to the client as `notifications/message` — so log only classified reasons and the caller's own inputs, never a raw upstream or network message.
|
|
24
24
|
|
|
25
25
|
The authoritative tool surface, live API quirks, and status-decoding tables are in [`docs/design.md`](docs/design.md).
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ The authoritative tool surface, live API quirks, and status-decoding tables are
|
|
|
31
31
|
- **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.
|
|
32
32
|
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
33
33
|
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
34
|
-
- **
|
|
34
|
+
- **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.
|
|
35
35
|
- **Secrets in env vars only** — never hardcoded.
|
|
36
36
|
- **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.
|
|
37
37
|
|
|
@@ -158,6 +158,7 @@ await createApp({
|
|
|
158
158
|
title: 'seerr-mcp-server',
|
|
159
159
|
tools: allToolDefinitions,
|
|
160
160
|
resources: allResourceDefinitions,
|
|
161
|
+
sessionMode: { default: 'stateful', require: 'stateful' },
|
|
161
162
|
instructions:
|
|
162
163
|
'Local Seerr request workflow. Search first (seerr_search_media), confirm the exact title ' +
|
|
163
164
|
'(seerr_get_media), then request via seerr_request_media — which defaults to mode:preview and ' +
|
|
@@ -170,6 +171,12 @@ await createApp({
|
|
|
170
171
|
|
|
171
172
|
`instructions` is optional server-level orientation, sent on every `initialize` as session-level context. Use it for deployment guidance instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
172
173
|
|
|
174
|
+
### Session posture and shutdown
|
|
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). `require: 'stateful'` is set here because `seerr_request_media` asks the caller for input mid-handler via `ctx.requestInput`: startup 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. This server declares none: `SeerrService` holds only config strings and issues per-call `fetch`es, and the settings cache lives in `ctx.state`, which the framework disposes.
|
|
179
|
+
|
|
173
180
|
---
|
|
174
181
|
|
|
175
182
|
## Context
|
|
@@ -178,10 +185,12 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
178
185
|
|
|
179
186
|
| Property | Description |
|
|
180
187
|
|:---------|:------------|
|
|
181
|
-
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
188
|
+
| `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. |
|
|
182
189
|
| `ctx.state` | Tenant-scoped KV — used to cache `/settings/public` + `/status` with a short TTL so capability checks don't round-trip on every preview. |
|
|
183
|
-
| `ctx.
|
|
190
|
+
| `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. The guarded-write confirmation on `mode: request` runs through it. |
|
|
191
|
+
| `ctx.inputs` | Reader over a retried request's responses — `.accepted(key, schema)`, `.view(key)`, `.state()`, `.dropped`. Empty on the first round. Pass the schema to `.accepted()`: the SDK never re-validates what the client sent back. |
|
|
184
192
|
| `ctx.enrich` | Output enrichment — `.total(n)`, `.echo(query)`, `.truncated({ shown, cap })`, `.notice(msg)` for capped-list disclosure and effective-query echo. |
|
|
193
|
+
| `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`. |
|
|
185
194
|
| `ctx.fail` / `ctx.recoveryFor` | Typed-error contract throw + recovery-metadata lookup against each tool's `errors[]`. |
|
|
186
195
|
| `ctx.signal` | `AbortSignal` for cancellation. |
|
|
187
196
|
| `ctx.requestId` | Unique request ID. |
|
|
@@ -193,7 +202,7 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
193
202
|
|
|
194
203
|
Handlers throw — the framework catches, classifies, and formats.
|
|
195
204
|
|
|
196
|
-
**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
|
|
205
|
+
**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, 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. Spread `ctx.recoveryFor('reason')` into 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 — this server's `media_not_found` / `request_not_found` entries are all raised by the `services/seerr/errors.ts` classifier and carry the marker. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
197
206
|
|
|
198
207
|
```ts
|
|
199
208
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
@@ -205,7 +214,7 @@ errors: [
|
|
|
205
214
|
],
|
|
206
215
|
async handler(input, ctx) {
|
|
207
216
|
const item = await db.find(input.id);
|
|
208
|
-
if (!item) throw ctx.fail('no_match', `No item ${input.id}
|
|
217
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`, { ...ctx.recoveryFor('no_match') });
|
|
209
218
|
return item;
|
|
210
219
|
}
|
|
211
220
|
```
|
|
@@ -268,9 +277,9 @@ src/
|
|
|
268
277
|
|
|
269
278
|
## Skills
|
|
270
279
|
|
|
271
|
-
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.
|
|
280
|
+
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.
|
|
272
281
|
|
|
273
|
-
**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.
|
|
282
|
+
**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.
|
|
274
283
|
|
|
275
284
|
Available skills:
|
|
276
285
|
|
|
@@ -290,8 +299,9 @@ Available skills:
|
|
|
290
299
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
291
300
|
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
292
301
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
293
|
-
| `git-wrapup` | Land working-tree changes as a
|
|
294
|
-
| `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` |
|
|
295
305
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
296
306
|
| `orchestrations` | Chain task skills into a gated multi-phase pipeline — build-out, QA-fix, update-ship — when you can spawn sub-agents |
|
|
297
307
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
@@ -299,7 +309,7 @@ Available skills:
|
|
|
299
309
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
300
310
|
| `api-canvas` | DataCanvas: register tabular data, run SQL, export, plus the `spillover()` helper for big result sets — Tier 3 opt-in |
|
|
301
311
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
302
|
-
| `api-context` | Context interface, logger, state,
|
|
312
|
+
| `api-context` | Context interface, RequestContext, logger, state, multi-round-trip input |
|
|
303
313
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
304
314
|
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
305
315
|
| `api-mirror` | MirrorService — persistent self-refreshing local mirror of a bulk upstream dataset (not used by this server) |
|
|
@@ -309,7 +319,7 @@ Available skills:
|
|
|
309
319
|
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
310
320
|
| `api-workers` | Cloudflare Workers runtime |
|
|
311
321
|
|
|
312
|
-
**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.
|
|
322
|
+
**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.
|
|
313
323
|
|
|
314
324
|
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
315
325
|
|
|
@@ -325,7 +335,8 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
325
335
|
| `bun run rebuild` | Clean + build |
|
|
326
336
|
| `bun run clean` | Remove build artifacts |
|
|
327
337
|
| `bun run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
328
|
-
| `bun run audit:
|
|
338
|
+
| `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` |
|
|
339
|
+
| `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` |
|
|
329
340
|
| `bun run lint:mcp` | Run the MCP definition linter standalone (rule catalog: `api-linter` skill) |
|
|
330
341
|
| `bun run lint:packaging` | Packaging surface checks — `server.json`/`manifest.json` env-var parity (run by devcheck) |
|
|
331
342
|
| `bun run list-skills` | Print the skill registry |
|
|
@@ -339,15 +350,17 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
339
350
|
| `bun run changelog:check` | Verify `CHANGELOG.md` is in sync (used by devcheck) |
|
|
340
351
|
| `bun run bundle` | Build, pack, and clean a `.mcpb` for one-click Claude Desktop install |
|
|
341
352
|
|
|
353
|
+
**CI is one file.** `.github/workflows/codeql.yml` 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.
|
|
354
|
+
|
|
342
355
|
---
|
|
343
356
|
|
|
344
357
|
## Bundling
|
|
345
358
|
|
|
346
|
-
`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 (`
|
|
359
|
+
`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. 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.
|
|
347
360
|
|
|
348
|
-
**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.
|
|
361
|
+
**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": ""`.
|
|
349
362
|
|
|
350
|
-
**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`.
|
|
363
|
+
**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`.
|
|
351
364
|
|
|
352
365
|
---
|
|
353
366
|
|
|
@@ -361,23 +374,29 @@ Each per-version file opens with YAML frontmatter:
|
|
|
361
374
|
---
|
|
362
375
|
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
363
376
|
breaking: false # optional — true flags breaking changes
|
|
364
|
-
security: false # optional — true
|
|
377
|
+
security: false # optional — true ONLY for a source-code security fix, never a dependency CVE bump
|
|
365
378
|
---
|
|
366
379
|
|
|
367
380
|
# 0.1.0 — YYYY-MM-DD
|
|
368
381
|
...
|
|
369
382
|
```
|
|
370
383
|
|
|
371
|
-
`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`.
|
|
384
|
+
`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`.
|
|
372
385
|
|
|
373
386
|
`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.
|
|
374
387
|
|
|
375
|
-
**Section order
|
|
388
|
+
**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.
|
|
376
389
|
|
|
377
390
|
**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.
|
|
378
391
|
|
|
379
392
|
---
|
|
380
393
|
|
|
394
|
+
## Publishing
|
|
395
|
+
|
|
396
|
+
**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.
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
381
400
|
## Imports
|
|
382
401
|
|
|
383
402
|
```ts
|
|
@@ -404,7 +423,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
|
|
|
404
423
|
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
405
424
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
406
425
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
407
|
-
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` =
|
|
408
|
-
- [ ] `.codex-plugin/mcp.json` updated — server name key
|
|
409
|
-
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry
|
|
426
|
+
- [ ] `.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
|
|
427
|
+
- [ ] `.codex-plugin/mcp.json` updated — server name key is the unscoped repo name; every user-supplied variable (API key, 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
|
|
428
|
+
- [ ] `.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`
|
|
410
429
|
- [ ] `npm run devcheck` passes
|
package/Dockerfile
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
#
|
|
4
4
|
# This stage installs all dependencies (including dev), builds the TypeScript
|
|
5
5
|
# source code into JavaScript, and prepares the production assets.
|
|
6
|
+
# The build stage pins to the BUILD platform, never the target: it emits
|
|
7
|
+
# architecture-independent JavaScript, so running it emulated buys nothing and
|
|
8
|
+
# costs a QEMU amd64 compile that Bun exhausts memory on.
|
|
6
9
|
# ==============================================================================
|
|
7
|
-
FROM oven/bun:1.
|
|
10
|
+
FROM --platform=$BUILDPLATFORM oven/bun:1.4.0 AS build
|
|
8
11
|
|
|
9
12
|
WORKDIR /usr/src/app
|
|
10
13
|
|
|
@@ -30,7 +33,7 @@ RUN bun run build
|
|
|
30
33
|
# application. It uses a slim base image and only includes production
|
|
31
34
|
# dependencies and build artifacts.
|
|
32
35
|
# ==============================================================================
|
|
33
|
-
FROM oven/bun:1.
|
|
36
|
+
FROM oven/bun:1.4.0-slim AS production
|
|
34
37
|
|
|
35
38
|
WORKDIR /usr/src/app
|
|
36
39
|
|
|
@@ -51,8 +54,13 @@ COPY package.json bun.lock ./
|
|
|
51
54
|
|
|
52
55
|
# Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
|
|
53
56
|
# that are not needed in the final production image.
|
|
57
|
+
# `--omit=peer` drops the framework's optional peer tiers (test runner, service
|
|
58
|
+
# SDKs, parsers) that Bun would otherwise auto-install. Anything this server
|
|
59
|
+
# actually imports belongs in its own `dependencies`, so nothing needed at
|
|
60
|
+
# runtime is lost. The OTEL step below carries the same flag — without it, that
|
|
61
|
+
# install re-resolves the graph and pulls every optional peer back in.
|
|
54
62
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
55
|
-
bun install --production --frozen-lockfile --ignore-scripts
|
|
63
|
+
bun install --production --omit=peer --frozen-lockfile --ignore-scripts
|
|
56
64
|
|
|
57
65
|
# Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
|
|
58
66
|
# These are not bundled by default to keep the base image lean. Enable at build time
|
|
@@ -60,7 +68,7 @@ RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
|
60
68
|
ARG OTEL_ENABLED=true
|
|
61
69
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
62
70
|
if [ "$OTEL_ENABLED" = "true" ]; then \
|
|
63
|
-
bun add --omit=dev --ignore-scripts @hono/otel \
|
|
71
|
+
bun add --omit=dev --omit=peer --ignore-scripts @hono/otel \
|
|
64
72
|
@opentelemetry/instrumentation-http \
|
|
65
73
|
@opentelemetry/exporter-metrics-otlp-http \
|
|
66
74
|
@opentelemetry/exporter-trace-otlp-http \
|
|
@@ -110,7 +118,11 @@ ARG PORT
|
|
|
110
118
|
ENV MCP_HTTP_PORT=${PORT:-3010}
|
|
111
119
|
ENV MCP_HTTP_HOST="0.0.0.0"
|
|
112
120
|
ENV MCP_TRANSPORT_TYPE="http"
|
|
113
|
-
|
|
121
|
+
# stateful (not the auto default) is load-bearing here: seerr_request_media gates its
|
|
122
|
+
# write on a ctx.requestInput round, and a 2025-era client can only answer that round
|
|
123
|
+
# over a live session. Stateless serves each such request from a fresh instance that
|
|
124
|
+
# never saw initialize, so it refuses the round trip and the tool becomes unusable.
|
|
125
|
+
ENV MCP_SESSION_MODE="stateful"
|
|
114
126
|
ENV MCP_LOG_LEVEL="info"
|
|
115
127
|
ENV LOGS_DIR="/var/log/seerr-mcp-server"
|
|
116
128
|
ENV MCP_FORCE_CONSOLE_LOGGING="true"
|