uv init mcp-server-demo
cd mcp-server-demo
uv add "mcp[cli]" uv pip install mcp-python pandas matplotlib openpyxl fastapi uvicorn pillow uv run mcp dev server.py
uv run mcp install server.py
Excel MCP Server
This project implements a Model Context Protocol (MCP) server that provides tools and resources for working with Excel data. The server offers functionality for reading, updating, filtering, and visualizing Excel data through a simple API.
Features
Excel Operations: Read from and write to Excel files
Data Filtering: Filter and search data based on various criteria
Data Analysis: Generate statistical summaries and pivot tables
Data Visualization: Create various charts and visualizations
Update Operations: Update cells, add rows, delete rows
Anomaly Detection: Find outliers in numeric data
Chart Recommendations: Automatically suggest appropriate visualizations
Installation
Install the required dependencies:
Clone this repository or download the files:
server.py
- The MCP server implementationclient.py
- Demo client to showcase the features
Usage
Starting the Server
Run the server:
The server will start at http://localhost:8000
by default.
Using the Client Demo
The client demo script showcases various operations you can perform with the MCP server:
This will:
Create a sample Excel file (if it doesn't exist)
Demonstrate basic Excel operations
Show data filtering capabilities
Generate visualizations
Perform data updates
Detect anomalies in the data
Using the API Directly
You can use the MCP server's API directly:
Tools API
Call tools using POST requests to /tools/{tool_name}
:
Resources API
Access resources using GET or POST requests to /resources/{resource_path}
:
Available Tools
Excel Operations
read_excel
- Read data from an Excel filewrite_excel
- Write data to an Excel fileget_excel_sheets
- Get the list of sheets in an Excel file
Data Filtering
filter_data
- Filter Excel data based on conditionssearch_data
- Search for a term in Excel data
Data Analysis
summarize_data
- Get statistical summary of Excel datacreate_pivot_table
- Create a pivot table from Excel data
Data Visualization
visualize_chart
- Create various chart types (bar, line, scatter, pie, hist)recommend_charts
- Get chart recommendations based on data structure
Update Operations
update_cell
- Update a specific cell in an Excel fileadd_row
- Add a new row to an Excel filedelete_rows
- Delete rows from an Excel file based on filters
Additional Features
detect_anomalies
- Find anomalies in numeric data using Z-scoresexport_to_csv
- Export Excel data to CSV format
Available Resources
excel://{filename}/sheets
- Get list of sheets in an Excel fileexcel://{filename}/sheet/{sheet_name}
- Get data from a specific sheetexcel://{filename}/sheet/{sheet_name}/summary
- Get summary of sheet dataexcel://{filename}/sheet/{sheet_name}/filter
- Filter data in a sheet
Example: Creating a Custom Client
You can create your own client to interact with the MCP server:
Integration with AI Models
This MCP server can be easily integrated with AI models like Claude to provide natural language interfaces to Excel data:
The AI can call the appropriate MCP tool based on the user's request
Process the data returned by the tool
Present insights and visualizations to the user
This creates an interactive "Excel assistant" that can understand natural language requests to analyze and manipulate Excel data.
This server cannot be installed
A Model Context Protocol server that provides tools for reading, updating, filtering, and visualizing Excel data through a simple API.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol (MCP) server that provides tools for reading Excel (xlsx) files, enabling extraction of data from entire workbooks or specific sheets with results returned in structured JSON format.Last updated -35Apache 2.0
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.Last updated -61,581520MIT License
- AsecurityAlicenseAqualityEnables seamless reading, writing, and analyzing of Excel files through Model Context Protocol, with features for worksheet management, structure analysis, and automated caching.Last updated -88541MIT License
- -securityAlicense-qualityA Model Context Protocol server that enables interaction with Microsoft 365 services (Excel, Calendar, Mail, OneDrive, Teams, etc.) through the Graph API, allowing AI assistants to manage Microsoft 365 resources via natural language.Last updated -2,782266MIT License