Skip to content
Back to search

Office-Visio-MCP-Server

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

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/gongrzhe--office-visio-mcp-server/badge.svg)](/listings/gongrzhe--office-visio-mcp-server)

HTML

<a href="/listings/gongrzhe--office-visio-mcp-server"><img src="/api/listings/gongrzhe--office-visio-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Ensure Microsoft Visio is installed on your system 2. Install required Python packages:

pip install pywin32
pip install mcp-server

3. Clone or download this repository 4. Run the server:

python visio_mcp_server.py

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 307 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Visio MCP Server
  2. A MCP server that provides tools for creating and editing Microsoft Visio diagrams programmatically via a standardized API.
  3. ![](https://badge.mcpx.dev?type=server "MCP Server")
  4. ## Overview
  5. 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.
  6. ## Example
  7. ![demo](./public/demo.gif)
  8. ## Requirements
  9. - Windows operating system
  10. - Microsoft Visio (Professional or Standard) installed
  11. - Python 3.12+
  12. - Python packages:
  13. - `mcp.server`
  14. - `win32com.client` (pywin32)
  15. ## Installation
  16. 1. Ensure Microsoft Visio is installed on your system
  17. 2. Install required Python packages:
  18. ```bash
  19. pip install pywin32
  20. pip install mcp-server
  21. ```
  22. 3. Clone or download this repository
  23. 4. Run the server:
  24. ```bash
  25. python visio_mcp_server.py
  26. ```
  27. ## Features
  28. The server provides the following functionality:
  29. ### Creating and Opening Files
  30. - Create new Visio diagrams
  31. - Open existing Visio diagrams
  32. ### Shape Management
  33. - Add various shapes (Rectangle, Circle, Line, etc.)
  34. - Connect shapes with different connector types
  35. - Add text to shapes
  36. - List all shapes in a document
  37. ### File Operations
  38. - Save documents to specified locations
  39. - Export diagrams as images
  40. - Close documents safely
  41. ## MCP Configuration
  42. ### Option 1: Local Python Server
  43. Add the server to your MCP settings configuration file:
  44. ```json
  45. {
  46. "mcpServers": {
  47. "ppt": {
  48. "command": "python",
  49. "args": ["/path/to/ppt_mcp_server.py"],
  50. "env": {}
  51. }
  52. }
  53. }
  54. ```
  55. ### Option 2: Using UVX (No Local Installation Required)
  56. If you have `uvx` installed, you can run the server directly from PyPI without local installation:
  57. ```json
  58. {
  59. "mcpServers": {
  60. "ppt": {
  61. "command": "uvx",
  62. "args": [
  63. "--from", "office-visio-mcp-server", "visio_mcp_server"
  64. ]
  65. }
  66. }
  67. }
  68. ```
  69. ## API Reference
  70. ### Create a Visio File
  71. Creates a new Visio diagram.
  72. ```json
  73. {
  74. "template_path": "[optional] Path to Visio template (.vstx, .vst)",
  75. "save_path": "[optional] Where to save the file"
  76. }
  77. ```
  78. Example:
  79. ```json
  80. {
  81. "save_path": "C:\\Users\\YourUsername\\Documents\\MyDiagram.vsdx"
  82. }
  83. ```
  84. ### Open a Visio File
  85. Opens an existing Visio diagram.
  86. ```json
  87. {
  88. "file_path": "Path to the Visio file to open"
  89. }
  90. ```
  91. ### Add Shape
  92. Adds a shape to a Visio diagram.
  93. ```json
  94. {
  95. "file_path": "Path to the Visio file",
  96. "shape_type": "Type of shape (Rectangle, Circle, Line, etc.)",
  97. "x": 1.0,
  98. "y": 1.0,
  99. "width": 1.0,
  100. "height": 1.0
  101. }
  102. ```
  103. ### Connect Shapes
  104. Connects two shapes in a Visio diagram.
  105. ```json
  106. {
  107. "file_path": "Path to the Visio file",
  108. "shape1_id": 1,
  109. "shape2_id": 2,
  110. "connector_type": "Dynamic, Straight, or Curved"
  111. }
  112. ```
  113. ### Add Text
  114. Adds text to a shape in a Visio diagram.
  115. ```json
  116. {
  117. "file_path": "Path to the Visio file",
  118. "shape_id": 1,
  119. "text": "Text to add to the shape"
  120. }
  121. ```
  122. ### List Shapes
  123. Lists all shapes in a Visio diagram.
  124. ```json
  125. {
  126. "file_path": "Path to the Visio file"
  127. }
  128. ```
  129. ## Usage Example
  130. Here's a complete workflow example:
  131. 1. Create a new Visio file:
  132. ```json
  133. {
  134. "save_path": "C:\\Diagrams\\FlowChart.vsdx"
  135. }
  136. ```
  137. 2. Add a rectangle shape:
  138. ```json
  139. {
  140. "file_path": "C:\\Diagrams\\FlowChart.vsdx",
  141. "shape_type": "Rectangle",
  142. "x": 2.0,
  143. "y": 2.0,
  144. "width": 1.5,
  145. "height": 1.0
  146. }
  147. ```
  148. 3. Add another shape:
  149. ```json
  150. {
  151. "file_path": "C:\\Diagrams\\FlowChart.vsdx",
  152. "shape_type": "Circle",
  153. "x": 5.0,
  154. "y": 2.0,
  155. "width": 1.0,
  156. "height": 1.0
  157. }
  158. ```
  159. 4. Get shape IDs:
  160. ```json
  161. {
  162. "file_path": "C:\\Diagrams\\FlowChart.vsdx"
  163. }
  164. ```
  165. 5. Connect the shapes:
  166. ```json
  167. {
  168. "file_path": "C:\\Diagrams\\FlowChart.vsdx",
  169. "shape1_id": 1,
  170. "shape2_id": 2,
  171. "connector_type": "Straight"
  172. }
  173. ```
  174. 6. Add text to shapes:
  175. ```json
  176. {
  177. "file_path": "C:\\Diagrams\\FlowChart.vsdx",
  178. "shape_id": 1,
  179. "text": "Start"
  180. }
  181. ```
  182. ## Future Features
  183. The following features are planned for future releases:
  184. ### Enhanced Shape Styling
  185. - Color and fill pattern customization
  186. - Line weight, style, and color options
  187. - Text formatting (font, size, alignment)
  188. - Shadow and 3D effects
  189. ### Advanced Visio Objects
  190. - Support for layers and pages
  191. - Group creation and manipulation
  192. - Container management
  193. - Text-only shapes and callouts
  194. ### Template Management
  195. - Template library access
  196. - Custom template creation
  197. - Favorite templates list
  198. ### Batch Operations
  199. - Bulk shape creation
  200. - Mass formatting changes
  201. - Import from CSV/JSON data sources
  202. ### Custom Stencil Support
  203. - Loading custom stencils
  204. - Creating and saving custom stencils
  205. - Searching stencil shapes
  206. ### Diagram Analysis
  207. - Shape relationship analysis
  208. - Path finding between shapes
  209. - Validation against diagram rules
  210. ### Export Options
  211. - PDF export with options
  212. - SVG export for web use
  213. - PNG/JPG with custom resolution
  214. - Export specific pages or sections
  215. ### Integration Capabilities
  216. - REST API wrapper
  217. - Webhook support for diagram changes
  218. - Version control integration
  219. - CI/CD pipeline support
  220. ### Headless Operation
  221. - Server operation without visible Visio UI
  222. - Background diagram processing
  223. - Scheduled operations
  224. ## Troubleshooting
  225. ### Common Issues:
  226. 1. **Visio Not Launching**:
  227. - Ensure Visio is correctly installed and can be opened manually
  228. - Check that you have sufficient permissions to launch COM applications
  229. 2. **Template Not Found**:
  230. - The server will create a blank diagram if templates aren't found
  231. - Specify an absolute path to a template if needed
  232. 3. **Invalid Shape Type**:
  233. - If a shape type isn't recognized, the server will default to a rectangle
  234. - Check spelling and case of shape names
  235. 4. **COM Errors**:
  236. - Restarting Visio manually may help resolve COM interface issues
  237. - Ensure no existing Visio processes are hanging in Task Manager
  238. ## License
  239. This project is licensed under the MIT License - see the LICENSE file for details.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.