pdfnative-mcp: Instructions file for Claude Code

CLAUDE.md

pdfnative-mcp CLAUDE.md is an instructions file for Claude Code from Nizoka/pdfnative-mcp. It costs 2,722 tokens per session, scanned A, original, MIT.

Repository instructions for contributors to pdfnative-mcp, a server that lets agents use the pdfnative PDF engine. They explain the project structure, commands, and coding rules.

In plain words
What is it for?
Building, type-checking, linting, testing, checking examples, and understanding the architecture of this TypeScript PDF server.
Why use it?
They give an agent the project-specific guidance needed to change and check the code consistently, while separating contributor guidance from user instructions.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

This is Nizoka/pdfnative-mcp's own configuration. It tells Claude Code how to work on pdfnative-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything pdfnative-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Nizoka/pdfnative-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Nizoka/pdfnative-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/Nizoka/pdfnative-mcp

Made for: Claude Code.

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 pdfnative-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/nizoka/pdfnative-mcp/claude-md.svg)](https://agentmods.dev/instructions/nizoka/pdfnative-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/nizoka/pdfnative-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/nizoka/pdfnative-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,722 This file is loaded in full into every session.
When invoked 2,722 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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.02722 $0.02722
Opus 5 $0.01361 $0.01361
Sonnet 5 $0.00544 $0.00544
Haiku 4.5 $0.00272 $0.00272

Measured 7d ago against content hash c3b09e302325, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

pdfnative-mcp CLAUDE.md 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 7d 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.

CLAUDE.md · 90 lines

How it starts

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

CLAUDE.md

Guidance for Claude Code (and other Claude-based agents) working in this repository. For the runtime tool catalogue and end-user recipes, read AGENTS.md; for architecture depth, docs/KNOWLEDGE_BASE.md. This file is about contributing to the codebase, not using the server.

What this is

pdfnative-mcp is a thin, faithful Model Context Protocol server wrapping the zero-dependency pdfnative PDF engine. TypeScript (strict, ESM-only), Node ≥ 22, @modelcontextprotocol/server (MCP SDK v2, protocol 2026-07-28 with automatic 2025-era fallback). 28 tools, 6 MCP prompts + resources. Three runtime dependencies (pdfnative, the MCP SDK, zod). Current release: 1.6.0 (on pdfnative 1.7.0).

Commands

npm run build          # tsc -p tsconfig.build.json  (emits dist/)
npm run typecheck:all  # tsc --noEmit  (covers src + tests)
npm run lint           # eslint src
npm test               # vitest run
npm run test:coverage  # vitest run --coverage  (enforces thresholds)
npm run examples:check # runs examples/*.json live through the tools/call handler
npm run validate:pdfa  # advisory: veraPDF over the 26-file PDF/A corpus (24 validated; skips when veraPDF is absent; VERAPDF_REQUIRED=1 fails closed; non-blocking in CI)
node scripts/tool-shape.mjs --write   # ONLY after a deliberate tools/list schema change — refreshes tests/_fixtures/tool-shape.json (catalogue parity gate)

Quality gate (run before every commit/PR):

npm run typecheck:all && npm run lint && npm run test && npm run test:coverage && npm run build

Coverage thresholds (global, in vitest.config.ts): statements 89 · branches 80 · functions 90 · lines 91. New code must keep the aggregate above these; never lower them.

Architecture map

  • src/cli.ts — entry point (stdio via serveStdio by default; Streamable HTTP via createMcpHandler when PDFNATIVE_MCP_PORT is set; both with the SDK's legacy fallback).
  • src/http.ts — Node http ↔ Web Request/Response bridge and the Host/Origin loopback guard for the HTTP transport (disconnect detection per response, not per socket). src/auth.ts — opt-in bearer token (PDFNATIVE_MCP_HTTP_TOKEN).
  • src/server.ts — the TOOLS registry (with MCP annotations), request handlers on the low-level Server (not McpServer.registerTool; the read tools' output schemas are projectable — every property optional — so structuredContent always validates, asserted by tests/schema-conformance.test.ts), dispatchOutput (duck-typed result → content builder), SERVER_INSTRUCTIONS, SERVER_CACHE_HINTS, and the resources / prompts capabilities. TOOL_API_VERSION lives here.
  • src/tools/<name>.ts — one file per tool: a hand-written JSON Schema as const, a parallel Zod schema (kept in lock-step), and the handler. src/tools/inspect-layout.ts (28th tool) reuses generate_basic_pdf's block schema and the layout fragment.
  • Shared schema/util modules: src/network.ts (operator-configured TSA / OCSP / CRL providers + SSRF guard — the only egress path), src/blocks.ts (the 7 extended document blocks — table, image, link, toc, barcode, svg, formField — on top of the 6 basic ones; 13 kinds total), src/layout.ts (pageSize / margins / headerTemplate / footerTemplate / compress / debug / encryptPdfLayoutOptions; assertLayoutPdfACompatible), src/table.ts / src/barcode.ts / src/form.ts / src/image.ts (bodies shared by a dedicated tool and its inline block; form.ts maps textareamultilineText; image.ts decodes + checks magic bytes and the PNG IHDR, ImageByteBudget 24 MiB per call — embed_image stays unbounded, blocks / watermarks use the bounded variant), src/inflate-cap.ts (PDFNATIVE_MCP_MAX_INFLATE_BYTES → engine cap; throwIfInflateCapErrorPDF_PARSE_FAILED), src/print.ts (print-production print / outputIntent / metadata / creationDate schema + mappers), src/diagnostics.ts (PDF/A diagnostics sink, strict / includeDiagnostics / embedFonts, mapBuildError), src/encryption.ts (password + encrypt schema, mapDecryptError), src/chart.ts (charts v2 schema + toChartBlock), src/cms.ts (CMS parser), src/pdf-introspection.ts (signature widgets, /DSS, page boxes, annotations), src/pagetree.ts (mapPageTreeError — page-index errors → VALIDATION_ERROR), src/base64.ts (base64 / DER boundary decoding with agent-facing diagnostics — use it for every pdfBase64 / DER input), src/pdfa.ts, src/doc-features.ts, src/watermark.ts (text and/or image + position), src/projection.ts (token-frugal verbosity/fields), src/output.ts (sandboxed file write), src/resources.ts.
  • tests/ — one *.test.ts per tool/module; shared fixtures are _-prefixed (_pdf-assert.ts, _cert-fixtures.ts, _pagetree-fixtures.ts, _encrypted-fixtures.ts, _ltv-fixtures.ts (offline mock PKI + RFC 3161 / OCSP / CRL providers), _tsa-server.ts (loopback TSA), _http-fixture.ts, _mcp-harness.ts). tests/http-modern.test.ts asserts the MCP 2026-07-28 conformance; tests/catalogue-parity.test.ts compares tools/list with the structural fixture tests/_fixtures/tool-shape.json; tests/catalogue-superset.test.ts proves the live catalogue is a superset of the published 1.5.0 one (tests/_fixtures/tool-shape.v1.5.0.json — never regenerate that file). New in 1.6.0: document-blocks, layout-options, inspect-layout, watermark, inflate-cap, error-codes (src ↔ AGENTS §6 inventory).

Read the full file on GitHub · 90 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. 7d ago First seen · 90 lines · 2,722 tokens per session scan A c3b09e302325

Subscribe to this mod's changes

pdfnative-mcp CLAUDE.md is an instructions file published in the GitHub repository Nizoka/pdfnative-mcp (2 stars, last pushed 13d ago), licensed MIT. It adds 2,722 tokens to every session, about $0.0136 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens