feat(mcp): 实现 transpyc_mcp 服务器——stdio JSON-RPC 驱动 TPC/TPV
- transpyc_mcp/server.py:零依赖 MCP 服务器(initialize/tools/list/tools/call)
- 14 个工具按协议实现:tpc_build/tpc_build_file/tpc_run_test/tpc_run_regression/
tpc_clean_project/tpc_clear_cache/tpc_rebuild_includes/tpv_build/tpv_bootstrap/
tpv_compile_project/tpv_run_test/tp_read_ast/tp_read_log/tp_sha1_map
- 安全:路径白名单/命令白名单/工程串行锁/TPV 内存保护(>=1GiB)
- 输出统一 {ok, exit_code, stdout, stderr, artifacts, elapsed_ms},日志末尾 50 行
- 冒烟测试通过:init/tools-list/AST 解析/日志/越界拒绝/未知工具/锁
- 修正协议:--clean 为清理后继续完整编译(非独立清理)
This commit is contained in:
1 parent
e412885a3e
commit
004121de40
5 files changed
+595
-4
No files matched your search
+1
-1
@@ -48,7 +48,7 @@ MCP 服务器(`transpyc-tools`)以 stdio 方式运行于项目根目录:
|
||||
| 编译任意工程 | `tpc_build` | `python Projectrans.py --project <project.json> [--clean] [--run] ...` |
|
||||
| 单文件转 LLVM IR | `tpc_build_file` | `python TransPyC.py -f <in.vp> -o <out.ll>` |
|
||||
| 全量回归 | `tpc_run_regression` | `python Test/regression_test.py` |
|
||||
| 清理工程产物 | `tpc_clean_project` | `python Projectrans.py --project <p> --clean` |
|
||||
| 清理并编译 | `tpc_clean_project` | `python Projectrans.py --project <p> --clean`(清理后继续完整编译) |
|
||||
| 清全局缓存 | `tpc_clear_cache` | `python Projectrans.py --project <p> --clear-cache` |
|
||||
| 重建 includes | `tpc_rebuild_includes` | `python Projectrans.py --project <p> --rebuild-includes` |
|
||||
| 构建 TPV | `tpv_build` | `python Projectrans.py --project TransPyV/project.json --clean` |
|
||||
|
||||
+2
-2
@@ -220,9 +220,9 @@ python Test/regression_test.py
|
||||
|
||||
- 说明:默认全量耗时较长;客户端应按需使用 `name` 过滤或分片调用。
|
||||
|
||||
### 6.5 tpc_clean_project — 清理工程产物
|
||||
### 6.5 tpc_clean_project — 清理并编译工程
|
||||
|
||||
- description:清理工程 `output/` 与 `temp/`(`Projectrans.py --clean`)。
|
||||
- description:执行 `Projectrans.py --clean`——先清理 `output/` 与 `temp/`,**随后仍继续完整编译流程**(`--clean` 是编译前置步骤,非独立清理命令)。等价 `tpc_build(clean=true)`,仅不含运行。
|
||||
- inputSchema:`{ "project": {"type":"string"} }`,required: ["project"]。
|
||||
- command:`python Projectrans.py --project <project> --clean`
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
},
|
||||
{
|
||||
"name": "tpc_clean_project",
|
||||
"description": "清理工程 output/temp(--clean)",
|
||||
"description": "清理并编译工程(--clean,清理后继续完整编译流程)",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in new issue
Block a user