> ## Documentation Index
> Fetch the complete documentation index at: https://iso-topology.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 让 AI Agent 画第一张图

> 通过 MCP 连接本地绘图引擎，让 Agent 生成、校验和修改可维护的 YAML 架构图。

从 User → API Gateway → Database 开始，再添加一个缓存。你最终应得到可打开的 SVG，以及能继续修改的 YAML。

## 1. 安装本地工具

需要 Go 1.25 或更高版本：

```bash theme={"system"}
go install github.com/MarkovWangRR/iso-topology/cmd/isotopo@main
go install github.com/MarkovWangRR/iso-topology/cmd/isotopo-mcp@main
isotopo capabilities
```

最后一条命令输出 JSON。找不到命令时，先检查[安装与 PATH](https://iso-topology.mintlify.site/zh/getting-started/01-install.md)。

## 2. 连接客户端

Claude Code 可运行：

```bash theme={"system"}
claude mcp add isotopo -- isotopo-mcp
```

支持 `mcpServers` 的客户端可采用：

```json theme={"system"}
{"mcpServers":{"isotopo":{"command":"isotopo-mcp"}}}
```

客户端没有继承 PATH 时，填写 `isotopo-mcp` 的绝对路径。重新加载客户端，确认它能看到七个 `iso_` 工具。工具运行在本地；所选 AI 客户端如何处理源码和提示词，取决于该客户端。

## 3. 复制这条需求

```text theme={"system"}
使用 isotopo 画 User → API Gateway → Database，采用浅色风格。
请使用 YAML，先读取 iso_capabilities，再生成并校验源码。
根据布局诊断决定是否需要 repair；如果修复，后续使用返回的 dsl。
把输出放到 ./diagrams/first-architecture，并把作者源码保存为
该目录的 input.yaml。返回源码与 SVG 路径。
如果已安装快照工具，请检查 PNG；说明尚未解决的问题。
没有实际检查图片时，不要宣称已完成视觉检查。
```

保存 `input.yaml` 需要 Agent 的文件写入能力；render 另会输出 `topology.yaml` 源码副本。显式指定目录，避免结果只存入临时目录。

## 4. 提出修改

> 在 API Gateway 旁边添加 Cache，用虚线连接。保留原来的节点 ID，更新同一份源文件并重新检查。

自动修复只接受 YAML。D2 和 JSON 支持渲染，不应默认拥有相同的源码修复能力。

## 5. 人工检查

```bash theme={"system"}
isotopo serve diagrams/first-architecture/input.yaml
```

打开打印的 URL，确认图与修改正确。**serve 模式会自动保存可解析的非空源码。** 在实验性修改前保留副本或 Git 版本。

## 6. 发布最新修改

Studio 保存的是 `input.yaml`，不会更新之前导出的 SVG。按 Ctrl+C 停止服务器，或在项目目录另开终端，重新渲染：

```bash theme={"system"}
isotopo render diagrams/first-architecture/input.yaml ./diagrams/first-architecture
```

打开 `diagrams/first-architecture/topology.svg`，确认最后一次标签修改已经包含在内。
继续编辑时使用 `input.yaml`；`topology.yaml` 是渲染生成的源码副本，避免把两份文件交替当作原件。

回到 Agent 时，要求它先从磁盘重新读取 `input.yaml`。聊天中的旧源码可能还没有包含你在 Studio 里的修改。

完成标准：最新 SVG 包含最后一次修改，且你能找到下一次继续编辑的源文件。

[Studio 使用与保存](https://iso-topology.mintlify.site/zh/guides/studio.md) · [完整工具参数（英文）](https://iso-topology.mintlify.site/agent/MCP.md) · [提供给 Agent 的文档索引](https://iso-topology.mintlify.site/llms.txt)

[English](https://iso-topology.mintlify.site/getting-started/00-onboarding.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.