Excel to JSON MCP by WTSolutions Documentation

Excel to JSON MCP by WTSolutions Documentation

Introduction

The Excel to JSON MCP (Model Context Protocol) provides a standardized interface for converting Excel and CSV data into JSON format using the Model Context Protocol. This MCP implementation offers two specific tools for data conversion:

  • excel_to_json_mcp_from_data: Converts tab-separated or comma-separated text data
  • excel_to_json_mcp_from_url: Converts Excel from a provided URL

Server Config

{
  "mcpServers": {
    "excel_to_json_by_WTSolutions": {
      "args": [
        "mcp-remote",
        "https://mcp.wtsolutions.cn/excel-to-json-mcp-sse"
      ],
      "command": "npx",
      "tools": [
        "excel_to_json_mcp_from_data",
        "excel_to_json_mcp_from_url"
      ]
    }
  }
}

MCP Tools

excel_to_json_mcp_from_data

Converts tab-separated or comma-separated text data into JSON format.

Parameters
ParameterTypeRequiredDescription
datastringYesTab-separated or comma-separated text data with at least two rows (header row + data row)
Example Request
{
  "tool": "excel_to_json_mcp_from_data",
  "parameters": {
    "data": "Name\tAge\tIsStudent\nJohn Doe\t25\tfalse\nJane Smith\t30\ttrue"
  }
}

excel_to_json_mcp_from_url

Converts an Excel or CSV file from a provided URL into JSON format.

Parameters
ParameterTypeRequiredDescription
urlstringYesURL pointing to an Excel (.xlsx) or CSV file
Example Request
{
  "tool": "excel_to_json_mcp_from_url",
  "parameters": {
    "url": "https://example.com/path/to/your/file.xlsx"
  }
}

Response Format

The MCP tools return a JSON object with the following structure:

FieldTypeDescription
isErrorbooleanIndicates if there was an error processing the request
msgstring‘success’ or error description
datastringConverted data as array of sheet objects if using URL, string if using direct data, ‘’ if there was an error. Each sheet object contains ‘sheetName’ (string) and ‘data’ (array of objects) if using URL

Example Success Response

{
  "content": [{
    "type": "text",
    "text": "{\"isError\":false,\"msg\":\"success\",\"data\":\"[{\"Name\":\"John Doe\",\"Age\":25,\"IsStudent\":false},{\"Name\":\"Jane Smith\",\"Age\":30,\"IsStudent\":true}]\"}"
  }]
}

Data Type Handling

The API automatically detects and converts different data types:

  • Numbers: Converted to numeric values
  • Booleans: Recognizes ‘true’/‘false’ (case-insensitive) and converts to boolean values
  • Dates: Detects various date formats and converts them appropriately
  • Strings: Treated as string values
  • Empty values: Represented as empty strings

Requirements on data and url

excel_to_json_mcp_from_data

  • Input data must be tab-separated or comma-separated text with at least two rows (header row + data row).
    1. The first row will be considered as “header” row, and this API will use it as column names, subsequently JSON keys.
    2. The following rows will be considered as “data” rows, and this API will use them as JSON values.

excel_to_json_mcp_from_url

  • Each sheet of the Excel file should contain at least two rows (header row + data row).
    1. The first row will be considered as “header” row, and this API will use it as column names, subsequently JSON keys.
    2. The following rows will be considered as “data” rows, and this API will use them as JSON values.
  • This Excel file should be in ‘.xlsx’ format.
  • Each sheet of the Excel file will be converted to a JSON object.
  • Each JSON object will have ‘sheetName’ (string) and ‘data’ (array of objects) properties.
  • Each JSON object in ‘data’ array will have properties corresponding to column names.
  • Each JSON object in ‘data’ array will have values corresponding to cell values.

Error Handling

