MCP Connector

Automate Visio Diagram Creation and Editing

Automate Microsoft Visio diagram creation and editing with an AI assistant, driven through Python and Visio's COM interface.

Works with microsoft visiopythoncom

91
Spark score
out of 100
Updated May 2025
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Programmatically create, edit, and manage Microsoft Visio diagrams using a standardized Python API. Automate the generation of flowcharts, organizational charts, and process diagrams.

Outcomes

What it gets done

01

Create new Visio files from templates

02

Add and connect shapes with text

03

List shapes and export diagrams as images

04

Open and save existing Visio documents

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-office-visio-mcp-server | bash

Capabilities

Tools your agent gets

create_visio_file

Creates a new Visio diagram with optional template and save path

open_visio_file

Opens an existing Visio diagram

add_shape

Adds a shape to a Visio diagram with specified type, position, and dimensions

connect_shapes

Connects two shapes in a Visio diagram with various connector types

add_text

Adds text to a shape in a Visio diagram

list_shapes

Lists all shapes in a Visio diagram

Overview

Office-Visio-MCP-Server MCP Server

An MCP server that drives Microsoft Visio via COM automation: create/open diagrams, add and connect shapes, add text, and export/save files. Use it to programmatically build or edit Visio diagrams on Windows - requires a licensed Visio install, not available on non-Windows systems.

What it does

Visio MCP Server automates Microsoft Visio diagram creation and editing using Python and Visio's COM interface, letting an AI assistant create diagrams, add and connect shapes, add text, and manage files programmatically.

When to use - and when NOT to

Use it when you want to programmatically build or edit Visio diagrams - flowcharts, org charts, or technical diagrams - by creating/opening .vsdx files, adding shapes with position and size, connecting them with dynamic/straight/curved connectors, and labeling shapes with text. Do not use it on non-Windows systems - it requires Windows, a licensed Microsoft Visio (Professional or Standard) installation, and Python 3.12+ with pywin32, since it drives Visio directly through COM automation rather than a headless library. Advanced features like shape styling (color, line weight, 3D effects), layers/pages, custom stencils, batch operations, and PDF/SVG export are documented as planned for future releases, not currently available.

