# ArchLang, hosted

ArchLang is a small language for floor plans: write `.arch` text, compile it to an SVG drawing, and check it with the same tools a person would use.

ArchLang compiles `.arch` text to SVG floor plans. Before writing any `.arch`, read the `archlang://spec` resource: the whole language (from a shell: `npx -y @chanmeng666/archlang spec`).
The loop:
1. Write the plan as `.arch` source.
2. `compile` it. Errors are diagnostics, usually with a byte span, often a fix; `fix` applies the machine-applicable ones, edit the rest by hand.
3. `describe` it; check rooms, areas and doors against the brief.
4. `validate` with strict:true (parse, resolve, `lint`); fix every warning, then back to 2.
5. `finish` once lint is clean, before export: it furnishes empty rectangular rooms (single-storey plans) and adds the missing sheet statements (paper, scale, dimensions, title, room schedule, legend).
With a shell, the CLI runs the same loop at no context cost: `archlang <cmd>`, or `npx -y @chanmeng666/archlang <cmd>` without a global install.

## This server

- The same tools as the npm server (`npx -y @chanmeng666/archlang-mcp`), over Streamable HTTP at https://mcp.archlang.uk/mcp. No sign-in, no sessions: every request stands alone.
- Any tool argument (a source, `plan_json`, an intent) larger than 64 KB is refused with `E_INPUT_TOO_LARGE` before anything is compiled, and an address that sends more than 600 requests to /mcp (or 3000 new images) in 60 s gets `E_RATE_LIMITED`. The CLI and the npm server have neither limit.
- `compile` with format "png" is not available here; format "svg" is.
- An image URL for a plan: call `link`, take the text after `#z=` in its `embed` URL, and GET https://mcp.archlang.uk/svg/<that text>. It answers `image/svg+xml`, the same bytes `compile` returns, fresh for five minutes: when the compiler changes, the drawing at that URL follows it. Its `Content-Location` names the pinned copy, `/v/<render version>/svg/<payload>`, which keeps the same bytes and may be cached until the next release of this server; after that it redirects to the unpinned URL. Unlike a playground link, whose plan stays in the `#` fragment and never reaches a server, an /svg/ URL sends the plan to this server in its path.
- Hosts that support MCP Apps show `compile` results in a viewer (pan and zoom, plus the lint findings); every other host gets the same result as text.
- The server keeps no source and no request body, and logs neither. It stores only the rendered SVG of each /svg/ URL, in Cloudflare's edge cache. Each MCP call is counted by its method and tool name, from fixed lists; nothing else is recorded.