The API returns descriptive error messages for common issues:

  • Excel Data Format Invalid: When input data is not tab-separated or comma-separated
  • At least 2 rows are required: When input data has fewer than 2 rows
  • Both data and url received: When both ‘data’ and ‘url’ parameters are provided
  • Network Error when fetching file: When there’s an error downloading the file from the provided URL
  • File not found: When the file at the provided URL cannot be found
  • Blank/Null/Empty cells in the first row not allowed: When header row contains empty cells
  • Server Internal Error: When an unexpected error occurs

Pricing

Free for now.

Donation

https://buymeacoffee.com/wtsolutions

Documentation

https://s.wtsolutions.cn/excel-to-json-mcp.html

<think> 嗯,用户提到了Excel中的mcp内容,结合之前的引用可以看到这是关于MCP(多模型协作协议)在Excel数据处理中的应用案例。用户可能需要了解如何通过mcp-server将Excel表格转化为可视化HTML报告。 从引用[1][2]来看,excel-mcp-server的核心功能是自动化处理Excel数据并生成可视化报告,具体使用了cherry-studio和trae工具链。用户可能是个数据分析师或开发者,想简化报表生成流程。ta的提问比较开放,需要先解释基本概念再给实用指引。 考虑到用户可能遇到的痛点:引用[3]提到传统方式需要逐个对接工具,而MCP能一键调用Excel处理、quickchart可视化等服务。需要强调这个方案如何提升效率——比如财务人员无需写代码就能生成动态报表。 准备分三块回答:功能解读侧重自动化流程(从Excel输入到HTML输出),配置方法基于引用[2]的trae/cherry-studio操作步骤,最后给出典型应用场景。用户没有提到具体技术障碍,所以重点放在使用逻辑而非排错。 相关问题设计要考虑用户可能的延伸需求:引用[4]的Agent-LLM协作流程暗示了进阶功能(如自动数据分析),所以设置模型配置问题;另外新手可能关心部署门槛,单设优化成本问题。 </think> 根据引用内容,Excel中的MCP(多模型协作协议)指通过标准化协议实现Excel数据处理和可视化报告的自动化生成方案,以下是核心要点: --- ### **一、Excel-MCP的功能解析** 1. **自动化报告生成** - 将Excel原始数据**一键转换为交互式HTML报告**(含可视化图表) - 底层依赖工具链: `excel-mcp-server`(数据读取) + `quickchart-server`(图表生成)[^2] 2. **核心组件协作流程** ```mermaid graph LR A[Excel文件] --> B(excel-mcp-server) B --> C{数据处理} C --> D(quickchart-server) D --> E[HTML可视化报告] ``` 3. **权限与安全机制** - 细粒度权限控制(如限制文件读写范围) - 数据传输全程HTTPS加密,敏感字段自动脱敏[^3] --- ### **二、配置与使用方法** 1. **环境搭建步骤** - **STEP1** 在`trae`或`cherry-studio`中配置: ```bash sequential-thinking → server-filesystem → excel-mcp-server → quickchart-server ``` - **STEP2** 绑定智能体(Agent)并选择LLM模型(如GPT/Claude)[^2] 2. **请求参数示例(JSON-RPC 2.0)** ```json { "method": "tools/call", "params": { "name": "excel-to-html", "arguments": { "file_path": "/data/sales.xlsx", "chart_type": "bar" } } } ``` > 注:需严格匹配工具定义的参数结构[^3] 3. **触发执行方式** - Agent调度LLM生成请求 → MCP协议封装 → 调用工具链执行[^4] --- ### **三、典型应用场景** 1. **财务自动化报表** - 每日销售数据 → 自动生成带趋势图的HTML日报 2. **业务数据看板** - 库存Excel → 实时可视化库存热力图 3. **研究分析报告** - 实验数据 → 交互式统计分析报告[^2] --- ### **常见问题解决方案** | 问题类型 | 解决思路 | |---------|----------| | 数据读取失败 | 检查`server-filesystem`权限配置及文件路径白名单 | | 图表渲染异常 | 验证`quickchart-server`支持的图表类型参数 | | 协议解析错误 | 确保JSON-RPC请求严格遵循2.0标准[^3] | ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值