Archlang Mcp

io.github.ChanMeng666由 GitHub 账号 ChanMeng666 发布v0.2.40更新于 Nov 7, 2026

ArchLang: compile, describe, lint, validate, score, repair, fix, finish, suggest, complete, link.

已验证STDIO仅桌面开发者工具媒体与设计

概览

AI 生成的概览

让助手编写 ArchLang 户型图源码,并编译为 SVG、PNG、ASCII 或 JSON,同时检查、评分、修复并补全图纸。

可以做什么
  • 把户型源码或 Plan JSON 编译为 SVG、PNG、ASCII 或 Plan JSON,并返回诊断与各楼层页面
  • 以语义事实描述房间、面积、相邻关系、门、动线与楼层
  • 对图纸做 lint 与 validate,支持严格模式、室内门邻接图校验与任务书意图门槛
  • 按任务书给图纸打分,修复家具与墙体冲突,或应用可自动修复的诊断
  • 补全图纸:为房间布置家具,并补上图纸、比例、尺寸、标题、明细表与图例
  • 给出门窗建议语句、按字节偏移提供补全项,并生成 playground 与嵌入链接
适用场景
当希望由支持 MCP 的宿主在无命令行环境下起草、检查并完善以 ArchLang 代码编写的建筑户型图时使用。已有 shell 的智能体更适合改用 archlang 命令行,它在未被调用前不占用上下文。
运行要求
通过 npx 从 npm 包 @chanmeng666/archlang-mcp 以 stdio 在本地运行,需要 Node.js 以及下载该包的网络访问。未声明账号、API 密钥或环境变量。PNG 输出依赖可选的 @resvg/resvg-js,.mcpb 打包版本不包含它。
安装前请注意
工具本身不写文件,但 repair、fix 和 finish 会返回改写后的源码,需要自行保存;返回的哈希用于命令行工具的源码过期检查。门窗建议只是参考数据,不会被自动应用。accessible 选项只添加标题与描述,并不提供完整的键盘与读屏元素控制。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Archlang Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@chanmeng666/archlang-mcp

A Model Context Protocol server for ArchLang — author, inspect, and repair architectural floor plans written as code, from any MCP-speaking host.

It is a thin stdio shim over the @chanmeng666/archlang library (no subprocess, no re-implementation): each tool wraps one pure, exported function. The core stays zero-dependency — the MCP SDK lives only in this package.

Try it

Floor plans as code. Your AI writes ArchLang; the compiler draws a precise, dimensioned plan and tells it what's wrong.

  • ChatGPT, no install: ArchLang app in ChatGPT, then ask, for example: "Draw a two-bedroom flat of about 75 m² as an ArchLang plan, and check it."
  • claude.ai, no install: add https://mcp.archlang.uk/mcp as a custom connector (the steps)
  • Coding agent: claude mcp add --transport http archlang https://mcp.archlang.uk/mcp; locally, claude mcp add archlang -- npx -y @chanmeng666/archlang-mcp; skills, npx -y skills add ChanMeng666/archlang --yes (skills.sh)
  • VS Code: Marketplace or Open VSX
  • Playground, in the browser: https://playground.archlang.uk

Same source, plan and 3D preview. The 3D preview is extruded from the same .arch file by the separate archlang-3d package, and checked against the plan: every 3D element comes from the plan's elements, and every solid is closed. What the 3D preview shows →

3D preview: walls, openings, floors, stairs and furniture in flat colours; no pitched roofs yet, and no sections, elevations or BIM.

If your agent has a shell

ArchLang's primary agent interface is the agent-native archlang CLI, not this server. A CLI costs nothing in an agent's context window until it is called, whereas an MCP tool schema sits in the window permanently. If your agent already has a shell, prefer:

bash
npx -y @chanmeng666/archlang context     # the whole language + workflow + CLI + errors, one callnpx -y @chanmeng666/archlang compile plan.arch -o out.svg --json

After npm i -g @chanmeng666/archlang the same calls are archlang context and archlang compile …. The package also installs an arch alias, but on Linux, macOS and Git Bash coreutils ships its own arch, so a bare arch there runs the wrong program.

