r/devtools • • Oct 22 '26

I Built an MCP server for code analysis that returns file:line evidence with every answer, plus an interactive map as a resource

Most MCP server answers are a summary the model has to trust. I wanted the

opposite: every tool result carries the file, the line, the rule that fired

and the reason, so the model can check the claim instead of believing it.

UNDERSTAND exposes 10 tools and 3 resources over one analysis engine:

Tools

- scan_repository - run a scan with a profile and a budget

- get_scan_status / cancel_scan - long scans, polled and cancellable

- get_scan_report - the full report

- inspect_finding - one finding, with its evidence and its rule

- trace_execution - the call path for a function

- trace_data_flow - where a value comes from and where it goes

- analyze_change_impact - what a diff touches

- query_codebase - structured questions over the index

- get_code_map - the graph, in one of 10 views

Resources

- understand://capabilities - what this server can and cannot do

- understand://security-model - the controls, stated as facts

- understand://map-schema - the shape of the map payloads

The two things I would point an MCP client author at:

  1. Evidence is part of the contract. A finding result is not a string, it is a

    structure with location, rule id, confidence and reason. The model can

    quote the file back to the user.

  2. The security model is a resource, not a README. An agent should be able to

    read what the server will and will not do before it calls it - including

    the fact that the server scans whatever repository a caller names, and has

    no authentication of its own.

Also relevant if you are building tooling: SARIF 2.1.0 output for the CI

path, and an interactive code map rendered to a standalone HTML file (73 nodes

/ 673 edges on a real repo, 12.4 ms per frame on an OffscreenCanvas worker)

for the human path.

MIT, Python 3.11+, published to PyPI with signed provenance.

Repo and MCP setup: https://github.com/understand-mcp/Understand

2 Upvotes

1 comment sorted by

1

u/kantorcodes1 Oct 22 '26

On the evidence anchoring: when a repo changes between scans, does a finding's file:line citation stay pinned to the checkout it was derived from, or can it drift as lines shift? If an agent cites scan-123 finding #7 in a review and someone edits the file after, the claim only stays checkable if the evidence binds the exact scan (and ideally the blob) rather than the current path:line. Does the report record that binding?