Visio MCP Server

Visio MCP Server

Enables to create and edit Microsoft Visio diagrams programmatically via a standardized API.

Category
访问服务器

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

demo

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

License

This project is licensed under the MIT License - see the LICENSE file for details.

推荐服务器

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 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
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 模型以安全和受控的方式获取实时的网络信息。

官方
精选