Sponsored by Deepsite.site

C++ Excel Automation MCP Server

Created By
AstroTeng7 months ago
A MCP server coded in Cpp and gives the AI the ability to modify Excel related files
Content

C++ Excel Automation MCP Server

This is a C++-based Excel automation MCP (Model Context Protocol) server project. It leverages the OpenXLSX library for Excel file operations and uses spdlog for logging. The project aims to provide a set of programmable Excel manipulation tools via the MCP protocol.

Table of Contents

Building the Project

This project uses CMake as its build system, and it is recommended to use Ninja as the generator for compilation.

Prerequisites

Before compiling, please ensure the following tools are installed on your system:

  • C++ Compiler: A C++17 compliant compiler (e.g., GCC, Clang, MSVC).
  • CMake: Version 3.15 or higher.
  • Ninja: A fast build system.

Getting Submodules

This project uses Git submodules for its external libraries. After cloning the repository, you need to initialize and update these submodules:

git submodule update --init --recursive

Compilation Steps

  1. Generate Build Files(Ninja should be installed first for fast compile):

    cmake -G "Ninja" -S . -B build
    

    This command tells CMake to generate Ninja build files in a build directory. If you are on Windows using Visual Studio, you might consider using cmake -G "Visual Studio 17 2022" -S . -B build (or your installed Visual Studio version).

  2. Compile the Project:

    cmake --build build
    

    This command will compile the project using the generated build files in the build directory. The executable is typically located in the build/bin/ directory.

Usage

After compilation, this project generates an executable that runs as an MCP server.

Running the Server

In the build/bin/ directory, you will find the executable. The name and extension of the executable will vary depending on your operating system (e.g., ExcelAutoCpp.exe on Windows, ExcelAutoCpp on Linux/macOS). Run this file to start the MCP server:

./bin/ExcelAutoCpp

And when this shows up, it means the server is ready to provide the funciton:


 ░█▀▀░█░█░█▀▀░█▀▀░█░░░█▀█░█░█░▀█▀░█▀█
 ░█▀▀░▄▀▄░█░░░█▀▀░█░░░█▀█░█░█░░█░░█░█
 ░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀▀▀
 v0.0.1                  

I(12:17:38) Starting MCP server at localhost:8888       
I(12:17:38) Press Ctrl+C to stop the server

MCP Server Capabilities

This project functions as an MCP server. Its capabilities are defined by its configuration. For a detailed understanding of the tools it provides and how to interact with them, refer to the following server configuration:

{
  "mcpServers": {
    "excel-auto-cpp": {
      "url": "http://localhost:8888/sse",
      "disabled": false,
      "timeout": 15
    }
  }
}

You can connect to this server using any MCP-compatible client (e.g., Roo, cline, Claude, or other custom applications/integrated environments) and invoke these tools to automate Excel operations.

Provided Tools

This MCP server provides the following tools for Excel automation:

open_excel_and_list_sheets

  • Description: Open an Excel file and list all sheet names. This tool will also set the current Excel file path for subsequent operations. It is recommended to run this tool first before any operation or if you want to change the file to modify.
  • Parameters:
    • file_path (string): The full path to the Excel file.

get_sheet_range_content

  • Description: Get and output table content within a specified range in a specific sheet. Automatically opens and closes the Excel file.
  • Parameters:
    • sheet_name (string): The name of the sheet to read from.
    • first_row (number): The starting row number (1-indexed).
    • first_column (number): The starting column number (1-indexed).
    • last_row (number): The ending row number (1-indexed).
    • last_column (number): The ending column number (1-indexed).

set_sheet_range_content

  • Description: Set table content within a specified range in a specific sheet. Automatically opens and closes the Excel file.
  • Parameters:
    • sheet_name (string): The name of the sheet to write to.
    • first_row (number): The starting row number (1-indexed).
    • first_column (number): The starting column number (1-indexed).
    • values (array of array of object): The 2D array of values to write to the range.

create_xlsx_file

  • Description: Create a new xlsx file with the given path. Automatically closes the Excel file after creation.
  • Parameters:
    • file_path (string): The path with which the file should be created.

Star History

Star History Chart

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
CursorThe AI Code Editor
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
DeepChatYour AI Partner on Desktop
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
WindsurfThe new purpose-built IDE to harness magic
Playwright McpPlaywright MCP server
Serper MCP ServerA Serper MCP Server
Tavily Mcp
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.