Skip to main content
Glama
Docx MCP Server
by bagushd1

Docx MCP Server

A Model Context Protocol (MCP) server for reading and editing Microsoft Word (.docx) documents.

Features

  • read_docx: Extracts all paragraph text and tables from a .docx file.

  • create_or_append_docx: Creates a new .docx file or appends headings and paragraphs to an existing file.

  • replace_text_in_docx: Finds and replaces specific text across paragraphs and tables.

  • create_table_docx: Creates a new table from 2D data rows with an optional heading.

  • edit_table_docx: Edits specific cell content by table index, row, and column.

  • delete_table_docx: Deletes a table by its table index.

  • clear_docx: Clears all content (paragraphs and tables) from a document.

  • add_column_docx: Appends or inserts a new column to a table with optional cell values, width, and position (insert_index).

  • resize_table_docx: Resizes column widths (in inches) across all columns or for a single column.

  • set_table_visibility_docx: Toggles table border visibility (visible grid or transparent/borderless).

  • delete_column_docx: Deletes a specific column from a table by column index.

  • add_row_docx: Appends or inserts a new row to a table with optional cell values, height, and position (insert_index).

  • delete_row_docx: Deletes a specific row from a table by row index.

  • merge_cells_docx: Merges a rectangular range of cells within a table.

  • set_cell_shading_docx: Applies background color (HEX) to a cell, row, column, or entire table.

  • set_table_style_docx: Sets the Word table template style (e.g. Table Grid, Light Shading).

  • set_table_alignment_docx: Sets table alignment on the document page (left, center, right).

  • set_cell_alignment_docx: Sets cell text alignment horizontally and/or vertically.

  • set_table_pagination_docx: Configures repeat header rows (tblHeader) and prevents row split (cantSplit).

  • set_cell_margins_docx: Sets cell padding/margins (in pt) on a specific cell or the entire table.

  • set_table_borders_docx: Configures custom borders per side (top, bottom, left, right, inside) with custom color and size.

  • set_cell_text_direction_docx: Rotates cell text direction (horizontal, 90° up, 270° down).

  • split_table_docx: Splits a table into two separate tables at a specified row index.

  • format_text_docx: Formats font name, size (Pt), color (RGB/HEX), bold, italic, underline, underline style (double, dotted, dashed, wave, etc.), strikethrough, subscript, superscript, small caps, all caps, and highlight on paragraphs, table cells, or targeted phrases.

  • format_paragraph_docx: Formats paragraph layout on document body or inside table cells: line spacing (multiple or exact pt), space before/after (pt), indents (first line, left, right, hanging in inches), alignment, list styles, and page flow controls (keep_with_next, page_break_before, widow_control).

  • add_styled_paragraph_docx: Appends a new paragraph or heading with comprehensive font, typography (subscript/superscript/caps), paragraph spacing, exact/multiple line spacing, indents, hanging indent, page flow controls, list style, and alignment options.

  • add_picture_docx: Inserts an image (.png, .jpg, .jpeg, .gif, .bmp, .tiff) via file path or direct base64 string into a document, specific paragraph, or table cell with width/height in Inches or Cm, alignment, italic caption, alt text, and title.

  • get_images_info_docx: Inspects and lists all images in the document with their dimensions in both Inches and Centimeters.

  • resize_picture_docx: Resizes an existing image in the document by its picture index using Inches or Cm.

  • delete_picture_docx: Deletes an image from the document by its picture index.

  • extract_images_docx: Extracts all embedded image files from the document and saves them to an output directory.

  • set_page_setup_docx: Configures paper size (A4, Letter, Legal, Folio/F4, A3, A5, Executive or custom cm/inches), orientation (Portrait/Landscape), margins (preset: normal, narrow, skripsi 4-4-3-3, or custom cm/inches), gutter, header/footer distance, mirror margins (mirror_margins for facing pages/booklets), multi-column layout (columns_count, column_spacing_cm/inches), and page numbering format/restart (page_number_start, page_number_format).

  • get_page_setup_docx: Inspects page dimensions, orientation, margins, gutter, mirror margins status, multi-column setup, and page numbering settings for all sections in the document.

  • add_section_docx: Appends a new section (e.g. for switching to landscape, multi-column, or different paper size / margins) with section start types (new_page, continuous, etc.), column count/spacing, and page numbering restart.

  • add_page_break_docx: Inserts a hard page break, column break, or line break at document end, before a specific paragraph, or inside a table cell.

  • add_horizontal_rule_docx: Inserts a standalone horizontal divider rule or applies a bottom/top/box border directly to an existing paragraph (ideal for Kop Surat letterhead dividers) with customizable style (single, double, triple, thick, thick_thin, thin_thick, wave, etc.), thickness in Pt, left/right indentation, alignment, color, and spacing.

  • add_equation_docx: Inserts native editable Word mathematical equations (OMML) converted from LaTeX or MathML with block/inline display modes, academic right-aligned equation numbering (equation_number), placeholder replacement (placeholder), font size scaling (font_size_pt), paragraph alignment, and table cell support.

  • set_header_footer_docx: Sets Header and Footer text and physical page number fields (PAGE / NUMPAGES) with alignment, fonts, colors, section unlinking (is_linked_to_previous), different first page, and academic presets (skripsi_chapter for bottom-center on first page and top-right on subsequent pages, skripsi_preliminary for centered roman numbers).

  • get_header_footer_docx: Inspects Header and Footer text, field codes (PAGE/NUMPAGES), alignment, and linkage status across all sections in the document.

  • add_table_of_contents_docx: Inserts a Table of Contents (Daftar Isi, Daftar Tabel, Daftar Gambar) supporting native Word dynamic fields (TOC \o "1-3" \h \z \u with F9 / automatic refresh via update_fields_on_open), manual or pre-computed entries with dot leaders (. . . . . 15), auto-detection of existing document headings, hierarchical indentation per level (level_indent_cm), bold level 1 styling, arbitrary insertion index, and page break integration.

