Metadata-Version: 2.4
Name: ai-tool-call-integrity-cost-receipt-mcp
Version: 0.2.0
Summary: Licensed local MCP server that verifies supplied AI tool-call chains and produces deterministic cost and integrity receipts.
Author: PracticalBizToolsUS
License-Expression: LicenseRef-Proprietary
Project-URL: Documentation, https://github.com/wunan8850-hash/ai-tool-call-integrity-cost-receipt-mcp
Project-URL: Source, https://github.com/wunan8850-hash/ai-tool-call-integrity-cost-receipt-mcp
Requires-Python: <3.15,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: mcp==2.2.0
Requires-Dist: mcp-marketplace-license==1.1.0
Provides-Extra: dev
Requires-Dist: pytest<10,>=8.4; extra == "dev"
Dynamic: license-file

# AI Tool Call Integrity & Cost Receipt MCP

A paid, local MCP server for reviewing buyer-supplied AI tool-call evidence before incident closure or release review.

It joins tool calls to outputs by exact call ID, validates declared tool names and argument fields, flags missing or duplicate evidence, totals supplied usage costs against an explicit policy, and writes a deterministic evidence packet.

## What it creates

- `result.json` — authoritative status and totals
- `call-matrix.csv` — one row per call and its matched output
- `duplicate-call-groups.csv` — repeated call fingerprints
- `cost-summary.csv` — supplied cost totals by tool
- `issues.jsonl` — machine-readable findings
- `TOOL_CALL_INTEGRITY.md` — reviewer-facing report
- `evidence-receipt.json` — SHA-256 receipt for inputs and outputs

## Requirements

- Windows
- Python 3.11–3.14
- An MCP-compatible client
- The `MCP_LICENSE_KEY` issued with your MCP Marketplace purchase
- Internet access for license verification; a successful result is cached locally by the marketplace SDK

License verification sends only the license key and the public product slug to MCP Marketplace. Calls, outputs, catalog contents, paths, costs, and generated reports remain local.

## Install from a purchased source checkout

```powershell
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install .
```

## MCP client configuration

```json
{
  "mcpServers": {
    "tool-call-integrity": {
      "command": "tool-call-integrity-mcp",
      "env": {
        "MCP_LICENSE_KEY": "PASTE_THE_KEY_FROM_YOUR_PURCHASE"
      }
    }
  }
}
```

Start the MCP client with its working directory set to the folder containing the authorized evidence files. Every input and output path supplied to the tool must be relative to that folder.

## Tool

`build_tool_call_integrity_packet`

Inputs:

- `calls`: relative path to tool-call JSONL
- `outputs`: relative path to tool-output JSONL
- `catalog`: relative path to tool catalog and cost policy JSON
- `output_directory`: relative path for a new output directory

The tool returns one structured JSON object. `READY`, `REVIEW`, and `BLOCK` are valid evidence outcomes. `ERROR` means the request could not be processed.

## CLI

The diagnostic command does not require a license check:

```powershell
tool-call-integrity --json doctor
```

Protected commands verify the marketplace license before reading buyer files:

```powershell
tool-call-integrity --json analyze --calls examples/sample-input/calls.jsonl --outputs examples/sample-input/outputs.jsonl --catalog examples/sample-input/catalog.json --out packet
tool-call-integrity --json show packet/result.json
tool-call-integrity --json verify packet/evidence-receipt.json
```

## Product boundary

This server does not execute tools or models, collect traces, grade output semantics, recount tokens, verify vendor invoices, retry calls, roll back actions, or claim that logged actions occurred. It accepts only bounded regular files below the working directory and never overwrites an existing output directory.

Apart from MCP Marketplace license verification, it performs no network activity. It has no telemetry and does not upload buyer evidence.
