A few weeks ago I released OfficeAgent.NET 0.1, an open-source .NET library that lets AI agents create and edit real Word documents. Instead of manipulating the Open XML themselves, they describe their intent as a typed, validated change plan, and the library turns it into the Open XML that carries it out: tracked changes, tables, comments, and content controls included. Version 0.1 shipped with an integration for Microsoft Agent Framework (MAF), so you could give those document tools to a custom .NET agent.
Today I'm introducing version 0.2. It exposes the same workflow over the Model Context Protocol (MCP), so any MCP-capable agent can read and edit real Word documents. This version also adds a SharePoint document provider, so agents can work on documents where they actually stored: directly in SharePoint, one of the most widely used cloud document stores in the enterprise, rather than on a local disk.
Any agent, over MCP
MCP is an open standard for how an AI agent discovers and calls tools. OfficeAgent.NET 0.2 ships OfficeAgent.Mcp, a server (built on the official C# MCP SDK) that projects the document workflow as MCP tools:
-
inspect_document- a structured map of the document: outline, paragraphs with stable ids, styles, content controls, tables, images, and revisions. -
find_in_document- text search that returns content-verified anchors to target. -
preview_plan- a dry run of a change plan; nothing is written, the agent gets a before/after report and any validation errors. -
apply_plan- the all-or-nothing commit, saved through the configured storage. -
register_document/remove_document/list_connections- point the agent at a document to work on, release it afterwards, and discover the connections the host configured.
Copilot Studio, Microsoft 365 Copilot, Claude and Claude Code, OpenAI's Codex, and VS Code support MCP and can use this server.
The server runs in two hosting modes: stdio, used by locally running agents such as Claude Code and Codex, and an ASP.NET Core app over streamable HTTP, required by hosted agents such as Copilot Studio and Microsoft 365 Copilot.
Working on documents in SharePoint
OfficeAgent works through document providers. An agent registers a document with a provider and gets back an opaque id, which it then uses to address that document in every operation. 0.2 adds a SharePoint provider alongside the filesystem provider from the initial release.
The SharePoint provider reads and writes documents directly in SharePoint - the system most organizations in the Microsoft ecosystem use to store their documents. A document is registered by its URL or its Graph driveId/itemId pair; from there the agent runs the same inspect → preview → apply loop it would run against a local folder.
Two things make it safe to point an agent at a real document:
- You review every change. The agent's edits arrive as Word tracked changes - accept or reject them like a colleague's. And each change is verified against the live document, so it edits the exact place you meant or fails safely, instead of silently rewriting the wrong clause.
- It's scoped to you. Acting on behalf of the signed-in user (OAuth 2.0 On-Behalf-Of), the agent can only open and edit what you're already allowed to in SharePoint - not a shared account with broader reach.
Try it yourself
dotnet tool install --global OfficeAgent.Mcp --prerelease # the MCP server
dotnet add package OfficeAgent.SharePoint --prerelease # the SharePoint provider
dotnet add package OfficeAgent.Core --prerelease # the core library
Source, samples, and the full hosting and client-setup guides are on GitHub: https://github.com/ilia-sokolov/OfficeAgent.NET
Version 0.2 of OfficeAgent.NET opens the document workflow to more agents and more enterprise use cases. Copilot Studio agents, Microsoft 365 Copilot, Claude Code, and Codex can now create or modify Word documents from user intent - without touching OOXML directly, without losing details, and without leaving the user to fix the document afterwards. And with the new SharePoint provider, agents can do it right where most of the documents already live.
Try it out and tell me what you think - that feedback will shape 0.3. If the direction is useful to you, add a star on GitHub to help other developers find it.
Top comments (0)