API & MCP

Everything a person can do on Codeharbor Diff, a program or AI agent can do with the same inputs and get the identical result.

HTTP API

Codeharbor Diff

Paste an original and a changed version of a file to see which lines were added, removed or kept, grouped into hunks with context, as a unified diff like git diff or diff -u — the same comparison Codeharbor uses for snapshots and commits.

Inputs of Codeharbor Diff
FieldTypeDefaultDescription
originaltextarea—Original
changedtextarea—Changed
originalNametext"original"Name of the original (optional)
changedNametext"changed"Name of the changed version (optional)
contextnumber3Context lines around changes
ignoreWhitespacebooleanfalseIgnore differences in spaces and indentation

Example request

Two versions of a deployment file

curl -X POST https://codeharbordiff.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"original":"service: harbour-api\nreplicas: 2\nimage:\n  name: registry.example.org/harbour-api\n  tag: \"1.3.2\"\nresources:\n  memory: 256Mi\n","changed":"service: harbour-api\nreplicas: 3\nimage:\n  name: registry.example.org/harbour-api\n  tag: \"1.4.0\"\nresources:\n  memory: 256Mi\n  cpu: 0.5\n","originalName":"deploy.yaml (v1.3.2)","changedName":"deploy.yaml (v1.4.0)"}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "codeharbor-diff": { "type": "http", "url": "https://codeharbordiff.usefulweb.site/mcp" }
  }
}