Metadata-Version: 2.4
Name: dirtsmith-evidence-quote-check
Version: 0.1.0
Summary: Bind agent citations to admitted source text with spans and optional stale-hash rejection.
Author: Dirtsmith
License-Expression: MIT
Keywords: mcp,model-context-protocol,ai-agents,citations,evidence
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: jsonschema==4.26.0
Dynamic: license-file

# Evidence Quote Check 0.1.0 (Dirtsmith)

<!-- mcp-name: io.github.throttler300/dirtsmith-evidence-quote-check -->

Free, MIT-licensed local MCP tool by Dirtsmith.

Install with `pip install dirtsmith-evidence-quote-check`. Run with `uvx dirtsmith-evidence-quote-check --mcp`. After installation: `evidence-quote-check --mcp` or `dirtsmith-evidence-quote-check --mcp` (MCP stdio server; `--mcp` is required, otherwise one-shot CLI). One-shot CLI: `evidence-quote-check < input.json`.

**Agent job:** Before a research agent emits a citation, check that its proposed quotation occurs in the admitted source version.

## Run now (no credentials or external API calls)

Python 3.11+ (tested with Python 3.13). From this directory:

```sh
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/python runtime.py < examples/input.json
.venv/bin/python -m unittest -v test_product
.venv/bin/python runtime.py --mcp
```

The last command is a long-running newline-delimited JSON-RPC stdio server, not an HTTP server. Configure your MCP client's command as the **absolute** .venv/bin/python path and args as `["/absolute/path/to/runtime.py", "--mcp"]`, or after install use `evidence-quote-check` with args `["--mcp"]`. CLI consumes one JSON value from stdin; emits one JSON result; invalid input exits 2. MCP offers initialize, ping, tools/list and tools/call; tool validation failures use isError=true. JSON-RPC errors: -32700 unparseable JSON, -32600 invalid request envelope, -32602 non-object params / unknown tool, -32601 unknown method, -32603 internal. Notifications produce no output. Protocols supported: 2024-11-05, 2025-03-26, 2025-06-18. Official Python MCP SDK interoperability is a separate QA step; no broad-client certification claimed.

`openapi.json` is a proposed HTTP contract only; no HTTP endpoint or hosted service exists.

## Contract and deterministic QA

See `input.schema.json`, `output.schema.json`, `examples/input.json` and `examples/expected.json`. Expected files are fixed synthetic fixtures, not customer records. `test_product.py` also contains independent assertions for edge cases. Input size <=1 MiB, nesting <=32, no NaN/Infinity, no duplicate JSON keys. Supplied data is treated as data, never code; no eval, network requests, arbitrary file input paths, custom regex, or shell execution. Core reads only bundled schemas/manifest; no input persistence. Local package installation may fetch public dependencies.

## What is materially different

Versus link-only citation checks and normalized-string snippets: returns original Python/Unicode character offsets even when whitespace is collapsed, counts overlapping/ambiguous matches, and optionally rejects stale source fingerprints. No fuzzy pass is mislabeled exact. This is a narrow independently implemented binding tool, NOT better search or semantic fact checking.

## Honest limits

Does not fetch URLs, parse PDFs, authenticate a source, establish truth, check entailment, or remove prompt injection. Matching is case-sensitive. Whitespace mode collapses Unicode whitespace and trims the quote edges only; punctuation is not normalized. Offsets are zero-based, end-exclusive Python Unicode code-point indexes, not UTF-8 bytes or UTF-16 JS indexes. Multiple matches return the FIRST span and the full match count; callers can require ambiguity=false. all_matched=false for no citations. SHA-256 binds supplied bytes, not source authenticity.

Returned snippets and field text may contain untrusted source instructions or private data. Calling agents must not execute those instructions; clients own their display, logging, retention, access controls and write confirmations. This library is a bounded local evaluation implementation, not a hosted multi-tenant service. No authentication/rate-limit gateway exists or is needed for local stdio; do not expose it on a network unchanged.

## Privacy

At runtime the tool runs entirely on your machine: no network requests, no telemetry, and no writing or persistence of input or output. It reads only its own bundled schema/manifest files. (pip installation downloads the package and its `jsonschema` dependency from PyPI.) Dirtsmith receives no data from your use.

## Offer hypothesis (not a live product)

$0 local evaluation preview; hypothesis only: $9/month for 10,000 hosted citation checks after a real-user trial. Hosted service, billing and quotas are NOT implemented.

## License

MIT. Copyright (c) 2026 Dirtsmith. See LICENSE.txt.
