flow-codeblock-rust-mcp 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ Flow Codeblock Rust+Bun 的本地 stdio MCP Server。它只调用服务端 Rust
7
7
  需要 Bun 1.4.0 或更高版本:
8
8
 
9
9
  ```bash
10
- bunx --bun flow-codeblock-rust-mcp@0.1.2
10
+ bunx --bun flow-codeblock-rust-mcp@0.1.3
11
11
  ```
12
12
 
13
13
  配置环境变量:
@@ -26,7 +26,7 @@ export FLOW_CODEBLOCK_TOKEN='<YOUR_INTERNAL_ACCESS_TOKEN>'
26
26
  "mcpServers": {
27
27
  "flow-codeblock-rust": {
28
28
  "command": "bunx",
29
- "args": ["--bun", "flow-codeblock-rust-mcp@0.1.2"],
29
+ "args": ["--bun", "flow-codeblock-rust-mcp@0.1.3"],
30
30
  "env": {
31
31
  "FLOW_CODEBLOCK_BASE_URL": "https://flow.example.com",
32
32
  "FLOW_CODEBLOCK_TOKEN": "<YOUR_INTERNAL_ACCESS_TOKEN>"
@@ -38,6 +38,8 @@ export FLOW_CODEBLOCK_TOKEN='<YOUR_INTERNAL_ACCESS_TOKEN>'
38
38
 
39
39
  ## 工具边界
40
40
 
41
+ 代码契约使用当前 Rust+Bun 模块白名单:`crypto-js` 已移除,加密应使用 `node:crypto`。Excel 仅允许 `read-excel-file/node`、`read-excel-file/universal`、`write-excel-file/node`、`write-excel-file/universal` 和 `write-excel-file/utility` 入口;这些模块由服务端共享重型执行池承载。
42
+
41
43
  工具覆盖代码生成、未发布代码测试、脚本列表、版本读取、接口文档校验/预览/保存、脚本创建/更新、锁定/解锁和已发布脚本执行。创建或代码更新可提交完整接口文档或 RFC 6902 `interface_doc_patch`;预览会调用 `/flow/scripts/validate`,应用时会再次透传补丁并使用事务级 `expected_version` 检测并发冲突。所有脚本写操作需要预览后显式 `confirm: true`。
42
44
 
43
45
  最终用户交付按模式区分:`non_script` 输出完整 JavaScript、接口调用说明、请求参数及示例、执行逻辑、成功/错误输出示例和完整 `execution_url`;`script` 默认不主动回显 JavaScript 或原始 `interface_doc`,只输出接口调用说明、请求参数及示例、执行逻辑、成功/错误输出示例和发布后的完整 `script_url`。脚本代码与 `interface_doc` 仍由 MCP 内部用于预览、校验和发布,除非用户明确索要源码或原始文档。
package/dist/index.js CHANGED
@@ -28146,14 +28146,16 @@ Rules:
28146
28146
  var allowedModules = [
28147
28147
  "axios",
28148
28148
  "cheerio",
28149
- "crypto-js",
28150
28149
  "csv-parser",
28151
28150
  "fast-xml-parser",
28152
28151
  "form-data",
28153
28152
  "lodash",
28153
+ "pinyin-pro",
28154
28154
  "qs",
28155
+ "read-excel-file",
28155
28156
  "sm-crypto-v2",
28156
28157
  "uuid",
28158
+ "write-excel-file",
28157
28159
  "xlsx",
28158
28160
  "dayjs"
28159
28161
  ];
@@ -28273,7 +28275,7 @@ function codeWriterContext(mode, requirement, inputExample, includeFullSchema, b
28273
28275
  code_rules: [
28274
28276
  "所有业务数据只从全局 input 读取,不从环境变量、持久化全局变量或其他外部状态读取;返回值必须可 JSON 序列化。",
28275
28277
  "默认使用顶层 return;只有事件式/异步流程或用户明确要求时才使用 qf_output,且必须是裸的 qf_output = { ... } 对象字面量赋值,不能与顶层 return 混用,也不能遮蔽该标识符。",
28276
- "优先标准 JavaScript 和服务端原生 fetch;只有原生能力确实无法满足且用户明确要求时,才使用白名单 CommonJS 字面量 require。",
28278
+ "优先标准 JavaScript、服务端原生 fetch 和 node:crypto;只有原生能力确实无法满足且用户明确要求时,才使用白名单 CommonJS 字面量 require。crypto-js 已移除,不得生成该模块调用。",
28277
28279
  "禁止 import/export、动态 require、浏览器 API、定时器、阻止标识符、阻止成员和黑名单 Node 模块,不得写入真实凭据。",
28278
28280
  "业务逻辑和异步操作放在 try-catch 中;错误转换为字符串或普通对象后返回。",
28279
28281
  "不得创建无界循环、未 settle 的 Promise 或执行结束后仍运行的后台任务;所有请求必须 await 或 return。",
@@ -28286,7 +28288,7 @@ function codeWriterContext(mode, requirement, inputExample, includeFullSchema, b
28286
28288
  require_policy: {
28287
28289
  allowed_call_form: "仅允许单个字符串字面量 require('模块名'),不得间接调用、动态模块名或使用 import/export。",
28288
28290
  dayjs_exception: "日期处理优先原生 Date;复杂日期解析/格式化/时区才允许使用 dayjs。",
28289
- other_modules: "除 dayjs 外,只有原生能力确实无法实现且用户明确要求时才允许白名单模块。"
28291
+ other_modules: "除 dayjs 外,只有原生能力确实无法实现且用户明确要求时才允许白名单模块;Excel 仅允许 read-excel-file/node、read-excel-file/universal、write-excel-file/node、write-excel-file/universal 和 write-excel-file/utility。"
28290
28292
  },
28291
28293
  forbidden: {
28292
28294
  identifiers: [
@@ -28510,7 +28512,7 @@ var serverInstructions = [
28510
28512
  "接口文档 endpoint.path 只写相对路径:创建时省略,更新时写 /flow/codeblock/<实际脚本ID>。对外展示的完整调用地址必须使用用户提供的域名拼接 /flow/codeblock/{{脚本ID}};不要把真实 Token、密码、Cookie 或 Authorization 值写入代码、文档、示例或 URL。",
28511
28513
  "脚本模式输入来自 input.query、input.header、input.body、input.cookies;即时非脚本模式 POST /flow/codeblock 的 body.input 原样成为全局 input。代码默认使用顶层 return;只有事件式/异步流程或用户明确要求时才使用裸 qf_output 赋值,不能混用。",
28512
28514
  "最终用户交付按模式区分:non_script 输出完整 JavaScript、接口调用说明、请求参数及示例、执行逻辑、成功/错误输出示例和完整 execution_url;script 默认不主动回显 JavaScript 或原始 interface_doc,只输出接口调用说明、请求参数及示例、执行逻辑、成功/错误输出示例和发布后的完整 script_url,除非用户明确索要源码或原始文档。script 的代码与 interface_doc 仍必须内部提交给预览、校验和发布工具。",
28513
- "优先原生 JavaScript、URL/URLSearchParams 和 fetch;禁止浏览器 API、定时器、动态模块加载、黑名单 Node 模块和危险标识符。HTTP 请求必须检查状态并处理 JSON/文本/空响应,所有异步任务必须显式 await 或 return。",
28515
+ "优先原生 JavaScript、URL/URLSearchParams、fetchnode:crypto;crypto-js 已移除,禁止生成该模块调用。禁止浏览器 API、定时器、动态模块加载、黑名单 Node 模块和危险标识符。Excel 仅允许 read-excel-file/node、read-excel-file/universal、write-excel-file/node、write-excel-file/universal 和 write-excel-file/utility。HTTP 请求必须检查状态并处理 JSON/文本/空响应,所有异步任务必须显式 await 或 return。",
28514
28516
  "执行脚本时 method 只能是 GET 或 POST;MCP 认证、Cookie、CSRF、代理来源头和测试工具标识会被过滤。不要使用删除脚本、紧急恢复解锁或任意 HTTP 代理能力,本 MCP 不提供这些工具。"
28515
28517
  ].join(`
28516
28518
  `);
@@ -28745,7 +28747,7 @@ function assertPreview(record3, operation) {
28745
28747
  return record3;
28746
28748
  }
28747
28749
  function createMcpServer({ api: api2, previews = new PreviewStore }) {
28748
- const server = new McpServer({ name: "flow-codeblock-rust", version: "0.1.2" }, { instructions: serverInstructions });
28750
+ const server = new McpServer({ name: "flow-codeblock-rust", version: "0.1.3" }, { instructions: serverInstructions });
28749
28751
  server.registerTool("flow_write_code", {
28750
28752
  description: "生成代码实现契约,不写数据库、不发布脚本、不执行代码。mode=non_script 生成即时 POST /flow/codeblock 代码,最终交付包含完整 execution_url;mode=script 生成 GET/POST /flow/codeblock/{{script_id}} 代码,内部生成完整 script-interface-doc.v1 供预览、校验和发布,最终交付默认只展示接口调用说明、请求参数及示例、执行逻辑、成功/错误输出示例和 script_url,除非用户明确索要源码或原始 interface_doc。脚本文档的 title、summary、endpoint.methods、endpoint.description、request、responses、logic_description 必须齐全;query/header 参数必须有 name/type/description/example,body 和 response 字段必须有 content_type/schema/example。需要展示用户指定的完整地址时可传入 base_url。",
28751
28753
  inputSchema: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-codeblock-rust-mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Flow Codeblock Rust+Bun stdio MCP Server for script management and execution.",
5
5
  "license": "MIT",
6
6
  "repository": {