mcp-ms-office-documents

dvejsada/mcp-ms-office-documents

3.4

If you are the rightful owner of mcp-ms-office-documents and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A Model Context Protocol Server running over SSE, offering tools for LLM to create MS Office documents.

📄 MCP Office Documents Server

Let your AI assistant create professional Office documents — PowerPoint, Word, Excel, emails & XML — with a single prompt.

Docker MCP


📋 Table of Contents


💡 What is this?

This is an MCP (Model Context Protocol) server that runs in Docker and gives AI assistants (like Claude, Cursor, or any MCP-compatible client) the ability to generate real Office files on demand.

Just ask your AI to "create a sales presentation" or "draft a welcome email" — and it will produce a ready-to-use file for you.

No coding required. Install, connect, and start creating.


✨ Features at a Glance

Document TypeToolHighlights
📊 PowerPointcreate_powerpoint_presentationTitle, section & content slides · 4:3 or 16:9 format · Custom templates
📝 Wordcreate_word_from_markdownWrite in Markdown, get a .docx · Headers, lists, tables, links, formatting
📈 Excelcreate_excel_from_markdownMarkdown tables → .xlsx · Formulas & cell references supported
📧 Emailcreate_email_draftHTML email drafts (.eml) · Subject, recipients, priority, language
🗂️ XMLcreate_xml_fileWell-formed XML files · Auto-validates & adds XML declaration if missing

Bonus — Dynamic Templates:

  • 📧 Reusable Email Templates — Define parameterized email layouts in YAML. Each becomes its own tool with typed arguments (e.g., first_name, promo_code).
  • 📝 Reusable Word Templates — Create .docx files with {{placeholders}}. Each template becomes an AI tool. Placeholders support full Markdown.

Output options:

  • Local — Files saved to the output/ folder
  • Cloud — Upload to S3, Google Cloud Storage, Azure Blob, or MinIO and get a time-limited download link

🚀 Quick Start

Get up and running in 3 steps:

1. Download the compose file

curl -L -o docker-compose.yml https://raw.githubusercontent.com/dvejsada/mcp-ms-office-docs/main/docker-compose.yml

Already cloned the repo? Skip this step — docker-compose.yml is already there.

2. Set up your environment

cp .env.example .env

The defaults work out of the box — files will be saved locally to output/.

3. Start the server

docker-compose up -d

Done! Your MCP endpoint is ready at: http://localhost:8958/mcp


⚙️ Configuration

The server is configured through environment variables in your .env file.

Basic Settings

VariableDescriptionDefault
DEBUGEnable debug logging (1, true, yes)(off)
API_KEYProtect the server with an API key (see Authentication below)(disabled)
UPLOAD_STRATEGYWhere to save files: LOCAL, S3, GCS, AZURE, MINIOLOCAL
SIGNED_URL_EXPIRES_INHow long cloud download links stay valid (seconds)3600
🔐 Authentication

Set API_KEY in your .env to require an API key for all requests:

API_KEY=your-secret-key

Clients can send the key in any of these headers:

HeaderFormat
AuthorizationBearer your-secret-key
Authorizationyour-secret-key
x-api-keyyour-secret-key

Leave API_KEY empty or unset to allow all requests without authentication.

☁️ AWS S3 Storage

Set UPLOAD_STRATEGY=S3 and provide:

VariableDescription
AWS_ACCESS_KEYYour AWS access key
AWS_SECRET_ACCESS_KEYYour AWS secret key
AWS_REGIONAWS region (e.g., us-east-1)
S3_BUCKETS3 bucket name
☁️ Google Cloud Storage

Set UPLOAD_STRATEGY=GCS and provide:

VariableDescription
GCS_BUCKETGCS bucket name
GCS_CREDENTIALS_PATHPath to service account JSON (default: /app/config/gcs-credentials.json)

Mount the credentials file via docker-compose.yml volumes.

☁️ Azure Blob Storage

Set UPLOAD_STRATEGY=AZURE and provide:

VariableDescription
AZURE_STORAGE_ACCOUNT_NAMEStorage account name
AZURE_STORAGE_ACCOUNT_KEYStorage account key
AZURE_CONTAINERBlob container name
AZURE_BLOB_ENDPOINT(Optional) Custom endpoint for sovereign clouds
☁️ MinIO / S3-Compatible Storage

Set UPLOAD_STRATEGY=MINIO and provide:

VariableDescriptionDefault
MINIO_ENDPOINTMinIO server URL (e.g., https://minio.example.com)(required)
MINIO_ACCESS_KEYAccess key(required)
MINIO_SECRET_KEYSecret key(required)
MINIO_BUCKETBucket name(required)
MINIO_REGIONRegionus-east-1
MINIO_VERIFY_SSLVerify SSL certificatestrue
MINIO_PATH_STYLEUse path-style URLs (recommended for MinIO)true

Make sure the bucket exists and your credentials have PutObject/GetObject permissions.


🎨 Custom Templates

You can customize the look of generated documents by providing your own templates.

Static Templates

Place files in the custom_templates/ folder:

DocumentFilenameNotes
PowerPoint 4:3custom_pptx_template_4_3.pptx
PowerPoint 16:9custom_pptx_template_16_9.pptx
Wordcustom_docx_template.docx
Email wrappercustom_email_template.htmlBase it on default_templates/default_email_template.html

Dynamic Email Templates

Create reusable, parameterized email layouts that your AI can fill in automatically.

📧 How to set up dynamic email templates

1. Create config/email_templates.yaml:

templates:
  - name: welcome_email
    description: Welcome email with optional promo code
    html_path: welcome_email.html  # must be in custom_templates/ or default_templates/
    annotations:
      title: Welcome Email
    args:
      - name: first_name
        type: string
        description: Recipient's first name
        required: true
      - name: promo_code
        type: string
        description: Optional promotional code (HTML formatted)
        required: false

2. Create the HTML file in custom_templates/welcome_email.html:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8" /></head>
<body>
  <h2>Welcome {{first_name}}!</h2>
  <p>We're excited to have you on board.</p>
  {{{promo_code_block}}}
  <p>Regards,<br/>Support Team</p>
</body>
</html>

How it works:

  • Each template becomes a separate AI tool at startup
  • Standard email fields (subject, to, cc, bcc, priority, language) are added automatically
  • Use {{variable}} for escaped text, {{{variable}}} for raw HTML

Dynamic Word (DOCX) Templates

Create reusable Word documents with {{placeholders}} that support full Markdown formatting.

📝 How to set up dynamic DOCX templates

1. Create config/docx_templates.yaml:

templates:
  - name: formal_letter
    description: Generate a formal business letter
    docx_path: letter_template.docx  # must be in custom_templates/ or default_templates/
    annotations:
      title: Formal Letter Generator
    args:
      - name: recipient_name
        type: string
        description: Full name of the recipient
        required: true
      - name: recipient_address
        type: string
        description: Recipient's address
        required: true
      - name: subject
        type: string
        description: Letter subject
        required: true
      - name: body
        type: string
        description: Main body of the letter (supports markdown)
        required: true
      - name: sender_name
        type: string
        description: Sender's name
        required: true
      - name: date
        type: string
        description: Letter date
        required: false
        default: ""

2. Create a Word document with placeholders and save as custom_templates/letter_template.docx:

{{date}}

{{recipient_name}}
{{recipient_address}}

Subject: {{subject}}

{{body}}

{{sender_name}}

How it works:

  • Each template becomes a separate AI tool at startup
  • Placeholders can be in the document body, tables, headers, and footers
  • Placeholder values support full Markdown (bold, italic, lists, headings…)
  • The original font from the placeholder location is preserved
🎯 Word style requirements for custom templates

For proper formatting, make sure these styles exist in your .docx template:

CategoryStyles
HeadingsHeading 1 – Heading 6
Bullet listsList Bullet, List Bullet 2, List Bullet 3
Numbered listsList Number, List Number 2, List Number 3
OtherNormal, Quote, Table Grid

Tip: Customize these styles (font, size, color, spacing) in your template — the server will use your styling.


🔌 Connecting Your AI Client

Point your MCP-compatible client to the server endpoint:

http://localhost:8958/mcp

Examples for popular clients:

Claude Desktop

Add to your Claude Desktop MCP config:

{
  "mcpServers": {
    "office-documents": {
      "url": "http://localhost:8958/mcp"
    }
  }
}
LibreChat

Add the server to your librechat.yaml configuration under mcpServers:

mcpServers:
  office-documents:
    type: streamableHttp
    url: http://mcp-office-docs:8958/mcp

Note: If LibreChat and this server run in the same Docker network, use the container name (mcp-office-docs) as the hostname. If they run separately, use http://localhost:8958/mcp instead.

To place both services on the same network, add a shared network in your docker-compose.yml:

services:
  mcp-office-docs:
    # ...existing config...
    networks:
      - shared

  librechat:
    # ...existing config...
    networks:
      - shared

networks:
  shared:
    driver: bridge
Cursor / Other MCP Clients

Use the SSE/streamable HTTP transport and set the endpoint URL to:

http://localhost:8958/mcp

If you have authentication enabled, add the API key header as required by your client.


🤝 Contributing

Contributions are welcome! If you'd like to help improve this project:

  1. Fork the repository
  2. Create a branch for your feature or fix (git checkout -b my-feature)
  3. Commit your changes (git commit -m "Add my feature")
  4. Push to your branch (git push origin my-feature)
  5. Open a Pull Request

Whether it's a bug report, a new feature idea, documentation improvement, or a code contribution — all input is appreciated. Feel free to open an issue to start a discussion.