OfficeMCP is a server implementation of the Model Context Protocol (MCP) that enables AI models to control Microsoft Office applications through a COM interface on Windows. This tool allows for automated interaction with applications like Word, Excel, PowerPoint, and others, creating a bridge between AI capabilities and office productivity software.
OfficeMCP can be installed and run in two different modes, which can be used independently or simultaneously.
This setup creates a dedicated OfficeMCP server for a single MCP client:
Ensure you have Python 3.1+ and the uv package manager installed:
pip install uv
Add the following configuration to your MCP.json file in VSCode or other AI IDE:
{
"mcpServers": {
"OfficeMCP": {
"type": "stdio",
"command": "uvx",
"args": [
"officemcp"
]
}
}
}
This setup allows multiple MCP clients to connect to a single OfficeMCP server:
Start the server with the default configuration:
uvx officemcp sse
This will start the server at http://127.0.0.1:8888/sse
with the default work folder at D:\@officemcp
Alternatively, customize the server configuration:
uvx officemcp sse --port 7777 --host 127.0.0.8 --folder D:\myfolder
Add the server configuration to your MCP.json file:
{
"servers": {
"OfficeMCP": {
"url": "http://127.0.0.1:8888/sse"
}
}
}
Or with custom settings:
{
"servers": {
"OfficeMCP": {
"url": "http://{your_host}:{your_port}/sse"
}
}
}
With OfficeMCP properly set up, you can ask your AI model to control Office applications:
The AI model will analyze your requests and use OfficeMCP's tools to execute the appropriate actions.
The RunPython tool is particularly powerful, allowing for detailed control of applications:
For Excel operations:
Officer.Excel.ActiveSheet.Cells(1, 1).Value = "Hello World"
For Visio drawing:
Officer.Visio.ActivePage.DrawRectangle(1, 1, 2, 2)
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.