Skip to main content
Glama
echo-check-mcp

echo-check-mcp

echo-check-mcp

CI Course

Find duplicate records in fixed-width files, such as NACHA (ACH) payment files. The file layout and the duplicate rules live in a YAML config, not in code. It runs as a command (dupcheck) and as an MCP server, so Claude can check files for you. An optional summary from Claude explains what it found.

This is the running example for the course Build a Config-Driven MCP Server. All data in this project is synthetic.

Quick start (2 minutes)

You need uv. Then:

git clone https://github.com/zeusydev-lang/echo-check-mcp
cd echo-check-mcp
uv sync
uv run dupcheck data/sample.ach --config configs/nacha.yaml --out data/results.json

You'll see something like this:

Checked 36 records out of 50 lines in data\sample.ach (config nacha_entry), 0 bad line(s).
  exact_line: 1 group(s), 2 lines
  trace_number: 2 group(s), 4 lines
  same_payment: 10 group(s), 20 lines
  near_amount: 1 group(s), 2 lines

data/results.json has every duplicate group with line numbers and masked values, plus a per-batch breakdown. Make more test files with the generator:

uv run python generator/generate_nacha.py --out data/big --seed 7 --batches 10 --entries 500

Related MCP server: Remote Link Local MCP

The config

One YAML file describes a file format. configs/nacha.yaml is the full example:

name: nacha_entry
record_length: 94                              # every line must be this long
filter: {field: record_type, equals: "6"}      # only check entry records
batch: {header_starts_with: "5", id_start: 88, id_length: 7}   # optional

fields:                                        # positions are 1-based
  - {name: record_type,   start: 1,  length: 1}
  - {name: account,       start: 13, length: 17, normalize: strip, sensitive: true}
  - {name: amount,        start: 30, length: 10, normalize: int}
  - {name: individual_id, start: 40, length: 15, normalize: strip, sensitive: true}
  # ...

duplicate_rules:
  - {name: exact_line,   keys: [_line]}                    # the whole line
  - {name: same_payment, keys: [account, amount, individual_id]}
  - {name: near_amount,  keys: [account, individual_id],
     tolerance: {field: amount, max_diff: 500}}            # 0 < diff <= 500

Setting

Meaning

normalize

none (default), strip (trim spaces) or int (a whole number).

sensitive

Masked in every result, for example ****1409.

keys

Records with equal values for all keys are duplicates. _line is the whole raw line.

tolerance

Group by keys, then match amounts that differ by more than 0 and at most max_diff.

filter

Skip lines that don't match, such as headers.

batch

Where batch headers are, so results can say which batches are involved.

Mistakes are reported all at once, in plain sentences, for example fields 'account' (13-29) and 'amount' (29-38) overlap. The details are in Module 2.

Privacy

  • Local first. Files are read on your machine. The MCP server talks over stdio and doesn't listen on the network.

  • Masked by default. Sensitive fields are masked in every result. The MCP tools have no way to turn masking off. The dupcheck command has --unmasked for your own local investigation.

  • The LLM sees counts, not data. The summary gets counts, the per-batch breakdown and a few masked sample groups. A test checks that no account number, employee ID or name from the sample file reaches the request.

  • Closed by default. The MCP server only reads files under the folders in ECHO_CHECK_ALLOWED_DIRS. If the variable isn't set, every file is refused.

MCP setup

Tools: list_configs, describe_layout, check_duplicates and check_and_summarize.

Claude Desktop. Open Settings → Developer → Edit Config and add:

{
  "mcpServers": {
    "echo-check": {
      "command": "uv",
      "args": ["--directory", "C:\\path\\to\\echo-check-mcp", "run", "echo-check-mcp"],
      "env": {
        "ECHO_CHECK_ALLOWED_DIRS": "C:\\path\\to\\echo-check-mcp\\data",
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Fully quit and restart Claude Desktop, then ask "Check data\sample.ach for duplicates with the nacha config." The API key is only needed for check_and_summarize. In JSON, every \ in a Windows path must be doubled.

MCP Inspector (for testing; needs Node.js):

npx @modelcontextprotocol/inspector -e ECHO_CHECK_ALLOWED_DIRS=C:\path\to\echo-check-mcp\data uv --directory C:\path\to\echo-check-mcp run echo-check-mcp

More detail is in Module 4.

Summary from Claude

# .env (Git ignores it): ANTHROPIC_API_KEY=sk-ant-...
uv run --env-file .env dupcheck data/sample.ach --config configs/nacha.yaml --summary

Claude returns headline, likely_cause, affected_batches and suggested_action, for example "Batch 4 looks like a resend of batch 3: 8 of the 10 same-payment duplicate groups link batch 3 and batch 4." The model is ECHO_CHECK_MODEL (default claude-opus-5-5). Batches the data doesn't contain are removed from the answer.

Evals

uv run python evals/run_evals.py                             # detection, no API key
uv run --env-file .env python evals/run_evals.py --judge     # + summary checks (API calls)

It generates seeded files and scores each rule's precision and recall against the answer keys. It also checks that every number in a summary comes from the data. The exit code is 1 if an exact rule drops below 100%. CI runs the detection evals on every push.

Development

uv run pytest                          # all tests, no API calls
uvx ruff check src tests evals         # lint
uv run --group docs mkdocs serve       # course site at http://127.0.0.1:8000

Quit Claude Desktop and the MCP Inspector before uv add or uv sync on Windows. A running server locks echo-check-mcp.exe.

License

MIT. See LICENSE.

Available Tools

4 tools
check_and_summarizeA

Run a fresh duplicate check on a file and return a short written summary.

Use this when the user wants an overview (what happened, likely cause, next step) rather than line-level detail. It does NOT read earlier results; it re-checks the file itself, so there is no need to call check_duplicates first. Use check_duplicates when you need specific lines or groups. Claude sees only counts, the batch breakdown and masked samples. Needs ANTHROPIC_API_KEY; makes one paid LLM call.

Inputs: file_path (required), config_name (required). Returns: The summary plus anything our own checks noticed.

check_duplicatesA

Find duplicate records in a fixed-width file and return structured results.

Use this when you need the actual duplicate groups: line numbers, masked keys, counts per rule. Use check_and_summarize instead when the user wants a plain-English overview. Do not call both for the same question. Read-only; sensitive values are masked. Up to max_groups groups per rule; truncated is true when more exist.

Inputs: file_path (required), config_name (required), max_groups. Returns: A check result small enough to hand to an assistant.

describe_layoutB

Show a config's record layout, filter and duplicate rules.

Positions are 1-based. Fields marked sensitive are masked in results.

Inputs: config_name (required). Returns: A whole config: the record layout plus the duplicate rules.

list_configsA

List the layout configs this server can check files with.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation4/5

    check_duplicates and check_and_summarize overlap in underlying function, but their descriptions explicitly delineate output shape (structured groups vs. prose overview) and instruct against calling both. describe_layout and list_configs are clearly distinct (metadata vs. discovery). Minor residual risk that an agent picks the wrong one for an ambiguous 'check this file' request.

    Naming Consistency5/5

    All four names follow a clean verb_noun snake_case convention: check_duplicates, check_and_summarize, describe_layout, list_configs. The verb choice (check/describe/list) maps intuitively to action type.

    Tool Count4/5

    Four tools is a tight, well-scoped surface for a focused duplicate-checking server; each has a clear role. The pair check_duplicates/check_and_summarize is the only arguable redundancy, keeping it just short of ideal.

    Completeness4/5

    Discovery (list_configs), introspection (describe_layout), detailed results (check_duplicates), and narrative output (check_and_summarize) cover the core lifecycle. Gaps are minor: no way to validate a config, request unmasked or full record payloads, or control output beyond max_groups.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers