Cover image
Try Now
2025-03-26

Un serveur de protocole de contexte de modèle (MCP) pour la création, la lecture et la manipulation des documents Microsoft Word. Ce serveur permet aux assistants AI de travailler avec des documents Word via une interface standardisée, fournissant de riches capacités d'édition de documents.

3 years

Works with Finder

2

Github Watches

6

Github Forks

51

Github Stars

Office-Word-MCP-Server

A Model Context Protocol (MCP) server for creating, reading, and manipulating Microsoft Word documents. This server enables AI assistants to work with Word documents through a standardized interface, providing rich document editing capabilities.

Office Word Server MCP server

Overview

Office-Word-MCP-Server implements the Model Context Protocol to expose Word document operations as tools and resources. It serves as a bridge between AI assistants and Microsoft Word documents, allowing for document creation, content addition, formatting, and analysis.

Example

Pormpt

image

Output

image

Features

Document Management

  • Create new Word documents with metadata
  • Extract text and analyze document structure
  • View document properties and statistics
  • List available documents in a directory
  • Create copies of existing documents

Content Creation

  • Add headings with different levels
  • Insert paragraphs with optional styling
  • Create tables with custom data
  • Add images with proportional scaling
  • Insert page breaks

Rich Text Formatting

  • Format specific text sections (bold, italic, underline)
  • Change text color and font properties
  • Apply custom styles to text elements
  • Search and replace text throughout documents

Table Formatting

  • Format tables with borders and styles
  • Create header rows with distinct formatting
  • Apply cell shading and custom borders
  • Structure tables for better readability

Advanced Document Manipulation

  • Delete paragraphs
  • Create custom document styles
  • Apply consistent formatting throughout documents
  • Format specific ranges of text with detailed control

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Basic Installation

# Clone the repository
git clone https://github.com/GongRzhe/Office-Word-MCP-Server.git
cd Office-Word-MCP-Server

# Install dependencies
pip install -r requirements.txt

Using the Setup Script

Alternatively, you can use the provided setup script which handles:

  • Checking prerequisites
  • Setting up a virtual environment
  • Installing dependencies
  • Generating MCP configuration
python setup_mcp.py

Usage with Claude for Desktop

Configuration

Method 1: After Local Installation

  1. After installation, add the server to your Claude for Desktop configuration file:
{
  "mcpServers": {
    "word-document-server": {
      "command": "python",
      "args": [
        "/path/to/word_server.py"
      ]
    }
  }
}

Method 2: Without Installation (Using uvx)

  1. You can also configure Claude for Desktop to use the server without local installation by using the uvx package manager:
{
  "mcpServers": {
    "word-document-server": {
      "command": "uvx",
      "args": [
        "--from", "office-word-mcp-server", "word_mcp_server"
      ]
    }
  }
}
  1. Configuration file locations:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Restart Claude for Desktop to load the configuration.

Example Operations

Once configured, you can ask Claude to perform operations like:

  • "Create a new document called 'report.docx' with a title page"
  • "Add a heading and three paragraphs to my document"
  • "Insert a 4x4 table with sales data"
  • "Format the word 'important' in paragraph 2 to be bold and red"
  • "Search and replace all instances of 'old term' with 'new term'"
  • "Create a custom style for section headings"
  • "Apply formatting to the table in my document"

API Reference

Document Creation and Properties

create_document(filename, title=None, author=None)
get_document_info(filename)
get_document_text(filename)
get_document_outline(filename)
list_available_documents(directory=".")
copy_document(source_filename, destination_filename=None)

Content Addition

add_heading(filename, text, level=1)
add_paragraph(filename, text, style=None)
add_table(filename, rows, cols, data=None)
add_picture(filename, image_path, width=None)
add_page_break(filename)

Text Formatting

format_text(filename, paragraph_index, start_pos, end_pos, bold=None, 
            italic=None, underline=None, color=None, font_size=None, font_name=None)
search_and_replace(filename, find_text, replace_text)
delete_paragraph(filename, paragraph_index)
create_custom_style(filename, style_name, bold=None, italic=None, 
                    font_size=None, font_name=None, color=None, base_style=None)

Table Formatting

format_table(filename, table_index, has_header_row=None, 
             border_style=None, shading=None)

Troubleshooting

Common Issues

  1. Missing Styles

    • Some documents may lack required styles for heading and table operations
    • The server will attempt to create missing styles or use direct formatting
    • For best results, use templates with standard Word styles
  2. Permission Issues

    • Ensure the server has permission to read/write to the document paths
    • Use the copy_document function to create editable copies of locked documents
    • Check file ownership and permissions if operations fail
  3. Image Insertion Problems

    • Use absolute paths for image files
    • Verify image format compatibility (JPEG, PNG recommended)
    • Check image file size and permissions

Debugging

Enable detailed logging by setting the environment variable:

export MCP_DEBUG=1  # Linux/macOS
set MCP_DEBUG=1     # Windows

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

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

Acknowledgments


Note: This server interacts with document files on your system. Always verify that requested operations are appropriate before confirming them in Claude for Desktop or other MCP clients.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.

  • ShrimpingIt
  • Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX

  • pontusab
  • La communauté du curseur et de la planche à voile, recherchez des règles et des MCP

  • ravitemer
  • Un puissant plugin Neovim pour gérer les serveurs MCP (Protocole de contexte modèle)

  • jae-jae
  • MCP Server pour récupérer le contenu de la page Web à l'aide du navigateur sans tête du dramwright.

  • patruff
  • Pont entre les serveurs Olllama et MCP, permettant aux LLM locaux d'utiliser des outils de protocole de contexte de modèle

  • av
  • Exécutez sans effort LLM Backends, API, Frontends et Services avec une seule commande.

  • appcypher
  • Serveurs MCP géniaux - une liste organisée de serveurs de protocole de contexte de modèle

  • chongdashu
  • Activer les clients adjoints AI comme Cursor, Windsurf et Claude Desktop pour contrôler le moteur Unreal à travers le langage naturel à l'aide du Protocole de contexte modèle (MCP).

  • wgpsec
  • 一款基于各大企业信息 API 的工具 , 解决在遇到的各种针对国内企业信息收集难题。一键收集控股公司 ICP 备案、 APP 、小程序、微信公众号等信息聚合导出。支持 MCP 接入

    Reviews

    1 (1)
    Avatar
    user_tGxC0c0W
    2025-04-18

    I have been using the Office-Word-MCP-Server by GongRzhe, and it has significantly enhanced my document management workflow. The seamless integration and robust functionalities make it a must-have tool for any office environment. I appreciate the meticulous attention to detail and the responsive performance. Highly recommended! Check it out at https://github.com/GongRzhe/Office-Word-MCP-Server.