# What is OfficeCLI? The Open-Source CLI for AI-Driven Office Automation

> Discover OfficeCLI, the open-source CLI for AI-driven Office automation. Programmatically create, read, and modify Word, Excel, and PowerPoint documents without Office installation.

- Repository: [OfficeAI/OfficeCLI](https://github.com/iofficeai/OfficeCLI)
- Tags: getting-started
- Published: 2026-07-30

---

**OfficeCLI is a single-binary, cross-platform command-line tool that enables AI agents and developers to programmatically create, read, modify, and render Microsoft Office documents (Word, Excel, PowerPoint) without requiring a full Office installation.**

OfficeCLI, maintained in the `iOfficeAI/OfficeCLI` repository, transforms Office document automation into a lightweight, scriptable service. Unlike traditional Office automation that relies on heavy COM interop or proprietary APIs, this open-source tool embeds the .NET runtime and provides deterministic JSON outputs with path-based document addressing, establishing it as the standard CLI for AI-driven Office workflows.

## Core Capabilities of OfficeCLI

### Headless Office Document Processing

OfficeCLI operates as a **headless document processor**, handling Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files without Microsoft Office installed. According to the source code, the tool embeds the .NET runtime directly within its binary, eliminating the dependency headaches typically associated with Office automation on servers or in containerized environments.

### AI-Native Interface Design

Every command in OfficeCLI supports deterministic JSON output via the `--json` flag. The tool uses **stable, path-based addressing** (e.g., `/slide[1]/shape[2]`) allowing AI agents to navigate document structures without parsing raw OOXML. This design pattern ensures that automated systems can reliably target specific document elements for reading or modification through predictable selectors.

### Cross-Platform Binary Distribution

Shipped as a **single self-contained binary** for Linux, macOS, and Windows, OfficeCLI installs via one-line curl scripts, Homebrew, Scoop, npm, or direct download. This distribution model ensures consistent behavior across development environments and CI/CD pipelines without managing complex runtime dependencies.

## How OfficeCLI Works Under the Hood

The architecture separates concerns between command parsing, format-specific logic, and AI integration layers.

### Entry Point and Command Dispatch

In [`src/officecli/Program.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Program.cs), the application entry point parses CLI arguments and dispatches execution to [`CommandBuilder.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/CommandBuilder.cs). The `CommandBuilder` class serves as the core dispatcher, constructing and executing high-level operations including create, add, view, and modify commands.

### Format-Specific Handlers

Document-type logic resides in dedicated handler classes. [`src/officecli/Handlers/WordHandler.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Handlers/WordHandler.cs) implements Word-specific operations including paragraph manipulation, style application, table of contents generation, and PDF export. For Excel functionality, [`src/officecli/Core/Formula/FormulaEvaluator.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/Formula/FormulaEvaluator.cs) powers over 350 built-in Excel functions with automatic evaluation on write operations.

### Document Rendering and Preview

The [`src/officecli/Core/HtmlPreviewHelper.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/HtmlPreviewHelper.cs) file contains the HTML rendering engine that produces high-fidelity HTML representations and PNG screenshots. This subsystem enables the "render → look → fix" workflow for multimodal AI agents, providing visual feedback without opening desktop Office applications. The engine also supports live-preview servers via the `watch` command.

### AI Integration Layer

Two server components expose OfficeCLI functionality to external agents. [`src/officecli/McpServer.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/McpServer.cs) implements the Model Context Protocol (MCP), exposing all document operations as JSON-RPC tools for integration with Claude Code, Cursor, and VS Code extensions. For performance-critical scenarios, [`src/officecli/ResidentServer.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/ResidentServer.cs) maintains documents in memory, enabling ultra-low-latency batch edits through a resident-mode process.

## Practical OfficeCLI Examples

The following commands demonstrate the tool's workflow from installation to live preview:

```bash

# Install on macOS/Linux

curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash

# Create a new PowerPoint deck

officecli create deck.pptx

# Add a slide with a title

officecli add deck.pptx / --type slide --prop title="Q4 Results"

# Add text shape to first slide using path-based addressing

officecli add deck.pptx '/slide[1]' --type shape \
  --prop text="Revenue ↑ 25%" --prop x=2cm --prop y=5cm --prop size=28

# Generate HTML preview for agent consumption

officecli view deck.pptx html -o /tmp/deck.html

# Start live preview server with auto-refresh

officecli watch deck.pptx  # Opens http://localhost:26315

```

All commands support JSON output for programmatic parsing:

```bash
officecli get deck.pptx /slide[1] --json

```

## MCP Server Integration for AI Agents

OfficeCLI functions as an MCP (Model Context Protocol) server, bridging document operations with AI development environments. The [`McpServer.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/McpServer.cs) implementation exposes the entire command set via JSON-RPC, allowing agents to invoke Office operations directly without shelling out to the CLI. This integration supports deterministic tool calling patterns essential for reliable AI agent behavior when manipulating complex document structures.

## Summary

- OfficeCLI is a single-binary, cross-platform CLI for automating Word, Excel, and PowerPoint documents without Microsoft Office installed.
- The tool provides AI-native interfaces including JSON output, path-based document addressing, and MCP server compatibility via [`McpServer.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/McpServer.cs).
- Core architecture includes [`Program.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/Program.cs) for argument parsing, [`CommandBuilder.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/CommandBuilder.cs) for dispatch, format-specific handlers like [`WordHandler.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/WordHandler.cs), and [`FormulaEvaluator.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/FormulaEvaluator.cs) for Excel computations.
- [`HtmlPreviewHelper.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/HtmlPreviewHelper.cs) enables high-fidelity HTML rendering and PNG generation for visual agent feedback.
- [`ResidentServer.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/ResidentServer.cs) offers memory-resident document processing for low-latency batch operations.

## Frequently Asked Questions

### Does OfficeCLI require Microsoft Office to be installed?

No. OfficeCLI embeds the .NET runtime within its binary and implements document format logic directly in handlers like [`WordHandler.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/WordHandler.cs), functioning as a standalone tool without COM interop or Office licensing requirements.

### How does OfficeCLI handle Excel formulas?

The tool includes [`FormulaEvaluator.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/FormulaEvaluator.cs), which implements over 350 built-in Excel functions with automatic recalculation when cells are modified, ensuring formula integrity without Excel present.

### Can OfficeCLI integrate with AI coding assistants?

Yes. Through [`McpServer.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/McpServer.cs), OfficeCLI exposes document operations via the Model Context Protocol (MCP), enabling direct integration with Claude Code, Cursor, and VS Code AI extensions using JSON-RPC tool calls.

### What platforms does OfficeCLI support?

OfficeCLI ships as a single self-contained binary for Linux, macOS, and Windows, installable via curl scripts, Homebrew, Scoop, npm, or direct download from the GitHub releases page.