Because it's COM-driven, expect COM-specific failure modes: if Visio won't launch, confirm it opens manually and that you have permission to launch COM applications; a missing template silently falls back to a blank diagram rather than erroring (specify an absolute template path if that's not what you want); an unrecognized shape type defaults to a rectangle rather than failing; and persistent COM errors are usually resolved by restarting Visio manually and checking Task Manager for hung Visio processes first. The upstream repository (GongRzhe/Office-Visio-MCP-Server on GitHub) is archived and no longer receiving updates.

Capabilities

  • Create a new Visio diagram, optionally from a template (.vstx/.vst), saved to a specified path.
  • Open an existing Visio file.
  • Add a shape (Rectangle, Circle, Line, etc.) at a given position and size.
  • Connect two shapes by ID with a Dynamic, Straight, or Curved connector.
  • Add text to a specific shape.
  • List all shapes in a document (to retrieve shape IDs for connecting/labeling).
  • Save documents, export diagrams as images, and close documents safely.

Example workflow: create a file, add a Rectangle and a Circle shape, list shapes to get their IDs, connect them with a Straight connector, then label the rectangle "Start".

How to install

Requires Windows, Microsoft Visio installed, and Python 3.12+:

pip install pywin32
pip install mcp-server

Clone the repository and run:

python visio_mcp_server.py

Or via uvx with no local install: {"command": "uvx", "args": ["--from", "office-visio-mcp-server", "visio_mcp_server"]}.

Who it's for

Windows users with Microsoft Visio who want to automate diagram creation and editing - generating flowcharts or technical diagrams programmatically - instead of manually placing and connecting shapes in the Visio UI. The project is licensed under the MIT License.

Source README

Visio MCP Server

A MCP server that provides tools for creating and editing Microsoft Visio diagrams programmatically via a standardized API.

Overview

Visio MCP Server allows you to automate Visio diagram creation and editing using Python. It leverages Microsoft's COM interface to control Visio, enabling you to programmatically create diagrams, add shapes, connect them, add text, and more.

Example

Requirements

  • Windows operating system
  • Microsoft Visio (Professional or Standard) installed
  • Python 3.12+
  • Python packages:
    • mcp.server
    • win32com.client (pywin32)

Installation

  1. Ensure Microsoft Visio is installed on your system
  2. Install required Python packages:
pip install pywin32
pip install mcp-server
  1. Clone or download this repository
  2. Run the server:
python visio_mcp_server.py

Features

The server provides the following functionality:

Creating and Opening Files

  • Create new Visio diagrams
  • Open existing Visio diagrams

Shape Management

  • Add various shapes (Rectangle, Circle, Line, etc.)
  • Connect shapes with different connector types
  • Add text to shapes
  • List all shapes in a document

File Operations

  • Save documents to specified locations
  • Export diagrams as images
  • Close documents safely

MCP Configuration

Option 1: Local Python Server

Add the server to your MCP settings configuration file:

{
  "mcpServers": {
    "ppt": {
      "command": "python",
      "args": ["/path/to/ppt_mcp_server.py"],
      "env": {}
    }
  }
}

Option 2: Using UVX (No Local Installation Required)

If you have uvx installed, you can run the server directly from PyPI without local installation:

{
  "mcpServers": {
    "ppt": {
      "command": "uvx",
      "args": [
        "--from", "office-visio-mcp-server", "visio_mcp_server"
      ]
    }
  }
}

API Reference

Create a Visio File

Creates a new Visio diagram.

{
  "template_path": "[optional] Path to Visio template (.vstx, .vst)",
  "save_path": "[optional] Where to save the file"
}

Example:

{
  "save_path": "C:\\Users\\YourUsername\\Documents\\MyDiagram.vsdx"
}

Open a Visio File

Opens an existing Visio diagram.

{
  "file_path": "Path to the Visio file to open"
}

Add Shape

Adds a shape to a Visio diagram.

{
  "file_path": "Path to the Visio file",
  "shape_type": "Type of shape (Rectangle, Circle, Line, etc.)",
  "x": 1.0,
  "y": 1.0,
  "width": 1.0,
  "height": 1.0
}

Connect Shapes

Connects two shapes in a Visio diagram.

{
  "file_path": "Path to the Visio file",
  "shape1_id": 1,
  "shape2_id": 2,
  "connector_type": "Dynamic, Straight, or Curved"
}

Add Text

Adds text to a shape in a Visio diagram.

{
  "file_path": "Path to the Visio file",
  "shape_id": 1,
  "text": "Text to add to the shape"
}

List Shapes

Lists all shapes in a Visio diagram.

{
  "file_path": "Path to the Visio file"
}

Usage Example

Here's a complete workflow example:

  1. Create a new Visio file:
{
  "save_path": "C:\\Diagrams\\FlowChart.vsdx"
}
  1. Add a rectangle shape:
{
  "file_path": "C:\\Diagrams\\FlowChart.vsdx",
  "shape_type": "Rectangle",
  "x": 2.0,
  "y": 2.0,
  "width": 1.5,
  "height": 1.0
}
  1. Add another shape:
{
  "file_path": "C:\\Diagrams\\FlowChart.vsdx",
  "shape_type": "Circle",
  "x": 5.0,
  "y": 2.0,
  "width": 1.0,
  "height": 1.0
}
  1. Get shape IDs:
{
  "file_path": "C:\\Diagrams\\FlowChart.vsdx"
}
  1. Connect the shapes:
{
  "file_path": "C:\\Diagrams\\FlowChart.vsdx",
  "shape1_id": 1,
  "shape2_id": 2,
  "connector_type": "Straight"
}
  1. Add text to shapes:
{
  "file_path": "C:\\Diagrams\\FlowChart.vsdx",
  "shape_id": 1,
  "text": "Start"
}

Future Features

The following features are planned for future releases:

Enhanced Shape Styling

  • Color and fill pattern customization
  • Line weight, style, and color options
  • Text formatting (font, size, alignment)
  • Shadow and 3D effects

Advanced Visio Objects

  • Support for layers and pages
  • Group creation and manipulation
  • Container management
  • Text-only shapes and callouts

Template Management

  • Template library access
  • Custom template creation
  • Favorite templates list

Batch Operations

  • Bulk shape creation
  • Mass formatting changes
  • Import from CSV/JSON data sources

Custom Stencil Support

  • Loading custom stencils
  • Creating and saving custom stencils
  • Searching stencil shapes

Diagram Analysis

  • Shape relationship analysis
  • Path finding between shapes
  • Validation against diagram rules

Export Options

  • PDF export with options
  • SVG export for web use
  • PNG/JPG with custom resolution
  • Export specific pages or sections

Integration Capabilities

  • REST API wrapper
  • Webhook support for diagram changes
  • Version control integration
  • CI/CD pipeline support

Headless Operation

  • Server operation without visible Visio UI
  • Background diagram processing
  • Scheduled operations

Troubleshooting

Common Issues:

  1. Visio Not Launching:

    • Ensure Visio is correctly installed and can be opened manually
    • Check that you have sufficient permissions to launch COM applications
  2. Template Not Found:

    • The server will create a blank diagram if templates aren't found
    • Specify an absolute path to a template if needed
  3. Invalid Shape Type:

    • If a shape type isn't recognized, the server will default to a rectangle
    • Check spelling and case of shape names
  4. COM Errors:

    • Restarting Visio manually may help resolve COM interface issues
    • Ensure no existing Visio processes are hanging in Task Manager

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.