MI

Microsoft Visio MCP Server

Create and manipulate Microsoft Visio documents with an MCP server for reading, editing, and automating Visio files.

Quick Install
npx -y @GongRzhe/Office-Visio-MCP-Server

Overview

This MCP (Model Context Protocol) server provides a programmatic bridge to create, read, edit and automate Microsoft Visio documents. It exposes a RESTful API that represents Visio files as JSON models, accepts model patches/commands, and performs common file operations (upload, export, download). The server is intended for automation scenarios, batch processing, and integrating Visio diagram manipulation into developer workflows and services.

Because Visio desktop automation typically relies on the Visio COM object model, the server is designed to run where Microsoft Visio is available (commonly a Windows host with Visio installed). The server simplifies common tasks such as generating diagrams from templates, applying model-driven updates (add/remove shapes, change text, set connectors), and exporting drawings to PDF/PNG for downstream consumption.

Features

  • Expose Visio documents as JSON-models via a RESTful MCP-compatible API
  • Upload and download Visio (.vsdx/.vsd) files
  • Apply model patches or commands to add, remove, or modify shapes and connectors
  • Export drawings to common formats (PDF, PNG, SVG)
  • Batch and headless automation for CI/CD or backend processing
  • Health and metadata endpoints for integration checks
  • Simple authentication token support for basic protection
  • Example clients and scripts to demonstrate usage (upload, patch, export)

Installation / Configuration

Prerequisites:

  • Microsoft Visio (desktop) installed on the host where you run the server
  • Windows host is recommended when the server uses Visio COM automation
  • Node.js (16+) or .NET runtime depending on the release build (check repository README for exact runtime)

Clone and run locally:

git clone https://github.com/GongRzhe/Office-Visio-MCP-Server.git
cd Office-Visio-MCP-Server

Install and run (Node.js example):

# install dependencies
npm install

# set environment variables, then start
export PORT=3000
export STORAGE_DIR=./data
export AUTH_TOKEN=your-secret-token

npm start

Or run with .NET (if a .NET build is provided):

# build & run .NET server
dotnet build
dotnet run --project src/VisioMcpServer

Docker: because Visio often requires a desktop Windows environment, a Linux Docker image may not support Visio COM automation. Use Docker only if the project includes a Windows container image and you have the required licensing and Visio installed inside the container.

Configuration environment variables

NameDefaultDescription
PORT3000HTTP port to listen on
STORAGE_DIR./dataDirectory to store uploaded files and temp exports
AUTH_TOKEN(none)Bearer token required by API (optional)
MAX_UPLOAD_MB100Maximum allowed upload size in MB

Notes:

  • Ensure the process can interact with the Visio application (desktop session, proper user permissions).
  • If running as a Windows service, configure the service to allow desktop interaction if using COM automation.

Available Resources

  • API endpoints (HTTP REST) — use for integration and automation
  • Example scripts — small clients demonstrating upload, patch application, and export
  • Postman collection / OpenAPI — check the repo for swagger.json or Postman files to import (if present)
  • Logs and health endpoints — for monitoring and integration checks

Common REST endpoints (example):

MethodPathDescription
GET/healthServer liveness and basic Visio availability
POST/uploadUpload a Visio file (.vsdx)
GET/files/{id}Download stored Visio file
GET/model/{id}Retrieve JSON model representation of the diagram
POST/model/{id}/patchApply JSON patch/model changes
POST/export/{id}?format=pdfExport file to PDF/PNG/SVG

Example: upload a file

curl -X POST "http://localhost:3000/upload" \
  -H "Authorization: Bearer your-secret-token" \
  -F "[email protected]"

Get model JSON

curl -H "Authorization: Bearer your-secret-token" \
  http://localhost:3000/model/12345

Apply a patch (JSON body)

curl -X POST http://localhost:3000/model/12345/patch \
  -H "Authorization: Bearer your-secret-token" \
  -H "Content-Type: application/json" \
  -d '{"operations":[{"op":"addShape","shapeType":"rectangle","x":100,"y":100,"text":"New Node"}]}'

Export to PDF

curl -H "Authorization: Bearer your-secret-token" \
  "http://localhost:3000/export/12345?format=pdf" --output diagram.pdf

Use Cases

  • Automated report generation: programmatically populate a Visio template with data (e.g., network devices, flowchart steps), export to PDF, and attach to reports or emails.
  • Batch conversion: convert large numbers of legacy Visio files to PDF/PNG/SVG as part of an archival or migration pipeline.
  • Model-driven diagram updates: represent diagrams as JSON models, apply patches from external systems (CMDB, orches