api-mirror

api-mirror is a skill for Claude Code from cyanheads/openlibrary-mcp-server. It costs 68 tokens per session (2,142 once invoked), scanned A, a copy of api-mirror, Apache-2.0.

A guide for building a persistent local copy of a large upstream dataset. The mirror stores data in SQLite, a small database that can also provide full-text search, and refreshes it from the original source.

In plain words
What is it for?
Use it when building a server around bulk data such as papers, and when you need syncing, resumable updates, indexed fields, or full-text search on Node or Bun.
Why use it?
It avoids repeatedly paging through a slow or large live API whenever a user makes a query. Local storage also allows searches to continue using a saved index.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is ./scripts/.

Part of the openlibrary-mcp-server plugin — 32 skills, 1 MCP server shipped together

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/cyanheads/openlibrary-mcp-server
agentmods
npx agentmods add skills/cyanheads/openlibrary-mcp-server/api-mirror

Made for: Claude Code.

Or install openlibrary-mcp-server, the plugin that ships this one along with the rest of its 32 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-mirror

README.md
[![agentmods](https://agentmods.dev/badge/skills/cyanheads/openlibrary-mcp-server/api-mirror.svg)](https://agentmods.dev/skills/cyanheads/openlibrary-mcp-server/api-mirror)
Your own site
<a href="https://agentmods.dev/skills/cyanheads/openlibrary-mcp-server/api-mirror"><img src="https://agentmods.dev/badge/skills/cyanheads/openlibrary-mcp-server/api-mirror.svg" alt="Measured on agentmods" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,142 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00068 $0.02142
Opus 5 $0.00034 $0.01071
Sonnet 5 $0.00014 $0.00428
Haiku 4.5 $0.00007 $0.00214

Measured 6d ago against content hash 89b98aefc722, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

api-mirror scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to api-mirror — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/api-mirror/SKILL.md · 133 lines

How it starts

The opening of the file, as written. The whole thing — 133 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

import { defineMirror, sqliteMirrorStore } from '@cyanheads/mcp-ts-core/mirror';

const papers = defineMirror({
  name: 'arxiv-papers',
  store: sqliteMirrorStore({
    path: config.mirrorPath,
    primaryKey: 'id',
    columns: { id: 'TEXT', title: 'TEXT', authors: 'TEXT', abstract: 'TEXT', updated: 'TEXT' },
    fts: ['title', 'authors', 'abstract'],          // opt-in FTS5 external-content index
    indexes: [{ columns: ['updated'] }],
  }),
  // The ingester — the one part that is always server-specific.
  async *sync({ mode, cursor, checkpoint, signal }) {
    for await (const page of harvestPages({ resumeFrom: cursor, since: checkpoint, signal })) {
      yield {
        records: page.rows,             // objects keyed by declared column
        tombstones: page.deletedIds,    // primary-key values to delete
        cursor: page.token,             // volatile resume position (see below)
        checkpoint: page.maxStamp,      // durable high-water mark (see below)
      };
    }
  },
});

await papers.runSync({ mode: 'init', signal: AbortSignal.timeout(3_600_000) }); // full; resumes on interrupt
await papers.runSync({ mode: 'refresh' });                                       // incremental
const { rows, total } = await papers.query({ match: 'transformers', limit: 10, offset: 0 });
const status = await papers.status();   // { status, ready, checkpoint, total, ... }

cursor vs. checkpoint — the core distinction

Read the full file on GitHub · 133 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 133 lines · 68 tokens per session scan A 89b98aefc722

Subscribe to this mod's changes

api-mirror is a skill published in the GitHub repository cyanheads/openlibrary-mcp-server (3 stars, last pushed 12d ago), licensed Apache-2.0. It adds 68 tokens to every session and 2,142 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to api-mirror, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

schema-unify

Migrate a brain with runaway type proliferation to the canonical 15-type taxonomy via a doctor check + a durable unify-types job. Collapses dozens of noisy frontmatter types to 15 canonical with subtypes, slug-alias rows, and real link rows. Triggers when the doctor flags type proliferation, or the user asks "what is…

timurgaleev/memex · 85 tokens

bun-docs

Bun 1.2 — runtime, package manager, HTTP server, SQLite, test runner, bundler, TypeScript, FFI, shell API.

pledgeandgrow/pledge-skills · 36 tokens

drizzle-orm-d1

Type-safe ORM for Cloudflare D1 using Drizzle. Use when building D1 schemas, writing type-safe queries, generating migrations with Drizzle Kit, defining relations, using db.batch, or hitting D1ERROR, BEGIN TRANSACTION failures, foreign key constraints, env.DB undefined, or schema inference issues.

samuelpatro/.claude · 69 tokens

api-mirror

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.

cyanheads/eia-energy-mcp-server · 68 tokens

api-mirror

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.

cyanheads/bls-labor-mcp-server · 68 tokens

api-mirror

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.

cyanheads/federal-reserve-mcp-server · 68 tokens