API & MCP

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

HTTP API

Codeharbor Markdown Preview

Turns Markdown (headings, lists, task lists, tables, quotes, code blocks with highlighting, links) into sanitised HTML — raw HTML stays text — and lists the outline, word count, reading time, links and structure problems such as skipped heading levels.

Inputs of Codeharbor Markdown Preview
FieldTypeDefaultDescription
markdowntextarea—Markdown

Example request

A small README

curl -X POST https://codeharbormarkdownpreview.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"markdown":"# Lighthouse Kit\n\nA **small** tool with *docs*.\n\n## Install\n\n1. Download\n2. Unpack\n3. Run `lighthouse --version`\n\n- [x] Create a project\n- [ ] Add a beacon\n\n| Key | Default |\n|---|---:|\n| port | 8080 |\n\n```js\nconst port = 8080;\n```\n\nSee [the example](#example) and <https://example.org>.\n"}'

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