API & MCP

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

HTTP API

Codeharbor Format & Check

Paste code to re-indent JSON, CSS or HTML and to list syntax problems with line and column: JSON is parsed strictly, YAML with a documented subset parser, JavaScript and TypeScript with Codeharbor’s own tokenizer. Nothing is run.

Inputs of Codeharbor Format & Check
FieldTypeDefaultDescription
codetextarea—Code. Paste the file content.
languageselect (auto, json, css, html, yaml, javascript, typescript, markdown)"auto"Language
fileNametext—File name (optional). Used to pick the language when it is set to detect, e.g. config.yaml.
indentselect (2, 4)"2"Indentation

Example request

Pretty-print minified JSON

curl -X POST https://codeharborformat.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"code":"{\"name\":\"harbour-api\",\"version\":\"1.4.0\",\"port\":8080,\"features\":{\"tides\":true,\"weather\":false},\"allowedOrigins\":[\"https://example.org\"]}","language":"json"}'

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-format": { "type": "http", "url": "https://codeharborformat.usefulweb.site/mcp" }
  }
}