Skip to main content
Glama
Office MCP Server

Office MCP Server

by Alex-eng-ux

Office MCP Server

MCP server for Microsoft Office file operations. Read, write, and create Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) files directly from your local filesystem.

Works with any MCP-compatible client (Claude Desktop, Trae SOLO, VS Code via MCP extension, etc.).

Features

Excel

Tool

Function

office_read_excel

Read data from Excel files (specify sheet and range)

office_write_excel

Write or append data to existing Excel files

office_create_excel

Create new Excel files with headers, data, and auto-sized columns

office_get_excel_info

List all sheets with dimensions

office_excel_create_table

Create formatted Excel tables (超级表/ListObject) with styles, filter buttons, and totals row

office_excel_set_formula

Set formulas in cells (e.g. SUM(A2:B2))

office_excel_fill_formula

Fill formulas across a range of cells

office_excel_merge_cells

Merge or unmerge cell ranges

office_excel_add_auto_filter

Add auto filter to a data range

office_excel_set_styles

Apply advanced cell formatting (font, fill, border, alignment, number format)

office_excel_add_comment

Add comments/notes to cells

office_excel_add_image

Insert images into worksheets

office_excel_rename_sheet

Rename worksheets

office_excel_add_conditional_formatting

Add conditional formatting: data bars, color scales, icon sets, cell rules

office_excel_add_data_validation

Add data validation: dropdown lists, number ranges, custom rules

office_excel_freeze_panes

Freeze rows/columns to keep them visible while scrolling

Word

Tool

Function

office_create_word

Create Word documents with rich formatting: headings, paragraphs, formatted tables (borders, shading, header rows, column widths), images, hyperlinks, page breaks, text styling (bold, italic, underline, strikethrough, color, highlight, superscript, subscript), alignment, lists, headers/footers with page numbers, page orientation, margins, table of contents

office_read_word

Get basic document info

PowerPoint

Tool

Function

office_create_powerpoint

Create presentations with title, subtitle, and bullet content slides

office_add_powerpoint_slides

Append slides to an existing presentation

office_ppt_add_chart

Generate single-slide presentations with charts (bar, pie, line, area, radar, bubble, etc.)

office_ppt_add_shape

Draw shapes (rectangles, circles, stars, arrows, hearts, etc.)

office_ppt_add_image

Insert images into slides

office_ppt_add_table

Create formatted table slides

office_ppt_add_master_slide

Create slide masters (templates) with consistent branding

office_ppt_add_animation

Create animated slides with fade, fly, zoom, bounce effects

Installation

Prerequisites

  • Node.js >= 18

  • npm

Setup

git clone https://github.com/Alex-eng-ux/office-mcp-server.git
cd office-mcp-server
npm install
npm run build

Configuration

Add the server to your MCP configuration file (mcp.json):

{
  "mcpServers": {
    "Office MCP": {
      "command": "node",
      "args": ["path/to/office-mcp-server/dist/index.js"],
      "env": {}
    }
  }
}

Configuration file locations:

Client

File Path

Trae / Trae SOLO

%APPDATA%\TRAE SOLO CN\User\mcp.json

VS Code + MCP extension

.vscode/mcp.json in project root

Claude Desktop

claude_desktop_config.json

Usage Examples

Excel

Create a budget spreadsheet:

Create an Excel file at ./budget.xlsx with headers ["项目", "预算", "实际", "差异"]
and rows [["研发", 100000, 95000, 5000], ["市场", 50000, 52000, -2000]]

Read data from an existing file:

Read Sheet1 from ./report.xlsx, range A1:D10

Create a formatted Excel table (超级表) with alternating row colors and totals row:

Create a table in ./sales.xlsx sheet "Sheet1":
name: "SalesTable"
columns: ["产品" (name), "销量" (sum), "金额" (sum)]
rows: [["A产品", 120, 15000], ["B产品", 85, 10200], ["C产品", 200, 28000]]
style: { theme: "TableStyleMedium9", showRowStripes: true, showFirstColumn: true }
totalsRow: true

