visio-mcp

visio-mcp

Drives Microsoft Visio desktop via COM automation to create, style, and layout diagrams such as flowcharts and cloud architecture, then exports PNGs for visual feedback and iteration.

Category
访问服务器

README

visio-mcp

An MCP server that drives Microsoft Visio desktop via COM automation to draw diagrams for you: flowcharts, block diagrams, and Azure/AWS architecture diagrams using the official stencils. Claude (or any MCP client) drops real Visio masters, glues dynamic connectors, runs Visio's auto-layout, and exports a PNG of the page so the AI can see the result and iterate.

Runs on Windows only (it automates the Visio desktop app through COM). The codebase is developed and unit-tested cross-platform, but the server must run on a Windows machine with Visio installed.

Requirements

  • Windows 10/11
  • Microsoft Visio desktop (any recent version; must be installed and activated)
  • Python 3.10+ and uv
  • Claude Code (or Claude Desktop) on the same machine

Setup (on the Windows machine)

git clone <this repo> C:\tools\visio_mcp   # or copy the folder
cd C:\tools\visio_mcp
uv sync

Azure / AWS icons

Visio ships them built-in — no downloads needed. Visio 16 / Microsoft 365 installs include ~130 stencils (Azure, AWS, networking, and more) under <Office install>\root\Office16\Visio Content\<locale>\ — e.g. AZURESTORAGE_U.VSSX, AWSSTORAGE_U.VSSX. They resolve by bare filename, so open_stencil("AZURESTORAGE_U.VSSX") (or a fuzzy match like open_stencil("azurestorage")) works out of the box. visio_status lists them in builtin_cloud_stencils, and there are also dedicated Azure Diagrams / AWS Diagrams templates (Azure, AWS) that create_document can start from.

Some masters go by different names than you might guess — the server auto-resolves common ones (Private EndpointPrivate Link, Amazon S3Bucket with Objects, IAMSecurity Identity and Compliance) and tells you when a concept is a container rather than a master (subnets, VNets, VPCs → add_container).

For older Visio versions or extra vendor packs, download stencils and unzip the .vssx files into your My Shapes folder (visio_status reports the exact path, typically Documents\My Shapes):

open_stencil("azure") fuzzy-matches any .vssx/.vss file under My Shapes, and find_masters("virtual machine") searches inside whatever is open.

Custom icons (no built-in master)

A few concepts have no Visio master at all — notably the newer Azure Subnet glyph. For these the server keeps a local icon folder: drop labeled image files (subnet.svg, private-endpoint.png, …) into it and they become first-class, reusable icons.

  • list_local_icons reports the folder path and its contents. It defaults to ~/.visio-mcp/icons and can be moved with the VISIO_MCP_ICONS_DIR environment variable.
  • The file name without its extension is the label. Labels are surfaced by find_masters (marked stencil: "(local icon)") and placed with drop_shape("subnet", x, y) — real Visio masters always take precedence; the local icon is the fallback before the "no master" error.
  • For a one-off (or a direct image URL) you can still import_image(source, x, y) without saving a file. Icon-gallery web pages (e.g. az-icons.com) are single-page apps that return HTML rather than the image, so download the file (its Download button) or pass a direct raw image URL.

Icons are yours to supply — nothing is bundled — so respect each vendor's icon terms of use (e.g. Microsoft's / AWS's) for anything you place there.

Smoke test

Verifies the full pipeline end-to-end (launches Visio, builds a small styled flowchart, auto-lays it out, exports a PNG, saves/reopens the .vsdx):

uv run python scripts/smoke_test.py

Register with Claude Code

claude mcp add visio -- uv --directory C:\tools\visio_mcp run visio-mcp

Then ask Claude something like: "Draw a 5-step login flowchart in Visio and show me the result."

Tools

Tool Purpose
visio_status Version, open docs/stencils, My Shapes path; launches Visio if needed
create_document New drawing, optionally from a template (BASFLO_U.VSTX = basic flowchart)
open_document / save_document Open/save .vsdx files
export_page_png Export the page as PNG and return the image for visual iteration
open_stencil Open a stencil by built-in name, path, or fuzzy My Shapes match
find_masters Search droppable shapes across open stencils
drop_shape / drop_shapes Drop masters at (x, y) inches with optional text/size
update_shape / style_shape / delete_shapes Edit text/position/size, colors/fonts, delete
connect_shapes Glued dynamic connector: label, arrows, right-angle/straight/curved routing, solid/dashed/dotted patterns, weight, color
add_container / container_members Wrap shapes in real Visio containers (VNets, VPCs, subnets, trust zones) — members move with the container
drop_text Text-only labels (no border/fill) for titles, legends, and callouts
set_page_size Resize the page (or fit to contents) — do this before wide architecture diagrams
pages List/add/activate pages
auto_layout Visio's automatic layout (flowchart top-bottom/left-right, tree, radial, circular)
get_page_state Everything on a page: ids, masters, positions, text, connector endpoints, container membership

Coordinate system: inches, origin at the page bottom-left, y grows upward, and drop coordinates are the shape's center. Rough placement is fine — finish with auto_layout. The default page is US Letter (8.5×11): call set_page_size first for wide architecture diagrams, since PNG export crops to the page bounds.

Architecture

Claude (stdio) → FastMCP server (asyncio; no COM imports)
                    ↓ submits callables
                 ComWorker — single STA thread owns ALL COM objects
                    ↓
                 VisioClient — the only module that touches win32com
                    ↓
                 Visio.Application

COM objects are apartment-threaded, so every COM call is funneled through one dedicated STA worker thread (runtime.py); tool bodies just await results. This also serializes concurrent tool calls safely.

Development (any OS)

Unit tests run against a duck-typed fake of the Visio COM surface — no Windows needed:

uv sync
uv run pytest

Troubleshooting

Symptom Fix
"Visio is busy — close any open dialog" A modal dialog is open in the Visio window; close it and retry
"Visio desktop is not installed" Install Visio desktop; Visio for the web cannot be automated
"Could not open a stencil matching …" Download the stencil pack into Documents\My Shapes, then retry; use visio_status to confirm the path
First run shows Visio setup/license dialogs Start Visio manually once, dismiss the dialogs, then retry

Roadmap

  • Agent skills encoding Azure/AWS diagram conventions (zones/containers, brand colors, icon naming)
  • Optional HTTP transport to drive a Windows Visio box from another machine
  • A scripts/install_stencils.py helper that downloads stencil packs into My Shapes

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选