ficaviolaodorata520/met-museum-mcp-server/api-mirror
Claude Code and agent skill by ficaviolaodorata520/met-museum-mcp-server
- community
Checking that the SKILL.md file is still in the repository.
Stand up a persistent, self-refreshing local mirror of a bulk upstream dataset with the MirrorService (@cyanheads/mcp-ts-core/mirror). Use when a server wraps a large or slow API and should query a synced local index (embedded SQLite + FTS5) instead of paginating the live API per request.
Install
npx vskill@latest install ficaviolaodorata520/met-museum-mcp-server/api-mirrorSKILL.md
The same SKILL.md was published earlier as ficaviolaodorata520/met-museum-mcp-server/api-mirror.
Context
The MirrorService owns the source-agnostic half of a local mirror — the embedded store, the sync-state machine, the runner — so a server supplies only the two parts that are irreducibly per-source: the ingester (a sync generator) and the schema. It targets the embedded-SQLite tier (~10⁴–10⁷ rows). Node/Bun only: bun:sqlite is built-in on Bun, better-sqlite3 is an optional peer dependency on Node; the store is unavailable on Workers (no SQLite, no persistent filesystem).
Import from @cyanheads/mcp-ts-core/mirror.
The shape
cursor vs. checkpoint — the core distinction
Two resume dimensions, deliberately separate. Conflating them silently corrupts resume for token-paged sources.
cursor | checkpoint | ||
|---|---|---|---|
| Meaning | Volatile intra-run resume position (e.g. an OAI-PMH resumption token, a page token) | Durable incremental high-water mark (e.g. the max record datestamp) | |
| Lifetime | One run; may expire; cleared on completion | Persists; advances monotonically, only on success | |
| Used for | Resuming an interrupted init | Seeding the next refresh |
Why they can't merge: during a from-scratch init the records aren't ordered by the high-water field, so the max-so-far is not a valid resume position — only the cursor is. After a completed init the cursor is meaningless, but the high-water mark is the correct refresh seed. The framework persists both per page and threads the right one back into sync() per mode. The checkpoint must be lexicographically monotonic (ISO 8601 works); the runner advances the stored checkpoint only when a page's value compares greater.
What you own vs. what the framework owns
| Framework | Server | ||
|---|---|---|---|
Cross-runtime SQLite handle, WAL + busy_timeout | The sync generator (the ingester) | ||
mirror_sync_state + cursor/checkpoint state machine | Translating your query syntax → FTS5 match | ||
| `runSync({ init \ | refresh })`, per-page persist, resume | Mapping upstream records → row objects | |
| Schema gen (columns + FTS + tokenizer + triggers) | Migration content (the up functions) | ||
schema_version + migration runner | Scheduling + init/refresh bootstrap (see below) | ||
Generic query() + the raw-handle escape hatch | Server-specific access paths via the raw handle |
Querying
query({ match?, filters?, sort?, limit, offset }) covers the common case:
match— an FTS5MATCHexpression (only when the store declaresftscolumns). Translate your own query grammar to FTS5 before calling.filters—[{ column, op, value }], AND-combined, over declared columns.op∈eq|ne|gt|gte|lt|lte|in(intakes an array).sort—{ column, direction }or'relevance'(FTS bm25; requiresmatch). Defaults to insertion order.
For access paths the generic query can't express — junction tables for index-backed multi-value filtering, denormalized counters, bespoke bm25 weighting — use the raw handle: const db = await mirror.raw(); then run prepared statements against your own auxiliary tables (declare them via a migration). Add the auxiliary DDL in a migrations step; maintain it from your sync mapping or SQL triggers.
Readiness — key off the completion marker, not live status
status().ready is true once a full sync has ever completed (completedAt != null), not when status === 'complete'. The dataset stays transactionally queryable during a refresh, so a mirror mid-refresh — or one whose last refresh failed — is still ready and should keep serving. Gate the mirror read path on await mirror.ready(); fall back to the live API only when it is false (cold, never-completed init).
Scheduling and bootstrap (server-owned)
The service owns runSync + state; it does not schedule. Wire "self-refreshing" yourself:
- Refresh — register
runSync({ mode: 'refresh' })on a cron viaschedulerServicefrom@cyanheads/mcp-ts-core/utils, insidesetup(). Gate on transport (HTTP) when stdio operators run it out-of-band. - Init — run out-of-band (a CLI script / one-shot), never on startup: a full init can take hours and must not block the server. It is idempotent and resumable — re-running after an interrupt continues from the persisted cursor.
Checklist
- [ ]
defineMirror({ name, store, sync }); the server holds the instance (one per mirror) - [ ]
sqliteMirrorStorespec declaresprimaryKey,columns, and (if searching)fts - [ ]
syncyields{ records, tombstones?, cursor?, checkpoint? }per page; checkpoint is lexicographically monotonic - [ ] Read path gated on
await mirror.ready()with a live fallback when not ready - [ ]
better-sqlite3added as a peer dependency for Node deployments; mirror disabled on Workers - [ ] Refresh wired via
schedulerServiceinsetup(); init runs out-of-band - [ ]
bun run devcheckpasses
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/api-mirror/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ficaviolaodorata520/met-museum-mcp-server/api-mirror)