AI Agent API for React DOCX Editor
Word-JS-API-shaped bridge to drive a React DOCX editor with AI agents. Live, headless, or MCP. Vercel AI SDK, OpenAI, Anthropic. 14 tools.
@eigenpal/docx-editor-agents is a Word-JS-API-shaped bridge that lets an AI agent operate on DOCX documents. The agent reads paragraphs, anchors comments to specific text, suggests tracked changes, applies formatting, and navigates the document. Fourteen tools work against either of two transports: a live <DocxEditor> in the browser, or a headless DocxReviewer on the server. The same tool catalog covers both. The toolkit is the integration surface for contract review, redlining pipelines, and document copilots that need to ship in a regular React app rather than a Microsoft Word add-in.
npm install @eigenpal/docx-editor-agentsTwo ways to use it
| Mode | Entry point | When to use |
|---|---|---|
| Live editor | useDocxAgentTools (React) | The user watches comments, tracked changes, and scroll happen in the browser. |
| Headless | DocxReviewer (Node, edge, server) | Batch review, queue workers, scheduled jobs. No DOM. |
| MCP | McpServer | Expose the tool catalog over JSON-RPC to any MCP client. |
Where to next
Try the agent live: /editor?agent=roastmaster opens the editor on this site with the agent panel pre-wired against a sample document.
- Live editor: wire
useDocxAgentTools+useChatinto a running<DocxEditor>. Includes an embedded interactive demo. - Headless:
DocxReviewer.fromBuffer()for server-side review. Auto-generated method reference. - Tool catalog: fourteen tools, locate-then-mutate pattern.
- Bring your own agent: adapters for Vercel AI SDK, OpenAI, Anthropic, LangChain.
- Word JS API parity: Office.js mapping, enforced at compile time.
- MCP server: JSON-RPC, transport-agnostic, spec 2025-06-18.
For the React UI primitives that pair with these hooks (AgentPanel, AgentChatLog, AgentComposer), see Components / Agent UI kit.