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
POST https://codeharborformat.usefulweb.site/api/v1/calculate– run Codeharbor Format & CheckGET https://codeharborformat.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
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.
| Field | Type | Default | Description |
|---|---|---|---|
code | textarea | — | Code. Paste the file content. |
language | select (auto, json, css, html, yaml, javascript, typescript, markdown) | "auto" | Language |
fileName | text | — | File name (optional). Used to pick the language when it is set to detect, e.g. config.yaml. |
indent | select (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)
- Streamable HTTP endpoint:
https://codeharborformat.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
codeharbor_format - Local stdio connector:
node src/mcp-stdio.ts --tool=codeharbor-format
{
"mcpServers": {
"codeharbor-format": { "type": "http", "url": "https://codeharborformat.usefulweb.site/mcp" }
}
}