这是一个Model Context Protocol (MCP) 服务器,提供Excel文件读取功能,可用于Cursor等支持MCP的AI助手工具。
在使用之前,确保已安装以下依赖:
- Python 3.6+
- Node.js 12+
- 以下Python包:
pip install pandas fastapi mcp-server
# 全局安装
npm install -g .
# 运行
excel-mcp-server
npx .
在Cursor的配置文件中添加以下内容:
{
"mcpServers": {
"excel-reader": {
"command": "npx",
"args": [
"excel-mcp-server"
]
}
}
}
对于Windows用户,如果遇到npx问题,可以使用以下替代配置:
{
"mcpServers": {
"excel-reader": {
"command": "node",
"args": [
"路径到你的项目/index.js"
]
}
}
}
或者直接使用Python:
{
"mcpServers": {
"excel-reader": {
"command": "python",
"args": [
"路径到你的项目/read_file_server.py"
]
}
}
}
- 读取Excel文件内容 (read_excel_file)
- 获取Excel文件的工作表列表 (list_excel_sheets)
- 查询Excel数据 (query_excel_data)