Home / MCP / Office-Word-MCP-Server

Office-Word-MCP-Server

Exposes Word document operations via MCP to create, edit, format, and analyze documents programmatically.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "word_mcp": {
            "command": "python",
            "args": [
                "/path/to/word_mcp_server.py"
            ]
        }
    }
}

You can use Office-Word-MCP-Server to create, read, and edit Microsoft Word documents through a standardized Model Context Protocol interface. This server lets AI assistants interact with Word documents for tasks like creating documents, adding content, formatting, and extracting information in a clean, maintainable way.

How to use

You interact with the Office-Word-MCP-Server by connecting an MCP client to the local or remote server. You can run the local server process and then configure your MCP client to communicate with it using a simple stdio-based workflow or, if available, a remote HTTP endpoint. Once connected, you can perform practical operations such as creating a new document, inserting headings and paragraphs, building tables, applying formatting, and exporting to PDF. You can also read and extract content, search text, and manage comments and revisions. Use the provided tool functions to guide your prompts, for example creating a document titled with a specific name, adding a heading, inserting a table, and applying formatting across selected content.

Practical usage patterns

Start by launching the local server process and then point your MCP client to the server. Typical workflows include creating a new Word document, adding structured content (headings, paragraphs, and lists), inserting tables and images, customizing styles, and performing content extraction or searches across the document.

Common tasks you can perform

Create a new document, add headings and paragraphs with direct formatting, build and format tables, insert images with proportional scaling, apply page breaks, and insert lists with correct XML numbering. You can also insert content relative to existing text, create and apply custom styles, format specific text ranges, and manage advanced table formatting such as borders, shading, and cell padding.

Starting from a clean slate

1) Start the server process locally. 2) Configure your MCP client to connect using a stdio command or a HTTP URL if you have a remote endpoint. 3) Begin issuing document manipulation commands through the MCP layer and verify the results in Word.

Available tools

create_document

Create a new Word document with optional metadata such as title and author.

get_document_info

Retrieve document metadata and properties.

get_document_text

Extract all text from a document or specific sections.

get_document_outline

Obtain the document's outline or structure.

copy_document

Copy an existing document to a new filename.

convert_to_pdf

Convert a Word document to PDF format.

add_heading

Insert a heading with a chosen level and optional direct formatting.

add_paragraph

Add a paragraph with optional styling and direct formatting.

add_table

Create a table with provided data and dimensions.

add_picture

Insert an image with proportional scaling into the document.

add_page_break

Insert a page break at the current location.

insert_header_near_text

Insert a header near a specified text or paragraph position.

insert_line_or_paragraph_near_text

Insert a line or paragraph near a target location with optional styling.

insert_numbered_list_near_text

Insert a bulleted or numbered list near target content with proper XML formatting.

get_paragraph_text_from_document

Retrieve text from a specific paragraph by index.

find_text_in_document

Search for text within the document with optional matching controls.

format_text

Apply bold, italic, underline, color, font size, and font name to a text range.

search_and_replace

Find and replace text across the document.

delete_paragraph

Delete a paragraph by index.

create_custom_style

Create and apply a custom style to document elements.

format_table

Apply formatting to a table, including header rows and borders.

set_table_cell_shading

Apply shading to specific table cells.

apply_table_alternating_rows

Apply alternating row colors to a table for readability.

highlight_table_header

Highlight the table header with a distinct style.

merge_table_cells

Merge multiple table cells across rows and columns.

merge_table_cells_horizontal

Merge cells horizontally within a row.

merge_table_cells_vertical

Merge cells vertically within a column.

set_table_cell_alignment

Set horizontal and vertical alignment for a specific cell.

set_table_alignment_all

Apply alignment to all cells in a table.

format_table_cell_text

Format text within a specific table cell.

set_table_cell_padding

Set padding for table cells with explicit units.

set_table_column_width

Set the width of a specific table column.

set_table_column_widths

Set multiple column widths for a table.

set_table_width

Set the overall table width.

auto_fit_table_columns

Auto-fit table columns to content.

get_all_comments

Extract all comments from the document.

get_comments_by_author

Filter comments by author.

get_comments_for_paragraph

Get comments associated with a specific paragraph.