← mcp-excel

mcp-excel 0.1.0

npm · mcp-excel · current release

15
Tools
0
Resources
0
Templates
0
Prompts

Observation

Observed 2026-08-22T19:17:44.980Z using mcpSecurity-inventory. Status: succeeded. Negotiated protocol: 2025-06-18.

Server capabilities
{
  "tools": {
    "listChanged": true
  }
}

Tools 15

ToolCategoryAnnotationsRisk
add_sheet在已有文件中追加一张空工作表。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 31,
      "pattern": "^[^\\[\\]\\:\\*\\?\\/\\\\]+$",
      "description": "工作表名称,1~31 个字符,不能包含 [ ] : * ? / \\"
    }
  },
  "required": [
    "filePath",
    "sheetName"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
create_workbook从无到有新建一个 .xlsx 文件。可指定初始工作表名列表。文件已存在时会失败(防误覆盖),不会清空已有文件。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheets": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 31,
        "pattern": "^[^\\[\\]\\:\\*\\?\\/\\\\]+$",
        "description": "工作表名称,1~31 个字符,不能包含 [ ] : * ? / \\"
      },
      "minItems": 1
    }
  },
  "required": [
    "filePath"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
dedupe_range删除区域内 keyColumns 完全相同的重复行,只保留第一次出现的行(会修改文件)。被删的行变为空白行,区域外的内容不会被移动。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "range": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+$",
      "description": "矩形区域,如 `A1:D20`"
    },
    "keyColumns": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "minItems": 1
    },
    "hasHeader": {
      "type": "boolean"
    }
  },
  "required": [
    "filePath",
    "sheetName",
    "range",
    "keyColumns"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
delete_sheet删除指定工作表。不能删除最后一张。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 31,
      "pattern": "^[^\\[\\]\\:\\*\\?\\/\\\\]+$",
      "description": "工作表名称,1~31 个字符,不能包含 [ ] : * ? / \\"
    }
  },
  "required": [
    "filePath",
    "sheetName"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
filter_range按条件筛选区域中的行并返回结果,不修改文件。多个条件为'并且'关系。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "range": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+$",
      "description": "矩形区域,如 `A1:D20`"
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "column": {
            "type": "string",
            "minLength": 1
          },
          "op": {
            "type": "string",
            "enum": [
              "=",
              "!=",
              ">",
              ">=",
              "<",
              "<=",
              "contains"
            ]
          },
          "value": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "required": [
          "column",
          "op",
          "value"
        ],
        "additionalProperties": false
      },
      "minItems": 1
    },
    "hasHeader": {
      "type": "boolean"
    }
  },
  "required": [
    "filePath",
    "sheetName",
    "range",
    "conditions"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
format_cells设置一个区域的字体、填充色、边框、对齐、数字格式,让表格好看。只传想改的项,没传的不动。csv 文件不支持样式。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "range": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+$",
      "description": "矩形区域,如 `A1:D20`"
    },
    "style": {
      "type": "object",
      "properties": {
        "font": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "size": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "bold": {
              "type": "boolean"
            },
            "italic": {
              "type": "boolean"
            },
            "color": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "fill": {
          "type": "object",
          "properties": {
            "color": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "border": {
          "type": "object",
          "properties": {
            "style": {
              "type": "string",
              "enum": [
                "thin",
                "medium",
                "thick"
              ]
            },
            "color": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "alignment": {
          "type": "object",
          "properties": {
            "horizontal": {
              "type": "string",
              "enum": [
                "left",
                "center",
                "right"
              ]
            },
            "vertical": {
              "type": "string",
              "enum": [
                "top",
                "middle",
                "bottom"
              ]
            },
            "wrapText": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "numberFormat": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "filePath",
    "sheetName",
    "range",
    "style"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
insert_image把一张本地图片(png / jpg / gif)插入工作表,图片左上角锚定在 anchorCell。width/height 为像素,不传给默认 300×200——比例不对时请显式传这两个值。csv 不支持插图。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "imagePath": {
      "type": "string",
      "minLength": 1
    },
    "anchorCell": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+$",
      "description": "单元格地址,如 `B5`"
    },
    "width": {
      "type": "number",
      "exclusiveMinimum": 0
    },
    "height": {
      "type": "number",
      "exclusiveMinimum": 0
    }
  },
  "required": [
    "filePath",
    "sheetName",
    "imagePath",
    "anchorCell"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
list_sheets查看一个 Excel 文件里有哪些工作表,各有多少行多少列。动手读/写之前可以先调它确认表名。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    }
  },
  "required": [
    "filePath"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
merge_cells把一个矩形区域合并成一个单元格,内容保留左上角的值。常用于标题行。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "range": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+$",
      "description": "矩形区域,如 `A1:D20`"
    }
  },
  "required": [
    "filePath",
    "sheetName",
    "range"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
read_range读取一张工作表的内容,返回二维数组。不传 range 则读整张表;表很大时建议先传 range 读一部分(如前 50 行)了解结构。空单元格为 null,日期为 ISO 字符串。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "range": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+$",
      "description": "矩形区域,如 `A1:D20`"
    }
  },
  "required": [
    "filePath"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
rename_sheet修改工作表名称。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "oldName": {
      "type": "string",
      "minLength": 1
    },
    "newName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 31,
      "pattern": "^[^\\[\\]\\:\\*\\?\\/\\\\]+$",
      "description": "工作表名称,1~31 个字符,不能包含 [ ] : * ? / \\"
    }
  },
  "required": [
    "filePath",
    "oldName",
    "newName"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
set_dimensions设置工作表的列宽和/或行高,让表格排版合适。列宽单位是字符数(Excel 默认约 8.43),行高单位是磅(默认约 15)。columns 和 rows 至少传一个。csv 不支持。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "columns": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "column": {
            "type": "string",
            "pattern": "^[A-Za-z]+$",
            "description": "列字母,如 `B`,不区分大小写"
          },
          "width": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "列宽,单位字符数,如 16"
          }
        },
        "required": [
          "column",
          "width"
        ],
        "additionalProperties": false
      },
      "minItems": 1
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "row": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "description": "行号,1 起始"
          },
          "height": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "行高,单位磅,如 24"
          }
        },
        "required": [
          "row",
          "height"
        ],
        "additionalProperties": false
      },
      "minItems": 1
    }
  },
  "required": [
    "filePath",
    "sheetName"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
set_formula在指定单元格写入 Excel 公式,如 `SUM(A1:A10)`,可带或不带开头的 `=`。注意:公式要等用户在 Excel/WPS 里打开文件后才会计算出结果,本工具读该格会得到 null。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "cell": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+$",
      "description": "单元格地址,如 `B5`"
    },
    "formula": {
      "type": "string",
      "minLength": 1,
      "description": "公式文本,如 `SUM(A1:A10)` 或 `=AVERAGE(B2:B30)`"
    }
  },
  "required": [
    "filePath",
    "sheetName",
    "cell",
    "formula"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
sort_range对一个区域按某列排序(会修改文件)。区域外的内容不动。有表头时传 hasHeader: true 并用表头名指定列更稳妥。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "range": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+$",
      "description": "矩形区域,如 `A1:D20`"
    },
    "keyColumn": {
      "type": "string",
      "minLength": 1
    },
    "order": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "hasHeader": {
      "type": "boolean"
    }
  },
  "required": [
    "filePath",
    "sheetName",
    "range",
    "keyColumn",
    "order"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —
write_range从 startCell 开始写入一个二维数组(先行后列)。一个格子就传 `[[值]]`;一大片就传多行多列。值为 null 会清空对应单元格。字符串不会被套公式——要写公式请用 set_formula。目标工作表必须已存在(没有就先用 add_sheet)。
Input schema
{
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string",
      "minLength": 1,
      "description": "Excel 文件的绝对路径,例如 `C:\\Users\\xx\\报表.xlsx` 或 `/Users/xx/报表.xlsx`。支持 .xlsx / .xls / .csv"
    },
    "sheetName": {
      "type": "string",
      "minLength": 1
    },
    "startCell": {
      "type": "string",
      "pattern": "^[A-Za-z]+[0-9]+$",
      "description": "单元格地址,如 `B5`"
    },
    "values": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "type": [
            "string",
            "number",
            "boolean",
            "null"
          ]
        }
      },
      "minItems": 1,
      "description": "二维数组,每个内层数组是一行。`null` 表示清空该单元格"
    }
  },
  "required": [
    "filePath",
    "sheetName",
    "startCell",
    "values"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
— · —

Resources 0

Resource templates 0

Prompts 0

Let’s talk about MCP security.

Share your details and our security team will contact you.