Excel MCP Server

Excel MCP Server

一个 MCP 服务器,提供全面的 Excel 文件操作、数据分析和可视化功能,用于处理各种电子表格格式,如 XLSX、CSV 和 JSON。

Category
访问服务器

Tools

read_excel

Read an Excel file and return its contents as a string. Args: file_path: Path to the Excel file sheet_name: Name of the sheet to read (only for .xlsx, .xls) nrows: Maximum number of rows to read header: Row to use as header (0-indexed) Returns: String representation of the Excel data

write_excel

Write data to an Excel file. Args: file_path: Path to save the Excel file data: Data in CSV or JSON format sheet_name: Name of the sheet (for Excel files) format: Format of the input data ('csv' or 'json') Returns: Confirmation message

update_excel

Update an existing Excel file with new data. Args: file_path: Path to the Excel file to update data: New data in CSV or JSON format sheet_name: Name of the sheet to update (for Excel files) format: Format of the input data ('csv' or 'json') Returns: Confirmation message

analyze_excel

Perform statistical analysis on Excel data. Args: file_path: Path to the Excel file columns: Comma-separated list of columns to analyze (analyzes all numeric columns if None) sheet_name: Name of the sheet to analyze (for Excel files) Returns: JSON string with statistical analysis

filter_excel

Filter Excel data using a pandas query string. Args: file_path: Path to the Excel file query: Pandas query string (e.g., "Age > 30 and Department == 'Sales'") sheet_name: Name of the sheet to filter (for Excel files) Returns: Filtered data as string

pivot_table

Create a pivot table from Excel data. Args: file_path: Path to the Excel file index: Column to use as the pivot table index columns: Optional column to use as the pivot table columns values: Column to use as the pivot table values aggfunc: Aggregation function ('mean', 'sum', 'count', etc.) sheet_name: Name of the sheet to pivot (for Excel files) Returns: Pivot table as string

export_chart

Create a chart from Excel data and return as an image. Args: file_path: Path to the Excel file x_column: Column to use for x-axis y_column: Column to use for y-axis chart_type: Type of chart ('line', 'bar', 'scatter', 'hist') sheet_name: Name of the sheet to chart (for Excel files) Returns: Chart as image

data_summary

Generate a comprehensive summary of the data in an Excel file. Args: file_path: Path to the Excel file sheet_name: Name of the sheet to summarize (for Excel files) Returns: Comprehensive data summary as string

README

Excel MCP 服务器

一个提供全面 Excel 文件管理和数据分析功能的 MCP 服务器。

功能

  • Excel 文件操作

    • 读取多种 Excel 格式 (XLSX, XLS, CSV, TSV, JSON)
    • 写入和更新 Excel 文件
    • 获取文件信息和工作表名称
  • 数据分析

    • 汇总统计和描述性分析
    • 数据质量评估
    • 数据透视表
    • 过滤和查询数据
  • 可视化

    • 从 Excel 数据生成图表和绘图
    • 创建数据预览
    • 将可视化效果导出为图像

安装

  1. 创建一个新的 Python 环境 (推荐):
# 使用 uv (推荐)
uv init excel-mcp-server
cd excel-mcp-server
uv venv
source .venv/bin/activate  # 在 Windows 上: .venv\Scripts\activate

# 或者使用 pip
python -m venv .venv
source .venv/bin/activate  # 在 Windows 上: .venv\Scripts\activate
  1. 安装依赖:
# 使用 uv
uv pip install -r requirements.txt

# 或者使用 pip
pip install -r requirements.txt

与 Claude Desktop 集成

  1. 安装 Claude Desktop
  2. 打开设置并转到开发者选项卡
  3. 编辑 claude_desktop_config.json:
{
  "mcpServers": {
      "command": "uvx",
      "args": [
        "mcp-excel-server"
      ],
      "env": {
        "PYTHONPATH": "/path/to/your/python"
      }
  }
}

可用工具

文件读取

  • read_excel: 读取 Excel 文件
  • get_excel_info: 获取文件详细信息
  • get_sheet_names: 列出工作表名称

数据分析

  • analyze_excel: 执行统计分析
  • filter_excel: 按条件过滤数据
  • pivot_table: 创建数据透视表
  • data_summary: 生成全面的数据摘要

数据可视化

  • export_chart: 生成图表
    • 支持折线图、柱状图、散点图、直方图

文件操作

  • write_excel: 写入新的 Excel 文件
  • update_excel: 更新现有的 Excel 文件

可用资源

  • excel://{file_path}: 获取文件内容
  • excel://{file_path}/info: 获取文件结构信息
  • excel://{file_path}/preview: 生成数据预览图像

提示模板

  • analyze_excel_data: 用于 Excel 数据分析的引导式模板
  • create_chart: 帮助创建数据可视化
  • data_cleaning: 协助数据清理

使用示例

  • "分析我的 sales_data.xlsx 文件"
  • "为 product_sales.csv 创建一个柱状图"
  • "过滤 employees.xlsx 中 30 岁以上的员工"
  • "生成部门销售额的数据透视表"

安全注意事项

  • 仅从指定的路径读取文件
  • 限制文件大小
  • 防止意外的文件覆盖
  • 严格控制数据转换操作

依赖项

  • pandas
  • numpy
  • matplotlib
  • seaborn

许可证

MIT 许可证

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选