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
POST https://codeharbormarkdownpreview.usefulweb.app/api/v1/calculate– run Codeharbor Markdown PreviewGET https://codeharbormarkdownpreview.usefulweb.app/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
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.
| Field | Type | Default | Description |
|---|---|---|---|
markdown | textarea | — | Markdown |
Example request
A small README
curl -X POST https://codeharbormarkdownpreview.usefulweb.app/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)
- Streamable HTTP endpoint:
https://codeharbormarkdownpreview.usefulweb.app/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
codeharbor_markdown_preview - Local stdio connector:
node src/mcp-stdio.ts --tool=codeharbor-markdown-preview
{
"mcpServers": {
"codeharbor-markdown-preview": { "type": "http", "url": "https://codeharbormarkdownpreview.usefulweb.app/mcp" }
}
}