
Csvbox Mcp Server
io.github.csvbox-io由 GitHub 账号 csvbox-io 发布v1.0.1更新于 Oct 24, 2026
CSVBox MCP server for creating, updating, validating and generating CSVBox importer sheets.
概览
CSVBox MCP 服务器,让助手创建、替换、局部更新、校验并生成 CSVBox 导入表及其集成代码。
- 可以做什么
- 通过 CSVBox API 创建、整体替换或局部更新导入表
- 用自然语言提示生成完整表结构,可用服务端 LLM 密钥,也可用由宿主客户端模型执行的 MCP 提示
- 在本地校验表结构,支持 create、put、patch 三种模式
- 生成 vanilla JS、React、Vue 或 Angular 的集成代码
- 起草虚拟列、校验函数和数据转换的 JavaScript 代码供人工审阅
- 适用场景
- 适合在搭建或维护 CSVBox 导入表时使用:让助手根据描述起草表结构、发送前先做校验,并在不手写 JSON 的情况下修改线上导入表。
- 运行要求
- 以 stdio 方式在本机运行,通常通过 npx 使用 npm 包 @csvbox/mcp-server(需要 Node.js)。调用 API 的工具需要 CSVBOX_API_KEY 和 CSVBOX_API_SECRET;validate_schema 与 generate_import_code 无需凭据。提示生成表结构需要 ANTHROPIC_API_KEY 或 OPENAI_API_KEY,或在自带模型的客户端中使用无需密钥的 MCP 提示方式。需要访问 CSVBox API 和所选 LLM 服务的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 Csvbox Mcp Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
csvbox-mcp-server
A universal Model Context Protocol (MCP) server for CSVBox. It exposes CSVBox importer-sheet management as MCP tools so you can create, replace, patch, generate, validate, and scaffold importers from any MCP-compatible client — Claude Desktop, Cursor, Windsurf, Roo Code, Cline, VS Code, ChatGPT MCP, and more.
Runs over stdio, so it works the same way in every client.
Tools
CSVBox currently has no GET or LIST endpoints, so there are intentionally no
get_sheet/list_sheettools.
It also exposes two MCP prompts:
Prompt → sheet generation
generate_sheet_json and create_importer_from_prompt use an LLM to convert a free-form request into a complete CSVBox sheet — title, sheet_columns, destinations, webhooks, security_settings, and steps. Only actual data fields become columns; destinations, webhooks, domains, regions, file-upload and step settings are placed in their proper configuration sections, never turned into columns. There are three tiers:
- Server LLM — when
ANTHROPIC_API_KEYorOPENAI_API_KEYis set, the server calls the LLM directly. Works in MCP Inspector and headless. - MCP prompt (
create_csvbox_sheet) — when you have no server key, host clients (Cursor, Claude Desktop, Cline) run the generation with their own model, then callvalidate_schemaandcreate_sheet. Free. - None configured —
generate_sheet_jsonreturns a structured "no LLM provider configured" error pointing to the MCP prompt, andcreate_importer_from_promptdoes not call the CSVBox API. There is no regex fallback.
Category / module expansion
The generator runs in one of two modes, chosen automatically from the prompt:
- Extraction (default) — the prompt names concrete fields (e.g. "columns name, email, phone"). Only those become columns; nothing is invented.
- Expansion — the prompt names business modules / categories as a list (e.g. "modules for: Company Information, Suppliers, Payroll, Invoice"), asks for a comprehensive/detailed schema, or asks for a column count ("at least 100 columns"). Each named module is expanded into several realistic, prefixed, correctly-typed columns (e.g. Suppliers →
supplier_id,supplier_name,supplier_gstin,supplier_email, …). An explicit minimum count is honored and everycolumn_nameis globally unique.
Data types and validations are inferred from the field names and any requested types:
Large schemas: the default models (
claude-haiku-4-5,gpt-4o-mini) are cheap but produce noticeably better 100+ column schemas when you override with a stronger model viaLLM_MODEL(e.g.claude-sonnet-4-6). The output cap is raised to fit big sheets; if a request is still too large the response is flaggedTRUNCATED(a distinct result, not a parse error) and the CSVBox API is not called — reduce the column count / modules or use a model with a larger output budget and retry.
Function collections (virtual columns, validation functions, data transforms)
Beyond the six sheet properties, the CSVBox Sheet API accepts three collections whose items carry a js_code string that CSVBox executes during an import:
Inside js_code the csvbox object exposes row, column, virtual, user, import, and environment. The two accessors are not interchangeable — a virtual column is per-row and uses csvbox.row.<name> (a scalar), while a "column"-scoped function sees the whole column via csvbox.column.<name> (an array).
Shared optional fields: scope (column | row; not on virtual columns), run_at (before_validation | after_validation; data transforms only), columns / dynamic_columns, active, dependencies, and _delete (PATCH only).
Authoring them
Returns { "virtual_columns": [...], "validation_functions": [...], "source": ..., "validation": {...} }. Collections the request does not imply are omitted, never returned as empty arrays.
This tool does not call the CSVBox API. Read the generated js_code, then apply it yourself with patch_sheet. Pass sheet so the model references real column names and the validator can check those references — CSVBox has no read endpoint, so it must be supplied inline. Without an LLM key, use the csvbox_sheet_functions MCP prompt instead.
PUT vs PATCH — read this before applying
Use patch_sheet to apply generated functions. Validate first with the matching verb:
mode is create (default), put, or patch. It only affects the function collections — under put an empty array is a hard error rather than a warning, and _delete is rejected outside patch.
Dependencies
An item may load up to 5 third-party scripts:
Only cdn.jsdelivr.net, unpkg.com, and cdnjs.cloudflare.com are allowed; https only, .js/.mjs path, no query string, fragment, userinfo, or port.
Security. This server never executes
js_code— it is an opaque string here. Generated JavaScript is unreviewed model output, so read it before you PATCH it into a live importer. A dependency without anintegritydigest can change under your customers at any time;validate_schemawarns when one is missing.
See docs/sheet-functions-example.json for a full payload.
Installation
Or build from source:
This produces dist/index.js — the entrypoint MCP clients launch.
Environment variables
Copy .env.example to .env and fill in your CSVBox credentials:
CSVBox credentials are only required for the API-backed tools (create_sheet, update_sheet, patch_sheet, create_importer_from_prompt). validate_schema and generate_import_code work without any credentials.
Auth header note: the client sends
x-csvbox-api-keyandx-csvbox-secret-api-key(matching the CSVBox reference payloads). These are defined as constants insrc/services/csvbox-api.tsif your account uses different header names.
Client identification
Every request this server sends to the CSVBox API carries two extra headers:
CSVBox records how each sheet was created; without these, sheets and imports made through MCP are indistinguishable from any other REST caller. The version is read from package.json and is the same one the server advertises to your MCP client, so the two can never disagree.
These are always sent — there is no environment variable or tool input that disables or changes them. They carry no credentials and nothing derived from your tool inputs. Tools that make no API call (generate_sheet_json, generate_sheet_functions, generate_import_code, validate_schema) send no request and therefore no headers.
LLM provider (for prompt → sheet generation)
generate_sheet_json and create_importer_from_prompt need an LLM. Set one of:
The provider is auto-detected:
LLM_PROVIDER disambiguates when both keys are present; LLM_MODEL overrides the model for whichever provider is chosen. For large category/module schemas (100+ columns) set LLM_MODEL to a stronger model (e.g. claude-sonnet-4-6) — see Category / module expansion.
MCP Inspector: set the LLM key in the Inspector's environment-variables panel to use the server-LLM path. Inspector has no host LLM of its own, so it can render the
create_csvbox_sheetprompt but cannot execute it — for the keyless path use a client with a model (Cursor, Claude Desktop, Cline).
Running locally
The server speaks MCP over stdio and logs csvbox-mcp-server running on stdio to stderr (stdout is reserved for the protocol).
Client configuration
For a published installation, use the npm package with npx. Set CSVBOX_API_KEY / CSVBOX_API_SECRET in the env block.
Note: The npm package is
@csvbox/mcp-serverand the executable iscsvbox-mcp-server.
Claude Desktop
Add the following to your Claude Desktop MCP configuration:
Cursor
Edit ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):
Windsurf
Edit ~/.codeium/windsurf/mcp_config.json:
Roo Code
In the Roo Code MCP settings (mcp_settings.json):
Cline
In the Cline MCP settings (cline_mcp_settings.json):
VS Code MCP
Add to .vscode/mcp.json (or the global mcp.json):
Example tool calls
Generate a complete sheet from a prompt (LLM, no CSVBox API call):
Returns { "sheet": { "title": ..., "sheet_columns": [...], "destinations": [...], "steps": {...} }, "source": "llm:anthropic:claude-haiku-4-5", "validation": { "valid": true, ... } }. Data fields become columns (salary → currency, joining date → date); the destination and xlsx setting go to destinations / steps, not columns. With no LLM key, returns an error pointing to the create_csvbox_sheet prompt.
Validate a schema before sending it:
Returns { "valid": true, "errors": [], "warnings": [ ... ] }.
Create a sheet:
Generate + create in one step:
Returns { "generated_schema": { ... }, "source": ..., "validation": { ... }, "api_response": { ... } }. Aborts without calling the API if no LLM provider is configured or the generated schema fails validation.
Replace a sheet:
Destructive for any collection you send — see PUT vs PATCH.
Patch a sheet:
Remove one function without touching the rest:
Generate integration code:
Supported column types
text, number, email, date, time, boolean, regex, ip, url, credit_card, phone_number, currency, list, dependent_list, dynamic_list, dependent_dynamic_list, multiselect_list, multiselect_dynamic_list.
Development
Tests
npm test compiles src/tests/ and runs it with Node's built-in test runner — no
test framework, no mocking library.
The suite is hermetic. It never contacts an external host, never reads your
ambient CSVBOX_API_* / ANTHROPIC_API_KEY / OPENAI_API_KEY, and never touches
a real CSVBox account, so it passes identically whether or not you have
credentials configured. HTTP is intercepted at the axios adapter; the LLM is a
scripted fake; the one test that needs real request encoding starts an ephemeral
listener on 127.0.0.1 and closes it afterwards. Tests that read environment
variables set what they need explicitly and restore the previous values.
E2E tests
Specs live in e2e/, configured by playwright.config.ts. Like the unit suite,
this suite is hermetic: it starts mock CSVBox and LLM servers on loopback
(e2e/support/mock-csvbox-server.ts, e2e/support/mock-llm-server.ts) and
drives the real built server (dist/index.js) through MCP Inspector with
fake credentials pointed at those mocks — it never contacts a real CSVBox
account or LLM provider, and never reads your .env. A separate,
zero-credential Inspector instance covers the "missing credentials" error
paths. Requires npm run build first (the test:e2e webServer entries build
automatically).
Embedding the server
createServer() is exported from the entry module. It registers every tool and
prompt and returns the McpServer without attaching a transport, so you can
connect it to one of your own:
Importing the module does not start anything; the stdio server runs only when
dist/index.js is executed directly.
License
MIT
来源:README.md,提交 a8ac91d
工具
0版本历史
1- v1.0.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分