Skip to content

command mcp

zmworm edited this page Mar 23, 2026 · 41 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 11 tools, each accepting a file argument plus tool-specific parameters:

Tool 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

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.18

Clone this wiki locally