visio-mcp
Enables LLM agents to create circuit schematics and diagrams in Microsoft Visio through MCP tools for managing documents, pages, stencils, shapes, wires, and exports, with measured pin geometry for accurate component connections.
README
visio-mcp
MCP (Model Context Protocol) server for drawing circuit schematics and diagrams in Microsoft Visio, driven by an LLM agent. MIT-licensed, 100% original code — no parts copied from other Visio MCP projects.
Why
Drawing schematic netlists in Visio programmatically usually fails because
symbol pins live at unknown coordinates and wires end up floating next to
the symbols. This server ships measured pin geometry for the classic
Analog Circuit stencil: every master was rendered to a 240 DPI PNG and its
pins were located pixel-exact. pin_point() turns those offsets into exact
page coordinates, so wires land on the pins.
Features
- Live COM engine — attaches to a running Visio (
GetActiveObject) or launches a new instance (Dispatch); auto-answers modal dialogs; runs all COM on a single worker thread - Stencil lock workaround — if a stencil is open in another Visio session (very common), a temporary copy is opened instead
- Tools: documents, pages, stencils, masters, shapes (drop / wire / label / junction / weight / delete / find / list), export (PNG/PDF/SVG/EMF…)
- Measured pin geometry for
Analog Circuit.vssmasters (NMOS1/PMOS1/Res1/Cap1/Ind2/balun/gnd/vdd) with orientation variants - Bundled stencils —
stencils/shipsAnalog Circuit.vss,RFIC_lib.vssandRFsys_lib.vssso the examples run out of the box (third-party academic symbols, seestencils/README.mdfor provenance) - Headless mock engine — the same tool layer runs without Visio, so the test suite works on Linux CI
- Example: complete two-stage differential 40 GHz LNA schematic generator
Requirements
| Requirement | Notes |
|---|---|
| Windows 10/11 | live mode |
| Microsoft Visio 2016+ | any edition |
| Python 3.11+ | |
stencils/ |
bundled with the repo (Analog Circuit.vss, RFIC_lib.vss, RFsys_lib.vss); point VISIO_MCP_STENCIL_DIRS at it |
Install
cd VISIO_MCP
python -m venv .venv
.venv\Scripts\pip install -e ".[dev]"
# stencils ship with the repo; point the server at them
export VISIO_MCP_STENCIL_DIRS="$PWD/stencils"
Probe Visio:
.venv\Scripts\python -m visio_mcp --check
Run as an MCP server (stdio)
.venv\Scripts\visio-mcp
Claude Code
{
"mcpServers": {
"visio": {
"command": "C:/path/to/your/stencils/VISIO_MCP/.venv/Scripts/python.exe",
"args": ["-m", "visio_mcp"],
"env": {
"VISIO_MCP_STENCIL_DIRS": "C:/path/to/your/stencils"
}
}
}
}
Hermes Agent
mcp_servers:
visio:
command: "C:/path/to/your/stencils/VISIO_MCP/.venv/Scripts/python.exe"
args: ["-m", "visio_mcp"]
env:
VISIO_MCP_STENCIL_DIRS: "C:/path/to/your/stencils"
Environment variables
| Variable | Default | Meaning |
|---|---|---|
VISIO_MCP_STENCIL_DIRS |
(empty) | ;-separated stencil search dirs for list_stencils |
VISIO_MCP_VISIBLE |
0 |
show the Visio window |
VISIO_MCP_ATTACH |
1 |
attach to a running Visio instance; 0 = always launch a dedicated instance (more deterministic) |
VISIO_MCP_KEEP_ALIVE |
0 |
keep the launched Visio instance after exit |
VISIO_MCP_WIRE_WEIGHT |
1.5 pt |
default wire weight |
VISIO_MCP_LABEL_FONT |
Arial |
default label font |
VISIO_MCP_LABEL_SIZE |
10pt |
default label size |
VISIO_MCP_DOT_STENCIL |
(empty) | junction-dot stencil (e.g. RFIC_lib.vss) |
VISIO_MCP_DOT_MASTER |
Point |
junction-dot master name |
VISIO_MCP_MOCK |
0 |
force the headless mock engine |
Tools
| Tool | Description |
|---|---|
health_check |
server + Visio connection status |
new_document / open_document / save_document / close_document |
document lifecycle (1:1 inch page) |
list_pages / add_page / select_page |
page control |
list_stencils / load_stencil / list_masters |
stencil + master discovery |
drop_master |
drop a symbol (angle, flip, label, weight) |
draw_wire |
orthogonal polyline, uniform weight |
add_label |
centered borderless text (Arial bold) |
add_junction |
solid junction dot (Point master or filled circle) |
set_line_weight / delete_shape / find_shape / list_shapes |
shape management |
export_page |
PNG / JPG / SVG / EMF / PDF / VSDX |
measured_pins / pin_point / symbol_bounds |
measured pin geometry & clearance |
Drawing recipe (agent workflow)
new_document(16, 9.5)— coordinates are inchesload_stencil("…/Analog Circuit.vss")— get a stencil keydrop_master(key, "NMOS1", x, y, flip_x=…)for every symbolpin_point("NMOS1", x, y, "gate")— exact pin coordinatedraw_wire([[..], pin_point, ..])— wires first, components on top (series elements cover the wire; usesymbol_boundsto keep descents out of bodies)add_junctionat ≥3-wire nodes,add_labelfor namesexport_page("png", "out.png")— inspect, iterate
Pitfalls
- Do not keep the output .vsdx open in Visio while regenerating it — SaveAs then fails with an "invalid DOS handle" error. Close the file first (or write to a new path).
- Temporary stencil copies must live next to the original stencil — files in %TEMP% are rejected by the Visio Trust Center file-block settings.
- If a user's interactive Visio session feels flaky (stencils open in
compatibility mode, unsaved docs, ...), set
VISIO_MCP_ATTACH=0so the server drives its own dedicated instance.
Measured pin data
visio_mcp/data/pins_analog_circuit.json — offsets in inches relative to the
drop point (y-up page coordinates), measured by PNG-render + pixel analysis.
Variants encode rotations (angle) and mirrors (flip_x). Verified against
the two-stage LNA example (all 21 connections pixel-checked).
Project layout
visio_mcp/
engine.py live COM engine (single worker thread, lazy win32com)
mock_engine.py headless engine for CI
server.py FastMCP app + tools
pins.py measured-geometry helpers
data/pins_analog_circuit.json
stencils/ bundled Visio stencils (Analog Circuit / RFIC_lib / RFsys_lib)
examples/lna_two_stage.py two-stage diff LNA schematic generator
tests/ unit tests (headless)
License
MIT — the code, the measured pin-geometry JSON, and this documentation are
original work of this project's author. The bundled stencils in stencils/
(Analog Circuit.vss, RFIC_lib.vss, RFsys_lib.vss) are third-party
academic symbols (originally created at Fudan University) and are not
covered by this project's MIT license — see stencils/README.md for their
provenance and terms.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。