Excel MCP Server

uv init mcp-server-demo
cd mcp-服务器-演示
uv 添加“mcp[cli]” uv pip 安装 mcp-python pandas matplotlib openpyxl fastapi uvicorn pill uv 运行 mcp dev server.py
uv 运行 mcp install server.py
Excel MCP 服务器
该项目实现了一个模型上下文协议 (MCP) 服务器,提供处理 Excel 数据的工具和资源。该服务器通过简单的 API 提供读取、更新、过滤和可视化 Excel 数据的功能。
特征
Excel 操作:读取和写入 Excel 文件
数据过滤:根据各种标准过滤和搜索数据
数据分析:生成统计摘要和数据透视表
数据可视化:创建各种图表和可视化
更新操作:更新单元格、添加行、删除行
异常检测:查找数值数据中的异常值
图表建议:自动建议合适的可视化效果
Related MCP server: Excel MCP Server
安装
安装所需的依赖项:
pip install mcp-python pandas matplotlib openpyxl fastapi uvicorn pillow克隆此存储库或下载文件:
server.py- MCP 服务器实现client.py- 演示客户端,展示功能
用法
启动服务器
运行服务器:
python server.py默认情况下,服务器将从http://localhost:8000启动。
使用客户端演示
客户端演示脚本展示了您可以使用 MCP 服务器执行的各种操作:
python client.py这将:
创建示例 Excel 文件(如果不存在)
演示基本的 Excel 操作
显示数据过滤功能
生成可视化效果
执行数据更新
检测数据中的异常
直接使用 API
您可以直接使用 MCP 服务器的 API:
工具 API
使用 POST 请求调用工具/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()资源 API
使用 GET 或 POST 请求访问/resources/{resource_path}的资源:
# Example: Get sheet list
response = requests.get("http://localhost:8000/resources/excel://example.xlsx/sheets")
sheets = response.json()可用工具
Excel 操作
read_excel- 从 Excel 文件读取数据write_excel- 将数据写入 Excel 文件get_excel_sheets- 获取 Excel 文件中的工作表列表
数据过滤
filter_data- 根据条件过滤 Excel 数据search_data- 在 Excel 数据中搜索术语
数据分析
summarize_data- 获取 Excel 数据的统计摘要create_pivot_table- 从 Excel 数据创建数据透视表
数据可视化
visualize_chart- 创建各种图表类型(条形图、折线图、散点图、饼图、直方图)recommend_charts- 根据数据结构获取图表推荐
更新操作
update_cell- 更新 Excel 文件中的特定单元格add_row向 Excel 文件添加新行delete_rows- 根据过滤器从 Excel 文件中删除行
附加功能
detect_anomalies- 使用 Z 分数查找数值数据中的异常export_to_csv- 将 Excel 数据导出为 CSV 格式
可用资源
excel://{filename}/sheets- 获取 Excel 文件中的工作表列表excel://{filename}/sheet/{sheet_name}- 从特定工作表获取数据excel://{filename}/sheet/{sheet_name}/summary- 获取工作表数据摘要excel://{filename}/sheet/{sheet_name}/filter- 过滤工作表中的数据
示例:创建自定义客户端
您可以创建自己的客户端来与 MCP 服务器进行交互:
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)与人工智能模型的集成
该 MCP 服务器可以轻松地与 Claude 等 AI 模型集成,为 Excel 数据提供自然语言接口:
AI可以根据用户的请求调用相应的MCP工具
处理工具返回的数据
向用户呈现见解和可视化效果
这就创建了一个交互式的“Excel 助手”,它可以理解自然语言请求来分析和操作 Excel 数据。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceA 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.36Apache 2.0
- AlicenseAqualityDmaintenanceA 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.614,8961,008MIT
- AlicenseBqualityCmaintenanceEnables seamless reading, writing, and analyzing of Excel files through Model Context Protocol, with features for worksheet management, structure analysis, and automated caching.85349MIT
- AlicenseBqualityAmaintenanceA 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.18841,593937MIT
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/TapanKumarBarik/PYTHON-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server