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
POST https://codeharbordiff.usefulweb.site/api/v1/calculate– run Codeharbor DiffGET https://codeharbordiff.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
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.
| Field | Type | Default | Description |
|---|---|---|---|
original | textarea | — | Original |
changed | textarea | — | Changed |
originalName | text | "original" | Name of the original (optional) |
changedName | text | "changed" | Name of the changed version (optional) |
context | number | 3 | Context lines around changes |
ignoreWhitespace | boolean | false | Ignore 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)
- Streamable HTTP endpoint:
https://codeharbordiff.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
codeharbor_diff - Local stdio connector:
node src/mcp-stdio.ts --tool=codeharbor-diff
{
"mcpServers": {
"codeharbor-diff": { "type": "http", "url": "https://codeharbordiff.usefulweb.site/mcp" }
}
}