Excel MCP Server
A Model Context Protocol server that provides tools for reading, updating, filtering, and visualizing Excel data through a simple API.
README

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:
pip install mcp-python pandas matplotlib openpyxl fastapi uvicorn pillow
- 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:
python server.py
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:
python client.py
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}:
import requests
# Example: Read Excel file
response = requests.post(
"http://localhost:8000/tools/read_excel",
json={"filename": "example.xlsx", "sheet_name": "Sheet1"}
)
data = response.json()
Resources API
Access resources using GET or POST requests to /resources/{resource_path}:
# Example: Get sheet list
response = requests.get("http://localhost:8000/resources/excel://example.xlsx/sheets")
sheets = response.json()
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:
import requests
def call_tool(tool_name, params):
"""Call an MCP tool"""
url = f"http://localhost:8000/tools/{tool_name}"
response = requests.post(url, json=params)
return response.json()
# Example: Get chart visualization
chart_result = call_tool("visualize_chart", {
"filename": "sales_data.xlsx",
"sheet_name": "Sheet1",
"chart_type": "bar",
"x_column": "Month",
"y_columns": ["Revenue"],
"title": "Monthly Revenue"
})
# Save chart image
if chart_result.get("success", False) and "image" in chart_result:
import base64
img_data = base64.b64decode(chart_result["image"])
with open("revenue_chart.png", "wb") as f:
f.write(img_data)
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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。