Related MCP server: Word Document MCP Server

Requirements

  • Python >= 3.12

  • uv (recommended)

Installation

Clone the repository and install dependencies:

cd docx-mcp
uv sync

Running the Server

Run directly with uv:

uv run docx-mcp

MCP Client Configuration

Add this server to your MCP client configuration (e.g. mcp_config.json):

{
  "mcpServers": {
    "docx-editor": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/docx-mcp",
        "run",
        "docx-mcp"
      ]
    }
  }
}

Available Tools

40 tools
add_column_docxC

Menambahkan atau menyisipkan kolom pada tabel docx dengan teks sel opsional, lebar opsional, dan indeks posisi opsional

Inputs: file_path (required), table_index (required), values, insert_index, +1 more. Returns: result

add_equation_docxA

Menyisipkan rumus matematika (Equation) ke file .docx dari format LaTeX, MathML, atau OMML. Mendukung mode block (persamaan mandiri di tengah) dan inline (sejajar teks), penomoran persamaan rata kanan ala jurnal/skripsi (equation_number), penggantian placeholder teks (placeholder), ukuran font (font_size_pt), perataan, serta penempatan di paragraf atau sel tabel.

Inputs: equation (required), file_path (required), col, row, +12 more. Returns: result

add_horizontal_rule_docxB

Menyisipkan garis horizontal (rule / pembatas bab) atau menambahkan garis pembatas kop surat/paragraf dengan gaya (single, double, triple, thick, thick_thin, thin_thick, thin_thick_thin, wave, dotted, dashed), ketebalan (pt), indentasi, posisi border, dan warna kustom.

Inputs: file_path (required), color, style, size_pt, +8 more. Returns: result

add_page_break_docxB

Menyisipkan page break (pindah halaman), column break, atau line break ke dokumen .docx pada akhir dokumen, sebelum paragraf tertentu, atau di dalam sel tabel.

Inputs: file_path (required), col, row, break_type, +2 more. Returns: result

add_picture_docxB

Menyisipkan gambar (.png/.jpg/dll) ke dokumen Word melalui path file atau string base64 dengan opsi lebar/tinggi (Inches atau Cm), perataan, caption, alt text/title, atau ke dalam sel tabel

Inputs: file_path (required), col, row, title, +11 more. Returns: result

add_row_docxC

Menambahkan atau menyisipkan baris baru pada tabel docx dengan teks sel opsional, tinggi opsional, dan indeks posisi opsional

Inputs: file_path (required), table_index (required), values, insert_index, +1 more. Returns: result

add_section_docxC

Menambahkan section baru ke dokumen Word (misal halaman baru dengan orientasi Landscape, format 2 kolom, atau restart nomor halaman)

Inputs: file_path (required), gutter_cm, paper_size, start_type, +21 more. Returns: result

add_styled_paragraph_docxC

