Skip to content

command mcp

zmworm edited this page Apr 5, 2026 · 19 revisions

mcp

Built-in MCP (Model Context Protocol) server for AI agent integration.

Synopsis

# Start MCP server over stdio
officecli mcp

# Register as MCP server in an AI client
officecli mcp <target>

# Unregister from an AI client
officecli mcp uninstall <target>

# Show registration status
officecli mcp list

Description

OfficeCLI includes a built-in MCP server that exposes all document operations as tools over the Model Context Protocol (JSON-RPC 2.0, protocol version 2024-11-05). This allows AI agents (Claude, Cursor, VS Code Copilot, LM Studio, etc.) to directly call OfficeCLI commands.

Client Registration

Target Aliases Config Location
Claude Code claude, claude-code ~/.claude/
Cursor cursor ~/.cursor/
VS Code / Copilot vscode, copilot VS Code settings
LM Studio lms, lmstudio LM Studio config
# Register in Claude Code
officecli mcp claude

# Register in Cursor
officecli mcp cursor

# Check status across all clients
officecli mcp list

# Unregister from Claude Code
officecli mcp uninstall claude

Exposed Tools

The MCP server exposes a single unified officecli tool with a command parameter for routing:

command value Description Key Parameters
create Create blank document file, type
view View content file, mode (text/annotated/outline/stats/issues/html), start, end, maxLines, cols
get Get element by path file, path, depth
query Query with selectors file, selector
set Modify properties file, path, props
add Add elements file, parent, type, props, index, from
remove Remove elements file, path
move Move elements file, path, to, index
validate Validate document file
batch Batch operations file, commands (JSON array)
raw Raw XML operations file, part, xpath, action, xml
merge Template merge file, output, data (JSON object)
help Get format reference format (xlsx, pptx, docx)

All commands share the same tool — command is the only required parameter. All other parameters are optional and depend on the command.

help command

Returns a strategy guide and format-specific property reference for the specified document format:

{ "command": "help", "format": "xlsx" }
{ "command": "help", "format": "pptx" }
{ "command": "help", "format": "docx" }

Notes

  • The MCP server communicates over stdio (stdin/stdout) using JSON-RPC 2.0.
  • All tool outputs use the structured JSON envelope format ({ "success": true/false, "data": ... }).
  • The server runs as a single process — one instance per AI client session.

See Also


Based on OfficeCLI v1.0.35

Clone this wiki locally