Skip to main content

claimcite

wasabihu/claimcite MCP server Install in VS Code

English · 中文 · AI Install (llms-install.md) · Security · Interactive Docs · Engineering Notes

Check that every citation in a document is real, points to the paper the text says it does, and actually contains the words quoted from it.

AI-written articles, health advice and even papers increasingly cite sources that don't exist, or attach a real DOI to the wrong paper. Readers can't check dozens of references by hand. claimcite does it in one command.

$ claimcite check examples/sample.md
# Citation check

1 ok · 2 warnings · 2 errors · 0 not checked

- **Error** · line 7 · `doi:10.1016/s0140-6736(10)61388-8`
  - Title does not match this identifier. Registry title: Worldwide burden of disease from
    exposure to second-hand smoke: a retrospective analysis of data from 192 countries.
  - Year differs: document 2021, registry 2011
- **Error** · line 9 · `doi:10.1001/jama.2022.99999`
  - Identifier does not exist
- **Warning** · line 11 · `pmid:33237064`
  - Study type (as tagged by PubMed): Systematic review / meta-analysis
  - Quoted text not found in the abstract (it may be in the full text): “calcium and vitamin D
    supplementation cured osteoporosis in all women”
...

What it checks today

Check How
The DOI / PMID / arXiv ID exists doi.org handle API, PubMed, arXiv Atom API (including 10.48550/arXiv.*)
The paper has not been retracted PubMed Retracted Publication / RetractionIn, Crossref updated-by & relation.is-retracted-by, OpenAlex is_retracted
The title & year match PubMed, Crossref, OpenAlex, or arXiv; fuzzy title match (ignoring publisher RETRACTED: prefix) and ±1 year tolerance
The author matches the identifier PubMed, Crossref, arXiv (and OpenAlex when authorships are present); accent/compound/hyphen-aware surname check (flags swapped authors as warning, never false-alarms on missing metadata)
LaTeX & BibTeX (.tex, .bib) citations match Linear-time O(n) BibTeX parser + safe relative \bibliography/\addbibresource & inline thebibliography linking (dangling \cite & uncited entries, honoring \nocite{*}; ignores \input/\include)
Text in quotes ("…", “…”, 「…」) appears in the abstract PubMed / Crossref / OpenAlex (abstract_inverted_index) / arXiv abstract, falling back to open-access full text (PubMed Central, Europe PMC) when needed
Study type: meta-analysis, RCT, observational, animal… PubMed publication types and MeSH
A web link is alive and contains the quoted text fetch the page (respecting robots.txt), strip HTML, normalise whitespace
A reference with no DOI or PMID exists search the title in Crossref, then PubMed; then check it like any other paper
Numbered and footnote citations match the reference list report body markers like [5] or [^1] with no entry (with line numbers) and numbered/footnote entries never cited in the text
Local XERJ evidence spans (xerj://) exist and match verbatim quotes batch read-only POST /_mget (fallback GET /{index}/_doc/{doc_id}), exact UTF-8 byte (#b=/#offset=) or char (#c=) span verification, zero SQLite cache writes
Offline MANIFEST.tsv corpus spans (corpus://) pass SHA-256 & quote checks VeriCorpus-compatible streaming 64 KiB SHA-256 verification + #b=/#c=/#L spans + optional &sha256= pins, O_NOFOLLOW confined, zero SQLite cache writes
Tamper-evident audit bundles (--bundle / verify-bundle) & opt-in plugins canonical JSON SHA-256 proof bundles (claimcite.bundle/v1) aligned with VeriCompile evidence spans; fail-closed allowlisted claimcite.verifiers plugin protocol

It reads Markdown or plain text (unwrapping soft-wrapped lines and indented reference items) and understands the common Author (Year). Title. Journal: "quote". https://doi.org/… pattern, quotes written in the same sentence after an identifier, plus doi:…, bare DOIs, PMID: …, arXiv:… and PubMed/arXiv links. Numbered and author-year citations work too: a quote in the text followed by [1], [^1], [1, 2], [1-3] or an unambiguous (Author, Year) / Author (Year) citation is checked against the matching entry in the reference list, and dangling markers or uncited numbered/footnote entries are flagged as errors.

Most invented citations have no DOI: Chen, L. (2021). A plausible title. Journal of Something, 14(2), 88–97. Entries like that under a reference-list heading (## References, 参考文献, Sources …), and [1] … or [^1]: … entries anywhere, are searched by title in Crossref and then PubMed. APA, Harvard, MLA, Vancouver and GB/T 7714 styles are understood. A paper that is found is checked like one with a DOI. One that neither registry has is a warning, not an error: it may not exist, or the title may be worded differently. Books (most are in neither registry) and Chinese-language references are left not checked. Searches run one a second (Crossref's limit), so 30 such references take about half a minute the first time. --no-search turns this off. Code blocks and inline code are skipped. A quote in Chinese is only compared with Chinese text: next to an English abstract or page it is noted as not comparable word for word, not reported as missing. Other web links are fetched (respecting robots.txt) and checked for availability and for the quoted text. A dead link or a missing quote is a warning, never an error — pages change and some sites block bots. When a page cannot be read the link stays not checked.

What it does not do (yet): check paraphrases. Only text in quotation marks is compared with the source, word for word; a sentence that restates a source without quotes is not extracted or checked. It also cannot decide whether a source supports a claim. That needs a language model and a labelled test set. See the roadmap. claimcite only confirms that sources exist and match what the text says about them. It is not medical advice.

Install and run

Requires Python 3.10+. No API keys needed.

pipx install claimcite                   # or: uv tool install claimcite
claimcite check article.md               # Markdown report (also supports .bib and .tex)
claimcite check article.md --lang zh     # 中文报告
claimcite check article.md --format json # JSON for scripts and CI
claimcite check --diff origin/main       # Incremental PR check: changed lines & cited refs only
claimcite check paper.tex --format sarif # SARIF 2.1.0 for GitHub Code Scanning
claimcite check draft.md --format agent  # Compact token-efficient fixes for AI agents
claimcite check memo.md --corpus-root ./corpora --bundle audit.bundle.json
claimcite verify-bundle audit.bundle.json --check-docs
cat article.md | claimcite check -

The exit code is 1 when any citation has an error, so it works as a CI gate (--fail-on warning|never to tune). Set NCBI_API_KEY to raise PubMed's rate limit. OpenAlex works out of the box with no API key (OPENALEX_API_KEY and OPENALEX_MAILTO are optional).

Lookup cache

Successful registry responses are cached on disk for 30 days (default ~/.cache/claimcite/v1/, or $XDG_CACHE_HOME/claimcite/v1/), so re-running after a one-line edit does not repeat every request. Lookup failures are never cached. Use --no-cache to bypass the cache for one run.

Web pages are fetched at most once a second per site, so the first run over a document with hundreds of links takes minutes. Use --no-web to check only DOIs and PMIDs. Quotes in PDFs are not checked yet.

Local XERJ span verification (xerj://)

claimcite verifies host-free local knowledge-base evidence handles emitted by kbwall against a local XERJ node (still zero runtime dependencies, Python 3.10+ stdlib only):

  • Shared URI contract (strictly no host:port inside documents):
    • xerj://<index>/<doc_id>#b=<byte_start>[-<byte_end>][&f=<field>]
    • xerj://<index>/<doc_id>#c=<char_start>[-<char_end>][&f=<field>]
    • xerj://<index>/<doc_id>#offset=<byte_start>[&f=<field>] (alias for #b=<byte_start>)
    • When f= is omitted, _source text fields are probed deterministically in order: text -> body -> content -> code.
# Point to your local loopback XERJ node (never auto-probed when unset)
claimcite check notes.md --xerj-url http://127.0.0.1:9200
XERJ_URL=http://127.0.0.1:9200 claimcite check notes.md --format json
  • CLI flags & precedence: --xerj-url > XERJ_URL; credentials follow --xerj-api-key > XERJ_AUTH (preserves ApiKey/Bearer) > XERJ_API_KEY (auto-prefixed ApiKey ) > <xerj_data_dir>/admin.key (--xerj-data-dir / XERJ_DATA_DIR). Optional guards: --xerj-allow-remote (forces https:// unless --xerj-allow-insecure-http is also passed) and --xerj-strict-whitespace.
  • Hard security & privacy boundaries: loopback-only by default (127.0.0.1, ::1, localhost), explicit proxy bypass (ProxyHandler({})), all 3xx redirects blocked, 10 MiB hard response cap, read-only batch POST /_mget (fallback GET /{index}/_doc/{doc_id}), and never writes local XERJ documents into the 30-day SQLite registry cache.
  • MCP isolation: when running claimcite mcp, XERJ settings are read strictly from process environment variables (XERJ_URL, XERJ_AUTH, XERJ_API_KEY, XERJ_DATA_DIR) and are never exposed as MCP tool arguments.

In CI: GitHub Action

# .github/workflows/citations.yml
on: [push, pull_request]
jobs:
  claimcite:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: wasabihu/claimcite@v0.9.0
        with:
          files: "docs/**/*.md"  # default: every Markdown file
          fail-on: error         # or: warning, never
          web: "true"            # "false" checks DOIs and PMIDs only
          search: "true"         # "false" skips title search for references without a DOI

The report also appears in the job summary. Runs on Linux and macOS runners.

Before each commit: pre-commit

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/wasabihu/claimcite
    rev: v0.9.0
    hooks:
      - id: claimcite
        # args: [--no-web]   # faster: skip ordinary web links

Every changed Markdown file is checked; the commit stops when a citation has an error. You can also pass several files on the command line: claimcite check docs/*.md, or a whole folder: claimcite check docs/.

MCP server & Agent Skill

claimcite ships with a zero-dependency stdio Model Context Protocol server (claimcite mcp) exposing check_citations and check_files:

{
  "mcpServers": {
    "claimcite": {
      "command": "uvx",
      "args": ["claimcite", "mcp"]
    }
  }
}

A ready-to-use Agent Skill guide lives in skills/claimcite/SKILL.md, and an automatic PostToolUse hook template for Claude Code / Cursor / Codex lives in examples/hooks/. To confine check_files to specific workspace directories, set CLAIMCITE_ALLOWED_ROOT (one or more directories separated by os.pathsep) in the MCP server's process environment; see SECURITY.md for the full threat model and security guarantees.

Offline benchmark

Run the 30-case fixture-backed benchmark locally (zero network calls):

uv run python benchmarks/run.py

See benchmarks/README.md for what each category covers.

Roadmap

Each item is a self-contained piece of work. Pick one and open an issue to say you're on it.

  • Web links: check that the page is alive and contains the quoted text
  • References without identifiers: find them by title (Crossref, PubMed)
  • Retractions: flag retracted papers via Crossref (updated-by / relation) and PubMed (Retracted Publication)
  • More registries: Semantic Scholar, CNKI/Wanfang metadata (OpenAlex, arXiv, and DataCite 10.48550/arXiv.* are supported)
  • Full text: look for quotes in open-access full text (PubMed Central, Europe PMC), not only abstracts
  • Support check: does the source support the sentence? Pluggable LLM judge, local models first
  • Benchmark: offline 30-case fixture benchmark in benchmarks/ (more public corpora welcome)
  • Numbered & LaTeX citations: [1], [1-3], [^1], and \cite{key} linked to reference lists or .bib files (including missing-entry & uncited-entry detection)
  • Author cross-checking & BibTeX/LaTeX: .bib/.tex native support, conservative surname cross-checking, --diff incremental git scoping, SARIF 2.1.0, GitHub PR annotations, compact --format agent output, and PostToolUse hook template
  • More input formats: Word / PDF input
  • Integrations: GitHub Action, pre-commit hook, stdio MCP server (claimcite mcp), Agent Skill
  • Browser extension
  • Caching between runs (30-day on-disk cache, --no-cache to bypass)
  • Faster batch lookups

Verified XERJ Open Ecosystem

Stage Project Role
1. Capture wasabihu/sessfork Silent background Chromium auth fork (sessfork-mcp / sessfork-browser) and secret-redacting authenticated web ingestion into local XERJ.
2. Search Engine & Open Models xerj-org/xerj
wasabihu/xerj-bilingual-fin-law-384 (MIT)
wasabihu/VeriCorpus-Reranker-0.6B (Apache-2.0)
Single-binary Rust ES-compatible search engine paired with compact bilingual CJK/EN financial & legal embedding and cross-encoder reranker models.
3. Read-Only Agent Firewall wasabihu/kbwall ~1 MB air-gapped, loopback-only read-only Rust MCP firewall for XERJ that emits canonical xerj:// byte-span evidence handles.
4. Citation & Corpus Verification wasabihu/claimcite
wasabihu/vericorpus
Zero-dependency citation & xerj:// UTF-8 span verifier paired with audit-grade statutory, financial, and clinical retrieval corpora.

Looking to build a minimal, audited AI agent runtime in Python? Check out our sister project: cairnkit (includes a citation-verifying tool example wired cleanly with claimcite).

Contributing

Contributions of every size are welcome, including AI-assisted ones. See CONTRIBUTING.md.

License

MIT

Metadata

Release files for claimcite 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claimcite 0.9.0
File Size Uploaded Provenance Actions
claimcite-0.9.0.tar.gz 367.4 kB With provenance Details for claimcite-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for claimcite 0.9.0
File Interpreter ABI Platform Actions
claimcite-0.9.0-py3-none-any.whl Python 3 none any Details for claimcite-0.9.0-py3-none-any.whl

Total release size: 464.1 kB

Release files / claimcite-0.9.0.tar.gz

Download URL claimcite-0.9.0.tar.gz
Size 367.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b280b0ccafa5129741924a9e40a5e6c7d67db2afbd417f13eef4aec7ae90766c
BLAKE2b-256 checksum
How to use checksums
7526ac2c571d9a195a2e59d63f7cfe0f9b49b88443dd40c28550689a72521f48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / claimcite-0.9.0-py3-none-any.whl

Download URL claimcite-0.9.0-py3-none-any.whl
Size 96.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84387d2aaae0fbf2f894d2e5075b056aab8b3ce7f806b9ef27c1f5c885c3dacc
BLAKE2b-256 checksum
How to use checksums
824a4929664a76ad7763f8a661b4ad892aa527a2a04c45226ed3f6bc91a31260
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for claimcite 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for claimcite-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page