Menambahkan paragraf atau heading baru dengan opsi lengkap font, ukuran, warna, gaya teks, spasi, dan perataan ke file .docx

Inputs: text (required), file_path (required), bold, color, +25 more. Returns: result

add_table_of_contents_docxB

Menambahkan Daftar Isi (Table of Contents / TOC) pada dokumen .docx. Mendukung TOC dinamis Word (field fldSimple/complex F9), entri manual / terhitung dengan dot leaders (... nomor halaman), auto-deteksi heading dokumen, indentasi hierarki level, kustomisasi judul ('DAFTAR ISI', 'DAFTAR TABEL', 'DAFTAR GAMBAR'), dan page break.

Inputs: file_path (required), entries, heading, toc_type, +14 more. Returns: result

clear_docxC

Menghapus seluruh isi teks dan tabel dari file .docx sehingga menjadi dokumen kosong

Inputs: file_path (required). Returns: result

create_or_append_docxC

Membuat file .docx baru atau menambahkan paragraf ke file yang sudah ada

Inputs: file_path (required), paragraphs (required), heading. Returns: result

create_table_docxC

Membuat tabel baru dari matriks data 2D ke dalam file .docx

Inputs: data (required), file_path (required), heading. Returns: result

delete_column_docxC

Menghapus satu kolom tertentu dari tabel docx berdasarkan col_index (0-indexed)

Inputs: col_index (required), file_path (required), table_index (required). Returns: result

delete_picture_docxC

Menghapus gambar dari dokumen .docx berdasarkan indeks gambar

Inputs: file_path (required), picture_index. Returns: result

delete_row_docxC

Menghapus satu baris tertentu dari tabel docx berdasarkan row_index (0-indexed)

Inputs: file_path (required), row_index (required), table_index (required). Returns: result

delete_table_docxC

Menghapus tabel dari file .docx berdasarkan indeks tabel (0-indexed)

Inputs: file_path (required), table_index (required). Returns: result

edit_table_docxC

Mengubah isi teks pada sel tabel tertentu (0-indexed) dalam file .docx

Inputs: col (required), row (required), new_text (required), file_path (required), +1 more. Returns: result

extract_images_docxC

Mengekstrak seluruh file gambar yang tertanam di dalam dokumen .docx dan menyimpannya ke folder output

Inputs: file_path (required), output_dir (required). Returns: result

format_paragraph_docxC

Mengatur format paragraf: spasi baris (misal 1.5, 2.0 atau Pt), spasi sebelum/sesudah (pt), indentasi/hanging indent (inci), perataan, list, dan kontrol halaman (keep_with_next, page_break_before)

Inputs: file_path (required), col, row, alignment, +14 more. Returns: result

format_text_docxC

Mengatur jenis font, ukuran (Pt), warna teks, bold, italic, underline, strikethrough, subscript, superscript, small_caps, all_caps, dan highlight

Inputs: file_path (required), col, row, bold, +15 more. Returns: result

get_images_info_docxB

Mendapatkan daftar dan informasi dimensi seluruh gambar yang ada di dalam dokumen .docx

Inputs: file_path (required). Returns: result

get_page_setup_docxA

Membaca informasi ukuran kertas, orientasi, margin (cm/inci), gutter, header/footer distance, kolom, dan penomoran halaman untuk seluruh section dokumen

Inputs: file_path (required). Returns: result

merge_cells_docxC

Menggabungkan (merge) area sel dari [start_row, start_col] sampai [end_row, end_col] (0-indexed)

Inputs: end_col (required), end_row (required), file_path (required), start_col (required), +2 more. Returns: result

read_docxB

Membaca seluruh isi teks dan tabel dari file .docx

Inputs: file_path (required). Returns: result

replace_text_in_docxC

Mencari dan mengganti teks spesifik di dalam paragraf maupun tabel .docx

Inputs: new_text (required), old_text (required), file_path (required). Returns: result

resize_picture_docxC

Mengubah ukuran (resize) gambar yang sudah ada di dokumen berdasarkan indeks gambar (Inches atau Cm)

Inputs: file_path (required), width_cm, height_cm, width_inches, +2 more. Returns: result

resize_table_docxB

Mengatur lebar kolom tabel (dalam inci). Bisa mengatur seluruh kolom via col_widths atau satu kolom via col_index & width_inches

Inputs: file_path (required), table_index (required), col_index, col_widths, +1 more. Returns: result

set_cell_alignment_docxC

