@chanmeng666/archlang-mcp

中文文档
0.2.32发布于 2026/11/01MITES Module构建来源已验证

Model Context Protocol (MCP) server for ArchLang — compile, describe, lint, validate, score, repair, fix, finish, suggest, complete and link floor plans over stdio, plus the intent channel (gate + continuous score against a brief). Covers the whole curren

原始使用文档
文档目录11 节
  1. When to prefer the CLI
  2. Server instructions
  3. Tools
  4. What compile 's accessible does here — and what it does not
  5. Resources
  6. Install
  7. Claude Code
  8. Claude Desktop
  9. Cursor
  10. VS Code
  11. License

@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.

When to prefer the CLI

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:

npx -y @chanmeng666/archlang context     # the whole language + workflow + CLI + errors, one call
npx -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).

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.

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

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

Claude Desktop

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

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

Cursor

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

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

VS Code

Add to .vscode/mcp.json:

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

License

MIT © Chan Meng

版本与发布记录

@chanmeng666/archlang-mcp 共发布 35 个版本,首次发布于 2026/07/11;过去 12 个月发布了 35 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.32latest2026/11/012 天前
0.2.312026/10/313 天前
0.2.302026/10/313 天前
0.2.292026/10/286 天前
0.2.282026/10/286 天前
0.2.272026/10/286 天前

关于 @chanmeng666/archlang-mcp 的常见问题

@chanmeng666/archlang-mcp 是什么?

用于ArchLang的模型上下文协议(MCP)服务器-编译,描述,检测,验证,评分,修复,修复,完成,建议,完成和链接工作室的平面图,以及意图通道(门+对简短的连续评分)。覆盖整个洋流

如何安装 @chanmeng666/archlang-mcp?

在项目目录运行 npm install @chanmeng666/archlang-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 archlang-mcp,可以用 npx archlang-mcp 直接运行。

@chanmeng666/archlang-mcp 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/chanmeng666__archlang-mcp 是否存在。

@chanmeng666/archlang-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@chanmeng666/archlang-mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@chanmeng666/archlang-mcp 可以商用吗?

@chanmeng666/archlang-mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@chanmeng666/archlang-mcp 还在维护吗?

最新版本 0.2.32 发布于 2026/11/01(2 天前);至今共发布 35 个版本,其中过去 12 个月发布了 35 个;首次发布于 2026/07/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。