Numbers表格服务器

一个用于读写Apple Numbers表格的MCP服务器,提供数据操作和样式设置功能。

  • by alexlock1
  • TypeScript
  • 本地部署
  • 10 星标
  • 更新于
在 GitHub 查看 alexlock1/apple-numbers-mcp

使用说明

MCP服务器编号

用于读取和写入Apple Numbers电子表格的MCP(模型上下文协议)服务器。

特性

  • 读取操作:获取表信息,获取分页行,查找条件灵活的行
  • 写入操作:更新行、添加行、删除行、每行使用不同值进行批量更新
  • 样式 (仅限macOS):设置行颜色,按列值着色行,自动检测现有配色方案

工具

工具 说明
numbers_get_info 快速浏览Numbers文件(工作表、标题、行数、预览)
numbers_get_table 通过可选的分页和列过滤获取表数据
numbers_find_rows 查找符合条件(相等、包含、gt、lt、gte、lte、ne)的行
numbers_update_rows 将符合条件的所有行更新为相同的值
numbers_add_row 向表中添加一行或多行
numbers_delete_rows 删除符合条件的行
numbers_batch_update 在一次操作中更新具有不同值的多行
numbers_set_row_color 设置特定行的背景颜色
numbers_color_rows_by_value 根据列的值(例如状态)为行着色
numbers_detect_color_mapping 从现有样式中自动检测配色方案

安装

克隆和构建:

git clone https://github.com/mycleaningfam/numbers-mcp-server.git
cd numbers-mcp-server
npm install
npm run build

配置

添加到您的MCP设置中(例如。, .mcp.json 或Claude桌面配置):

{
  "mcpServers": {
    "numbers": {
      "command": "node",
      "args": ["/path/to/numbers-mcp-server/dist/index.js"]
    }
  }
}

用法示例

获取表格概览

numbers_get_info({ filePath: "/path/to/file.numbers" })

查找有条件的行

numbers_find_rows({
  filePath: "/path/to/file.numbers",
  where: { Status: "In Progress" },
  columns: ["ID", "Task", "Status"],
  limit: 10
})

更新行

numbers_update_rows({
  filePath: "/path/to/file.numbers",
  where: { Status: "Done" },
  set: { Priority: "P1" }
})

使用不同值进行批量更新

numbers_batch_update({
  filePath: "/path/to/file.numbers",
  updates: [
    { where: { ID: 1 }, set: { Priority: "P0" } },
    { where: { ID: 2 }, set: { Priority: "P1" } },
    { where: { ID: 3 }, set: { Priority: "P2" } }
  ]
})

按状态为行着色

numbers_color_rows_by_value({
  filePath: "/path/to/file.numbers",
  column: "Status",
  colorMap: {
    "Done": { r: 144, g: 238, b: 144 },
    "In Progress": { r: 173, g: 216, b: 230 }
  }
})

需求

  • Node.js 18+
  • macOS(样式功能所需-使用AppleScript控制Numbers应用程序)
  • 已安装Numbers应用程序(用于样式功能)

运作原理

  • 阅读:使用SheetJS(xlsx)库解析.numbers文件
  • 写作:使用AppleScript通过Numbers应用程序更新单元格(SheetJS免费版无法写入.Numbers格式)
  • 样式:使用AppleScript通过Numbers应用程序自动化设置行背景颜色

许可证

麻省理工学院