This MCP server exists so MCP-native hosts can discover ArchLang through the registry and drive it without a shell. It is listed on the official MCP registry as io.github.ChanMeng666/archlang-mcp. It is the discoverability channel, not a replacement. See ADR 0012 (which amends ADR 0009's distribution-over-protocol stance).

Server instructions

At initialize the server sends a short instructions string, which hosts that support it add to the model's context: read the archlang://spec resource first, then write .arch → compile (and fix) → describe → validate with strict:true → finish before export. It is SKILL.md's loop, condensed, and a test holds the commands it names to the CLI manifest and to that loop's order.

Tools

Every tool takes ArchLang source (a plan "…" { … } string) and returns structured JSON. compile also accepts plan_json (the Plan-JSON / RPLAN shape). Every result of a call that passed source ends with source_hash, the SHA-256 (hex) of that input's UTF-8 bytes; repair, fix and finish, which return a rewritten source, add output_hash, the SHA-256 of exactly that returned text. The tools write no files. The hashes are for the CLI's --expected-hash, which refuses to rewrite a file whose bytes no longer hash to the value given (E_STALE_SOURCE): write the returned source to the file, then pass its output_hash. For a file that is valid UTF-8 and holds the text unchanged (a BOM and CRLF line ends included) the MCP hash and the CLI's agree.

ToolWhat it does
compileRender source (or plan_json) to SVG, or to zero-dep ASCII (format:"txt"), Plan JSON as an object (format:"json", the shape plan_json takes) or a PNG image (format:"png", at archlang preview's width unless width overrides it, within a clamped range; needs the optional @resvg/resvg-js, which the .mcpb bundle leaves out). accessible, overlay:"circulation" opt-ins. Returns output + diagnostics. A multi-storey plan returns every storey in pages[]; level renders one.
describeSemantic facts (rooms, areas, adjacency, doors, circulation, zones, storeys, the exact floor_polygon/floor_circle shape, and a freedom report of which positions are hand-authored vs resolver-derived) — verify intent without an image.
lintAdvisory W_* soundness warnings (may include the fix-carrying W_ALIAS_MATCH for a room use inferred from an indirect label alias); profile selects a ruleset.
validateParse + resolve + lint, the ship gate. strict fails on warnings; graph checks interior-door adjacency against an intended room graph; intent gates on a brief's contract (per archlang://intent-schema).
scoreThe continuous intent METER: how much of a brief a plan satisfies (satisfied/total/score/subscores). Measures, never gates.
repairExplicit corrector: furniture out of walls/doorways/swings → new .arch source + change log. Never adds doors/windows.
finishComplete the drawing: furnish the rooms that hold no furniture, then add the missing paper, scale, dims auto, title, schedule rooms and legend → new .arch source + change log. Fills only what is missing; only runs one stage (furnish or sheet); reissue may replace paper/scale.
fixApply the machine-applicable fixes on a plan's diagnostics (syntactic corrector; bounded fixpoint). unsafe widens to maybe-incorrect.
suggestAdvisory door/window statements (each referencing its wall by a stable ref — an authored id or a unique category — or absolute coordinates, never a re-bindable positional id) to resolve unreachable rooms / windowless bedrooms — data, never applied.
completeLSP completion items in scope at a source byte offset.
linkTwo URLs that show the plan in a browser with nothing to install: playground (the hosted editor, rendered) and embed (the plan alone, for an iframe), plus bytes, the compressed plan's size, and ok (with an errors count when the plan does not compile; it still links and the page shows the diagnostics). The plan rides in the URL fragment. Needs a core that exports ./link; an older one gets ok:false and the version it needs.

What compile's accessible does here — and what it does not

accessible: true gives the SVG its <title>/<desc> pair and role="img" on the root, which is the whole of the option as this shim exposes it. The v1.36 element controls are not reachable through MCP. They need annotate alongside accessible, and this tool passes annotate only for format:"txt"; it also takes accessible as a boolean, so the { idPrefix } form that keeps several plans on one HTML page from sharing arch-title/arch-desc cannot be requested either.

A host that needs a keyboard- and screen-reader-operable drawing — data-arch-primary, role="button", aria-label on each element — has to call the library. The CLI cannot produce it either: annotate has no flag, so archlang compile --accessible stops at the <title>/<desc> pair too.

ts
import { compile } from "@chanmeng666/archlang";compile(src, { annotate: true, accessible: { idPrefix: "plan-7" } });

The output contract, what an embedder still owns, and the known screen-reader limitations are in the language reference.

Resources

URIContent
archlang://specThe whole language in one page (spec.llm.md).
archlang://contextFull agent context: spec + workflow + CLI reference + error catalog (llms-full.txt).
archlang://schemaJSON Schema (2020-12) for the Plan-JSON compile input.
archlang://grammarGBNF constrained-decoding grammar for guaranteed-parseable generation.
archlang://intent-schemaJSON Schema (2020-12) for a brief's Intent — the shape validate's intent and score's brief take.

Install

Claude Code

bash
claude mcp add archlang -- npx -y @chanmeng666/archlang-mcp

Claude Desktop

Add to claude_desktop_config.json (Settings → Developer → Edit Config):

json
{  "mcpServers": {    "archlang": {      "command": "npx",      "args": ["-y", "@chanmeng666/archlang-mcp"]    }  }}

Cursor

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):

json
{  "mcpServers": {    "archlang": {      "command": "npx",      "args": ["-y", "@chanmeng666/archlang-mcp"]    }  }}

VS Code

Add to .vscode/mcp.json:

json
{  "servers": {    "archlang": {      "type": "stdio",      "command": "npx",      "args": ["-y", "@chanmeng666/archlang-mcp"]    }  }}

License

MIT © Chan Meng

来源:packages/mcp/README.md,提交 da3ed37

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

21
  1. v0.2.40最新Nov 7, 2026
  2. v0.2.39Nov 6, 2026
  3. v0.2.38Nov 5, 2026
  4. v0.2.37Nov 4, 2026
  5. v0.2.36Nov 3, 2026
  6. v0.2.33Nov 1, 2026
  7. v0.2.32Oct 31, 2026
  8. v0.2.31Oct 31, 2026
  9. v0.2.30Oct 31, 2026
  10. v0.2.29Oct 29, 2026
  11. v0.2.26Oct 16, 2026
  12. v0.2.25Oct 14, 2026
  13. v0.2.24Oct 9, 2026
  14. v0.2.23Oct 9, 2026
  15. v0.2.22Oct 6, 2026
  16. v0.2.21Oct 5, 2026
  17. v0.2.20Oct 2, 2026
  18. v0.2.19Oct 2, 2026
  19. v0.2.18Sep 30, 2026
  20. v0.2.17Sep 30, 2026
  21. v0.2.16Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分