Set formulas and apply cell formatting:

- Set formula in ./budget.xlsx sheet "Sheet1" cell D2: "B2-C2" (差异 = 预算 - 实际)
- Fill formula from D2 to D10 in ./budget.xlsx sheet "Sheet1"
- Apply styles to A1:D1 in ./budget.xlsx: bold font, blue background (#4472C4), white text, centered
- Set number format "¥#,##0" for range C2:D10
- Add auto filter to A1:D10
- Merge cells A11:D11 for a title row
- Add comment to B5: "需部门负责人确认" author: "财务部"

Add conditional formatting:

- Add data bars to C2:C10 in ./sales.xlsx: color "4472C4", showValue: true
- Add color scale to D2:D10: minColor "63BE7B", midColor "FFEB84", maxColor "F8696B"
- Add icon set (3Arrows) to B2:B10: showValue: true
- Add cell rule to C2:C10: greaterThan 15000, fill color "92D050"

Add data validation:

- Add dropdown list to A2:A10: type "list", formulae: ['"选项1,选项2,选项3"']
- Add integer range to B2:B10: type "whole", operator "between", formulae: [1, 100]

Freeze panes:

- Freeze first row in ./report.xlsx sheet "Sheet1": freezeType "row", rows: 1
- Freeze first column: freezeType "column", cols: 1

Word

Generate a meeting report with rich formatting:

Create a Word document at ./meeting.docx with:
- Heading 1: "项目周报"
- Paragraph: "本周进展顺利。"
- Heading 2: "完成事项"
- Bullet: "功能A已上线"
- Bullet: "Bug修复完成"
- Table: headers ["任务", "状态", "负责人"]
  with formatting: header shading (#4472C4), borders, column widths [2, 2, 2]
- Table rows: ["登录模块", "已完成", "张三"], ["支付功能", "测试中", "李四"]
- Page break
- Heading 2: "参考资料"
- Hyperlink: "点击查看项目文档" -> https://example.com/docs
- Paragraph: "红色粗体警告文字" bold: true, color: "FF0000"
- Paragraph: "居中对齐段落" alignment: "center"

Create a landscape document with headers, footers and page numbers:

Create a Word document at ./report.docx with:
- Heading 1: "年度汇报", alignment: "center"
- Paragraph: "内容..."
Options: orientation: "landscape", margins: { top: 0.8, bottom: 0.8, left: 1, right: 1 }, header: "公司机密", footer: "第 1 页", showPageNumber: true

Create a document with table of contents:

Create a Word document at ./report.docx with:
- TOC (table of contents)
- Heading 1: "第一章 概述"
- Paragraph: "..."
- Heading 2: "1.1 背景"
- Paragraph: "..."
- Heading 1: "第二章 方案"
- ...

PowerPoint

Create a presentation:

Create a PowerPoint at ./report.pptx with 3 slides:
Slide 1: title "季度汇报", subtitle "2026 Q2"
Slide 2: title "核心数据", bullets ["营收增长25%", "用户突破100万"]
Slide 3: title "下一步计划", bullets ["优化性能", "扩展新功能"]

Add a bar chart:

Create a chart at ./chart.pptx:
type: bar
data: [labels: ["Q1","Q2","Q3","Q4"], name: "营收", values: [120, 150, 180, 220]]
options: showLegend: true, barDirection: "col"

Add a shape:

Create a shape slide at ./shape.pptx:
shape: "star5"
options: { x: 2, y: 1, w: 4, h: 4, fillColor: "FFD700" }

Create a master slide template:

Create a master slide at ./template.pptx:
title: "CORPORATE"
background: { color: "1F497D" }
objects: [{ type: "text", text: "公司机密", options: { x: 0.5, y: 7, w: 9, h: 0.5, fontSize: 10, color: "AAAAAA" } }]
slideNumber: { x: 9.2, y: 7, fontSize: 10, color: "AAAAAA" }

Create an animated slide:

Create an animated slide at ./animated.pptx:
title: "项目进展"
content: ["需求分析已完成", "系统设计已完成", "开发实现中"]
animations: [{ type: "fade", delay: 0, duration: 500, on: "onClick" }, { type: "fly", delay: 200, duration: 600, on: "afterPrevious" }]

Supported Chart Types

Type

Description

bar

Bar chart (clustered, stacked, percentStacked)

bar3D

3D bar chart

line

Line chart

pie

Pie chart

area

Area chart

doughnut

Doughnut chart

radar

Radar chart

scatter

Scatter chart

bubble

Bubble chart

Common Shapes

rect, ellipse, triangle, star5, heart, diamond, cloud, lightningBolt, smileyFace, chevron, pentagon, hexagon, octagon, moon, sun, leftArrow, rightArrow, upArrow, downArrow, cube, plus, wave, funnel, ribbon, line — and 150+ more.

Development

# Watch mode
npm run dev

# Build
npm run build

# Start
npm start

Project Structure

office-mcp-server/
├── src/
│   ├── index.ts              # MCP server entry, tool registration
│   ├── types.ts              # Shared type definitions
│   └── services/
│       ├── excel.ts          # Excel operations
│       ├── word.ts           # Word operations
│       └── powerpoint.ts     # PowerPoint operations (charts, shapes, images, tables)
├── test-excel-advanced.mjs   # Excel advanced features test script
├── test-word-advanced.mjs    # Word advanced features test script
├── test-new-features.mjs     # Conditional formatting, data validation, freeze panes, TOC, master, animation test
├── package.json
├── tsconfig.json
└── .gitignore

License

MIT

Available Tools

12 tools
office_add_powerpoint_slidesAdd Slides to PowerPointA
Destructive

Add slides to an existing PowerPoint (.pptx) presentation.

Args:

  • filePath (string): Path to the existing presentation

  • slides (array of slide objects): Slides to add

Each slide can have:

  • title (string, optional): Slide title

  • subtitle (string, optional): Slide subtitle

  • content (array of strings, optional): Bullet points

Examples:

  • Use when: "Add a summary slide to the existing presentation"

  • Use when: "Append more slides to the quarterly report deck"

Inputs: filePath (required), slides (required).

office_create_excelCreate New Excel FileA
Destructive

Create a new Excel (.xlsx) file with headers and data.

Args:

  • filePath (string): Path where the new Excel file will be created

  • headers (array of strings): Column headers

  • rows (array of arrays): Data rows

  • sheetName (string, optional): Sheet name (default: "Sheet1")

  • columnWidths (array of numbers, optional): Custom column widths

Examples:

  • Use when: "Create a new spreadsheet for the project budget"

  • Use when: "Generate an Excel report with employee data"

  • Don't use when: The file already exists and you want to append data (use office_write_excel instead)

Inputs: filePath (required), headers (required), rows (required), sheetName, +1 more.

office_create_powerpointCreate PowerPoint PresentationA
Destructive

Create a new PowerPoint (.pptx) presentation with slides containing titles, subtitles, and bullet content.

Args:

  • filePath (string): Path where the presentation will be created

  • slides (array of slide objects): Each slide has:

    • title (string, optional): Slide title

    • subtitle (string, optional): Slide subtitle

    • content (array of strings, optional): Bullet points for the slide

Examples:

  • Use when: "Create a presentation about the quarterly results"

  • Use when: "Generate a slide deck for the project kickoff meeting"

  • Use when: "Make a 5-slide summary presentation"

Inputs: filePath (required), slides (required).

office_create_wordCreate Word DocumentA
Destructive

Create a new Word (.docx) document with rich content (headings, paragraphs, lists, tables).

Args:

  • filePath (string): Path where the document will be created

  • contents (array of content objects): Document content. Each content object has:

    • type: "paragraph" | "heading" | "bullet" | "numbered" | "table"

    • text: string (for paragraph, heading, bullet, numbered)

    • level: number (for heading: 1-3, for lists: 0-based level)

    • rows: string[][] (for table type)

    • bold: boolean (optional)

    • italic: boolean (optional)

  • title (string, optional): Document title

  • author (string, optional): Document author

Examples:

  • Use when: "Create a report document with headings and bullet points"

  • Use when: "Generate a Word document with a table of data"

  • Use when: "Write a meeting notes document"

Inputs: filePath (required), contents (required), title, author.

office_get_excel_infoGet Excel File InformationA
Read-onlyIdempotent

Get information about an Excel file, including all sheet names and dimensions.

Args:

  • filePath (string): Path to the Excel file

Returns: { "sheets": [ { "name": string, "rowCount": number, "columnCount": number } ] }

Examples:

  • Use when: "What sheets are in this Excel file?"

  • Use when: "How big is the data in report.xlsx?"

  • Use when: "List all sheets in the workbook"

Inputs: filePath (required).

office_ppt_add_chartAdd Chart Slide to PowerPointA
Destructive

Create a new PowerPoint (.pptx) with one slide containing a chart.

Args:

  • filePath (string): Path where the presentation will be created

  • chart (object): Chart configuration

    • type (string): Chart type: "area" | "bar" | "bar3D" | "bubble" | "doughnut" | "line" | "pie" | "radar" | "scatter"

    • data (array): Data series. Each series has:

      • labels (string[]): Category labels

      • name (string): Series name

      • values (number[]): Data values

    • options (object, optional):

      • showLegend (boolean): Show legend

      • showTitle (boolean): Show title

      • chartColors (string[]): Custom color palette

      • barDirection ("bar" | "col"): Bar direction (for bar charts)

      • barGrouping ("clustered" | "stacked" | "percentStacked"): Bar grouping

      • dataLabelFormat (string): Data label format code (e.g. "#,##0")

Examples:

  • Use when: "Create a bar chart showing quarterly sales data"

  • Use when: "Generate a pie chart of market share distribution"

  • Use when: "Make a line chart of revenue trends over time"

  • Not for: Simple text slides with bullets (use office_create_powerpoint instead)

Inputs: filePath (required), chart (required).

office_ppt_add_imageAdd Image to PowerPointA
Destructive

Create a new PowerPoint (.pptx) with one slide containing an image.

Args:

  • filePath (string): Path where the presentation will be created

  • image (object): Image configuration

    • path (string): Path to the image file

    • options (object, optional):

      • x (number): Left position (inches)

      • y (number): Top position (inches)

      • w (number): Width (inches)

      • h (number): Height (inches)

      • rotate (number): Rotation (degrees)

      • sizing ("cover" | "contain" | "stretch"): Image sizing mode

Examples:

  • Use when: "Create a slide with the company logo"

  • Use when: "Add a screenshot image to a presentation slide"

  • Not for: Creating slides without images

Inputs: filePath (required), image (required).

office_ppt_add_shapeAdd Shape Slide to PowerPointB
Destructive

Create a new PowerPoint (.pptx) with one slide containing a shape.

Args:

  • filePath (string): Path where the presentation will be created

  • shape (string): Shape type name (e.g. 'rect', 'ellipse', 'triangle', 'star5', 'heart', 'cloud', 'lightningBolt', 'smileyFace', 'chevron', 'pentagon', 'hexagon', 'octagon', 'diamond', 'moon', 'sun', 'pie', 'arc', 'frame', 'cube', 'plus', 'wave', 'funnel', 'bevel', 'donut', 'corner', 'heart', 'plaque', 'ribbon', 'line', etc.)

  • options (object, optional):

    • x (number): Left position (inches)

    • y (number): Top position (inches)

    • w (number): Width (inches)

    • h (number): Height (inches)

    • fillColor (string): Fill color (hex, e.g. "4472C4")

    • lineColor (string): Line/border color (hex)

    • lineSize (number): Line width (points)

    • rotate (number): Rotation (degrees, -360 to 360)

Examples:

  • Use when: "Draw a red rectangle" or "Create a slide with a blue circle"

  • Use when: "Add a star shape to the presentation"

  • Use when: "Create a flowchart shape like a diamond or process box"

Inputs: filePath (required), shape (required), options.

office_ppt_add_tableAdd Table Slide to PowerPointA
Destructive

Create a new PowerPoint (.pptx) with one slide containing a formatted table.

Args:

  • filePath (string): Path where the presentation will be created

  • table (object): Table configuration

    • headers (string[]): Column headers

    • rows (string[][]): Data rows

    • options (object, optional):

      • fontSize (number): Font size

      • fontFace (string): Font name

      • borderColor (string): Border color (hex)

      • colW (number[]): Column widths (inches)

Examples:

  • Use when: "Create a slide with a sales data table"

  • Use when: "Make a comparison table slide"

  • Use when: "Generate a KPI dashboard table slide"

  • Not for: Simple text slides (use office_create_powerpoint instead)

Inputs: filePath (required), table (required).

office_read_excelRead Excel FileA
Read-onlyIdempotent

Read data from an Excel (.xlsx) file.

Args:

  • filePath (string): Absolute or relative path to the Excel file

  • sheetName (string, optional): Name of the sheet to read. Defaults to first sheet

  • range (string, optional): Cell range to read, e.g. "A1:C10". Reads all data if not specified

Returns: { "sheetName": string, "headers": string[], "rows": object[], "totalRows": number, "totalColumns": number }

Examples:

  • Use when: "Read the sales data from report.xlsx"

  • Use when: "What are the column headers in Sheet2 of data.xlsx?"

  • Don't use when: You need to write data to Excel (use office_write_excel instead)

Inputs: filePath (required), sheetName, range.

office_read_wordGet Word Document InfoA
Read-onlyIdempotent

Get basic information about a Word (.docx) file.

Args:

  • filePath (string): Path to the Word document

Returns basic file info (name, size, path).

Examples:

  • Use when: "Check if the Word document exists and how large it is"

  • Use when: "Get info about the report.docx file"

Inputs: filePath (required).

office_write_excelWrite Data to ExcelA
Destructive

Write or append data to an existing Excel (.xlsx) file.

Args:

  • filePath (string): Path to the Excel file

  • data (array of arrays): 2D array of values to write

  • sheetName (string, optional): Target sheet name (default: "Sheet1")

  • startCell (string, optional): Starting cell, e.g. "A1" (default: "A1")

Examples:

  • Use when: "Add these numbers to the existing budget.xlsx"

  • Use when: "Write the updated inventory list to Sheet2 of data.xlsx starting at B3"

  • Don't use when: You need to create a new Excel file (use office_create_excel instead)

Inputs: filePath (required), data (required), sheetName, startCell.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 12 tools

    Disambiguation4/5

    Most tools have distinct purposes, but the presence of office_create_powerpoint alongside four office_ppt_add_* tools (all creating new PPTX) creates potential overlap. However, descriptions clarify that office_create_powerpoint handles multiple slides while the others create single-slide files with specific content.

    Naming Consistency4/5

    Tools follow a consistent prefix 'office_' with verb_noun patterns. Minor inconsistencies: use of abbreviation 'ppt' for PowerPoint tools, and mixing verbs like 'create' vs 'add' (e.g., office_create_excel vs office_add_powerpoint_slides) and 'read' vs 'get' (office_read_excel vs office_get_excel_info).

    Tool Count5/5

    12 tools cover a reasonable scope for an office suite, including creation, reading, and writing for main document types with some advanced PowerPoint features. The count feels appropriate without being overwhelming or too sparse.

    Completeness2/5

    Significant gaps exist: Word has no content reading or editing; PowerPoint lacks tools to modify existing presentations beyond adding slides; Excel misses basic operations like deleting or formatting cells. The ecosystem feels incomplete, especially for common workflows involving existing documents.

    Related MCP Connectors