
Office
STDIOHTTP-SSEAI控制Windows系统Office应用程序
AI控制Windows系统Office应用程序
OfficeMCP server is designed for AI to automate Microsoft Office Applications (Word, Excel, PowerPoint, Access, OneNote, Visio, Project, WPS.word, Wps.powerpoint, wps.excel etc.) by COM interface in Windows OS. Not working on Linux/MacOS.
Please keep it in mind, as OfficeMCP not limit the usage of python. epeciall there's a tool RunPython(...) to execute python codes created by Ai model. But it is also the most wonderfull parts of OfficeMCP. we can't guarantee that your AI model will not do something bad to your computer. we don't take any responsibility.
Windows system
python 3.1 or above installed
uv installed open an shell window and run command
pip install uv
There are two ways or two modes to install OfficeMCP (They also can be used in the same time):
{ "mcpServers": { "OfficeMCP": { "type": "stdio", "command": "uvx", "args": [ "officemcp" ] } } }
Run one command in shell or power shell:
uvx officemcp sse
the Mcp server url will be: "http://127.0.0.1:8888/sse" or "http://127.0.0.1:8888/sse" the default work folder is D:@officemcp
uvx officemcp sse --port 7777 --host 127.0.0.8 --folder D:\myfolder
"url" will be : "http://127.0.0.8:7777/sse"
Put following setting to MCP.json file for vscode or some proper place for other AI IDE:
{ "servers": { "OfficeMCP": { "url": "http://127.0.0.1:8888/sse" } } }
{ "servers": { "OfficeMCP": { "url": "http://{your_host}:{your_port}/sse" } } }
On AI IDE, you can ask AI model to control Office Applications by OfficeMCP server:
You ask AI model to open a new Office Application. AI model will send a request to OfficeMCP server, and OfficeMCP server will open a new Office Application.
You ask AI model to do whatever you want to do in the current Office Application. AI model will analyze your request, and call OfficeMCP server's tool to accomplish your request.
Tools:
AvailableApps(): check if Microsoft Office applications are installed on your computer.
RunningApps(): get a list of currently running Office applications.
IsAppAvailable(...): check if a specific Office application is installed.
Launch(...): launch a new Office application and set its visibility.
Visible(...): set the specified Office application's visibility to True or False.
Quit(...): quit the specified Office application.
Demonstrate(): run a demonstration of OfficeMCP automation features.
Speak(...): speak a string you passed in.
Beep(...): play a beep sound.
DefaultFolder(...): return the OfficeMCP root work folder default is ("D:\OfficeMCP")
IsFileExists(sub_path): check if a file exists in the OfficeMCP root folder.
DownloadImage(...): download an image from a given URL and save it to the specified path.
RunPython(codes,data): run python code in the OfficeMCP server context.
Officer.Excel
holds the current Excel com Application, and more are Officer.Word, Officer.Powerpoint, Office.Visio, Officer.Access, Officer.OneNote, Officer.Visio, Officer.Project. Office.Kwps for WPS word, Office.Ket for WPS excell, Office.Kwpp for WPS powerpoint.More tools will be added in the future.
git clone https://github.com/officemcp/officemcp