@xlvane/mcp

中文文档
1.2.2发布于 2026/11/03MITTypeScriptES Module构建来源已验证

MCP server for XLSX files: inspect, read, write, edit, convert, compare and validate workbooks with xlvane, limited to the directories given at start.

原始使用文档
文档目录5 节
  1. Start
  2. Tools
  3. Security
  4. API
  5. Links

@xlvane/mcp

An MCP (Model Context Protocol) server for XLSX files, built on xlvane and the official MCP TypeScript SDK (@modelcontextprotocol/server 2.4.0, protocol revision 2026-07-28). An MCP client, such as a coding agent, can inspect, read, compare and validate workbooks, and optionally write, edit and convert them, through tools instead of code.

Requires Node.js 22 or later. Dependencies: xlvane and @modelcontextprotocol/server (which brings @modelcontextprotocol/core and zod).

Start

npx @xlvane/mcp --root ./data                 # read-only, files inside ./data
npx @xlvane/mcp --root ./data --allow-write   # also write_table, edit_cells, convert
xlvane mcp --root ./data                      # the same server, through the xlvane CLI

Many MCP clients take a configuration like this one; check your client's documentation for its exact format and file:

{
  "mcpServers": {
    "xlvane": { "command": "npx", "args": ["@xlvane/mcp", "--root", "/absolute/path/to/data"] }
  }
}
OptionMeaning
--root <dir>A directory the tools may use; repeat for several. Required. Relative paths in tool calls are resolved against the first one.
--allow-writeAlso offer the tools that write files. Without it they are not registered at all.
--max-file-size <bytes>Largest file read or written. Default 64 MiB.
--max-rows <n>Largest number of rows one read_table call returns. Default 1000.
--max-response-chars <n>Largest tool result (also an error), in characters of its JSON text; the message carries the same data again as structuredContent. read_table returns the rows that fit (truncated, nextOffset); other tools return XLV_E_LIMIT_EXCEEDED. Default 1 Mi (1 048 576).

The server speaks MCP over stdin and stdout; messages for people go to stderr.

Tools

ToolWritesWhat it does
inspect_workbooknoSheets (also hidden ones), used ranges, header rows, column types with samples, merged cells, formulas, warnings.
read_tablenoRows of a sheet as objects keyed by the header row; paging with offset and limit; dates as ISO 8601.
diffnoCell-by-cell differences between two workbooks.
validatenoRead warnings, and column rules (name, type, optional) with the cell of each problem.
write_tableyesRows to a new XLSX file (report preset: bold header, frozen row, autofilter, widths).
edit_cellsyesSet cells and append rows, keeping the rest of the file unchanged.
convertyesXLSX to CSV/TSV/JSON and back; CSV output escapes formula-like text.

Every tool has a JSON Schema for its input and returns its result as structuredContent and as JSON text. Errors are tool results with isError: true and the XlvError data: a stable code, the location, a hint and details (docs/errors.md).

Security

  • Directories: files are read and written only inside the --root directories. Paths are checked after symbolic links are resolved, so .., absolute paths and links that lead outside are refused (XLV_E_PATH_NOT_ALLOWED). A file is checked again after it is opened (the path must still lead to the same file), so swapping it for a link meanwhile does not help. Writing through a symbolic link is refused. A path outside the roots gets the same answer whether or not something exists there. Only regular files are read.
  • Read-only by default: the write tools exist only with --allow-write. They create files exclusively and replace an existing file only when the call passes "overwrite": true, through a temporary file and a rename; the replacement keeps the file's permissions, and read-only files are not replaced. Any file name inside a root may be written, also dot files such as .gitignore; choose the roots accordingly.
  • Limits: files above --max-file-size are refused for reading and writing, and results above --max-response-chars are cut (read_table) or refused. The xlvane reader applies its limits for untrusted files (ZIP bombs, XML without DTDs or entities, the budgets of xlvane 1.1.1). validate lists at most 1 000 problems (problemsTotal counts all).
  • File content is data: values, sheet names and other text come from the files and may contain any text, also text meant to influence a model. The server returns it as data and does not interpret it.
  • No code execution: macros are never run, external links are never followed, and formulas are not calculated.

API

import { createServer, runCli } from '@xlvane/mcp';

createServer({ roots, allowWrite, maxFileBytes, maxRows, maxResponseChars }) returns an McpServer to connect to any transport; runCli(args) is the command line.

License: MIT. The MCP SDK is licensed under Apache-2.0.

版本与发布记录

@xlvane/mcp 共发布 4 个版本,首次发布于 2026/11/03;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.2.2latest2026/11/03今天
1.2.12026/11/03今天
1.2.02026/11/03今天
0.0.0-stage2026/11/03今天

关于 @xlvane/mcp 的常见问题

@xlvane/mcp 是什么?

用于XLSX文件的MCP服务器:检查,读取,写入,编辑,转换,比较和验证工作簿与xlvane,限制在开始时给定的目录。

如何安装 @xlvane/mcp?

在项目目录运行 npm install @xlvane/mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 xlvane-mcp,可以用 npx xlvane-mcp 直接运行。

@xlvane/mcp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@xlvane/mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@xlvane/mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@xlvane/mcp 可以商用吗?

@xlvane/mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@xlvane/mcp 还在维护吗?

最新版本 1.2.2 发布于 2026/11/03(今天);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/11/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。