JSON转Excel CSV by WTSolutions
JSON转Excel MCP(模型上下文协议)提供了一个标准化的接口,用于将JSON数据转换为CSV格式字符串。它包括两个工具:json_to_excel_mcp_from_data和json_to_excel_mcp_from_url,可以将JSON数据或来自URL的JSON文件转换为CSV格式。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"json_to_excel": {
"args": [
"mcp-remote",
"https://mcp2.wtsolutions.cn/sse",
"--transport",
"sse-only"
],
"command": "npx"
}
}
}
可用工具 (2 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
json_to_excel_mcp_from_data 1 个参数 需填 1 项
Convert JSON data to CSV data
必填参数:data
json_to_excel_mcp_from_url 1 个参数 需填 1 项
Convert JSON data from publicly accessible URL(.json format) to CSV data
必填参数:url
服务介绍
JSON 到 Excel MCP 由 WTSolutions 提供
简介
JSON 到 Excel MCP(Model Context Protocol)提供了一个标准化的接口,用于通过 Model Context Protocol 将 JSON 数据转换为 CSV 格式的字符串。此 MCP 实现提供了两个特定的数据转换工具:
- json_to_excel_mcp_from_data: 将 JSON 数据字符串转换为 CSV 格式。
- json_to_excel_mcp_from_url: 将从提供的 URL 获取的 JSON 文件(.json 格式)转换为 CSV 格式的字符串。
JSON 到 Excel MCP 是 WTSolutions 的 JSON 到 Excel 工具包的一部分:
- JSON 到 Excel Web 应用:直接在 Web 浏览器中将 JSON 转换为 Excel。
- JSON 到 Excel Excel 插件:在 Excel 中将 JSON 转换为 Excel,与 Excel 环境无缝集成。
- JSON 到 Excel API:通过 HTTPS POST 请求将 JSON 转换为 Excel。
- JSON 到 Excel MCP 服务:通过 AI 模型 MCP SSE/StreamableHTTP 请求将 JSON 转换为 Excel。 (<-- 您在这里。)
服务器配置
可用的 MCP 服务器(SSE 和 Streamable HTTP):
使用 Stdio (NPX)
服务器配置 JSON:
{
"mcpServers": {
"json_to_excel": {
"args": [
"mcp-remote",
"https://mcp2.wtsolutions.cn/sse",
"--transport",
"sse-only"
],
"command": "npx"
}
}
}
使用 SSE
传输方式: SSE
URL: https://mcp2.wtsolutions.cn/sse
服务器配置 JSON:
{
"mcpServers": {
"json2excelsse": {
"type": "sse",
"url": "https://mcp2.wtsolutions.cn/sse"
}
}
}
使用 Streamable HTTP
传输方式: Streamable HTTP
URL: https://mcp2.wtsolutions.cn/mcp
服务器配置 JSON:
{
"mcpServers": {
"json2excelmcp": {
"type": "streamableHttp",
"url": "https://mcp2.wtsolutions.cn/mcp"
}
}
}
MCP 工具
json_to_excel_mcp_from_data
将 JSON 数据字符串转换为 CSV 格式的字符串。
参数
| 参数 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| data | string | 是 | 需要转换为 CSV 的 JSON 数据字符串。必须是有效的 JSON 数组或对象。 |
注意:
- 输入数据必须是有效的 JSON 字符串。验证器可在 JSON 到 Excel Web 应用 上找到。
- 如果 JSON 是对象数组,则每个对象将被视为 CSV 中的一行。
- 如果 JSON 是单个对象,则它将被转换为包含键值对的 CSV。
- CSV 将基于 JSON 对象中的键包括表头。
- 此工具返回可以轻松转换/导入到 Excel 的 CSV 格式数据。
示例提示 1:
将以下 JSON 数据转换为 CSV 格式:
json
[
{"Name": "John Doe", "Age": 25, "IsStudent": false},
{"Name": "Jane Smith", "Age": 30, "IsStudent": true}
]
示例提示 2:
将以下 JSON 对象转换为 CSV 格式:
json
{
"Name": "John Doe",
"Age": 25,
"IsStudent": false,
"Courses": ["Math", "Science"]
}
json_to_excel_mcp_from_url
将从提供的 URL 获取的 JSON 数据转换为 Excel 数据。
参数
| 参数 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| url | string | 是 | 指向 JSON 文件(.json 格式)的 URL |
注意:
- URL 应该是公开可访问的。
- JSON 文件应为 .json 格式。
- JSON 文件应包含有效的 JSON 数组或对象。验证器可在 JSON 到 Excel Web 应用 上找到。
- 如果 JSON 是对象数组,则每个对象将被视为 CSV 中的一行。> - 如果 JSON 是单个对象,它将被转换为包含键值对的 CSV。
- 该工具返回易于转换/导入到 Excel 的 CSV 格式数据。
示例提示 1
将 JSON 文件转换为 Excel,文件 URL: https://mcp.wtsolutions.cn/example.json
示例提示 2
(仅在没有 URL 并且与在线 AI LLM 一起工作时适用)
我刚刚上传了一个 .json 文件给你,请提取其 URL 并发送给 MCP 工具 'json_to_excel_mcp_from_url',以进行 JSON 到 Excel 的转换。
响应格式
MCP 工具返回具有以下结构的 JSON 对象:
| 字段 | 类型 | 描述 |
|---|---|---|
| isError | boolean | 表示请求处理过程中是否有错误 |
| msg | string | 'success' 或错误描述 |
| data | string | 转换后的 CSV 数据字符串,如果有错误则为空。此 CSV 数据可以轻松导入到 Excel 中。 |
成功响应示例
json
{
"content": [{
"type": "text",
"text": "{"isError":false,"msg":"success","data":"Name,Age,IsStudent\nJohn Doe,25,false\nJane Smith,30,true"}"
}]
}
以上是来自 MCP 工具的响应,在大多数情况下,您的 LLM 应该解释响应并为您提供一个 JSON 对象,例如下面所示。
注意,不同的 LLM 模型可能有不同的方式来解释 JSON 对象,请检查您的 LLM 模型是否正确解释了 JSON 对象。
json
{
"isError": false,
"msg": "success",
"data": "Name,Age,IsStudent\nJohn Doe,25,false\nJane Smith,30,true"
}
失败响应示例
json
{
"content": [{
"type": "text",
"text": "{"isError": true, "msg": "Invalid JSON format", "data": ""}"
}]
}
以上是来自 MCP 工具的响应,在大多数情况下,您的 LLM 应该解释响应并为您提供一个 JSON 对象,例如下面所示。
注意,不同的 LLM 模型可能有不同的方式来解释 JSON 对象,请检查您的 LLM 模型是否正确解释了响应。
json
{
"isError": true,
"msg": "Invalid JSON format",
"data": ""
}
或者您的 LLM 也可能会告诉您“无效的 JSON 格式,请提供有效的 JSON 字符串”。
数据类型处理
API 自动处理 JSON 中的不同数据类型:
- 数字:转换为 CSV 中的数值
- 布尔值:转换为 'true'/'false' 字符串
- 字符串:必要时转义并加引号
- 数组:转换为 JSON.stringify 数组字符串
- 对象:转换为 JSON.stringify 对象字符串
错误处理
MCP 为常见问题返回描述性错误消息:
Invalid JSON format:当输入数据不是有效的 JSON 字符串时Empty JSON data:当输入数据是空的 JSON 字符串时Network Error when fetching file:当从提供的 URL 下载文件时发生错误时File not found:当提供的 URL 中找不到文件时Server Internal Error:当发生意外错误时
服务协议和隐私政策
通过使用 JSON 到 Excel MCP,您同意 服务协议 和 隐私政策。
定价
目前免费。