Mengatur perataan teks sel: horizontal ('left', 'center', 'right', 'justify') dan/atau vertikal ('top', 'center', 'bottom')

Inputs: file_path (required), table_index (required), col, row, +2 more. Returns: result

set_cell_margins_docxC

Mengatur padding/margin internal sel (dalam satuan pt). Berlaku untuk sel spesifik ([row, col]) atau seluruh tabel jika row/col tidak diisi

Inputs: file_path (required), table_index (required), col, row, +4 more. Returns: result

set_cell_shading_docxB

Memberikan warna latar belakang (shading) pada sel/baris/kolom/tabel dengan format HEX (contoh: 'E0E0E0' atau '#E0E0E0')

Inputs: color_hex (required), file_path (required), table_index (required), col, +1 more. Returns: result

set_cell_text_direction_docxC

Mengatur arah orientasi teks sel ('horizontal', 'bt_lr' untuk rotasi 90 derajat ke atas, atau 'tb_rl' untuk rotasi 270 derajat ke bawah)

Inputs: file_path (required), table_index (required), col, row, +1 more. Returns: result

set_page_setup_docxC

Mengatur ukuran kertas (A4, Letter, F4/Folio, Legal, dll), orientasi, margin (cm/inci/preset: normal, narrow, skripsi), gutter, multi-kolom koran, restart nomor halaman, dan mirror margins

Inputs: file_path (required), gutter_cm, paper_size, orientation, +26 more. Returns: result

set_table_alignment_docxC

Mengatur perataan posisi tabel di halaman dokumen ('left', 'center', atau 'right')

Inputs: alignment (required), file_path (required), table_index (required). Returns: result

set_table_borders_docxC

Mengatur border tabel secara kustom per sisi dengan opsi warna (HEX atau 'auto'), ketebalan (size), dan style border

Inputs: file_path (required), table_index (required), top, val, +7 more. Returns: result

set_table_pagination_docxC

Mengatur opsi cetak/pagination tabel: mengulang header di setiap halaman (repeat_header_rows) dan mencegah baris terbelah (cant_split)

Inputs: file_path (required), table_index (required), cant_split, repeat_header_rows. Returns: result

set_table_style_docxC

Mengubah template style bawaan Word untuk tabel (misalnya 'Table Grid', 'Light Shading', 'Normal Table')

Inputs: file_path (required), style_name (required), table_index (required). Returns: result

set_table_visibility_docxC

Mengatur visibilitas border tabel (visible=False untuk transparan/tanpa garis, visible=True untuk border garis)

Inputs: file_path (required), table_index (required), visible. Returns: result

split_table_docxC

Membagi (split) satu tabel menjadi dua tabel terpisah pada baris split_row_index (0-indexed)

Inputs: file_path (required), table_index (required), split_row_index (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 40 tools

    Disambiguation4/5

    Most tools target clearly distinct resource+action pairs (e.g., add_row vs add_column vs merge_cells). A few boundaries are softer—add_styled_paragraph overlaps with format_text and format_paragraph, and set_table_alignment could be confused with set_cell_alignment—but descriptions make the distinctions reasonably clear.

    Naming Consistency5/5

    All tools use snake_case with a consistent action-object suffix (_docx), e.g., resize_table_docx, set_cell_shading_docx, get_page_setup_docx. Minor compound names like create_or_append_docx still follow the same predictable pattern.

    Tool Count3/5

    40 tools is heavy for a single server, with nearly half dedicated to granular table operations (borders, shading, margins, pagination, visibility, etc.). The domain is broad enough to justify many tools, but several table controls could be consolidated without losing capability.

    Completeness4/5

    The surface covers core docx workflows: create/read/clear, text and paragraph formatting, table CRUD and styling, images, headers/footers, page setup, sections, equations, and TOC. Notable gaps remain for hyperlinks, footnotes/endnotes, comments, document properties, and inserting paragraphs at specific positions.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      Not graded
      maintenance
      Enables AI assistants to create, read, and manipulate Microsoft Word documents with comprehensive formatting, table creation, content management, and document protection capabilities. Supports advanced operations like merging documents, PDF conversion, and rich text formatting through a standardized interface.
      32
      MIT
    • A
      license
      Not graded
      quality
      F
      maintenance
      Enables AI assistants to create, edit, and extract data from Microsoft Word documents programmatically, supporting document creation, content editing, table manipulation, parameter extraction, and template generation.
      1
      MIT