- 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 为清理后继续完整编译(非独立清理)
351 lines
7.6 KiB
JSON
351 lines
7.6 KiB
JSON
[
|
||
{
|
||
"name": "tpc_build",
|
||
"description": "用 TransPyC 编译任意 Viper 工程(Projectrans.py --project,两阶段)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"type": "string",
|
||
"description": "project.json 路径(相对根),如 Test/CoroTest/project.json",
|
||
"clean": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"run": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"phase": {
|
||
"type": "string",
|
||
"enum": [
|
||
"1",
|
||
"2",
|
||
"all"
|
||
],
|
||
"default": "all"
|
||
},
|
||
"rebuild_includes": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"clear_cache": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"asan": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"nowarn_register": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"src": {
|
||
"type": "string"
|
||
},
|
||
"temp": {
|
||
"type": "string"
|
||
},
|
||
"output": {
|
||
"type": "string"
|
||
},
|
||
"cc": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"required": [
|
||
"project"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tpc_build_file",
|
||
"description": "单文件 .vp → LLVM IR(TransPyC.py -f),可选链接运行",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"input": {
|
||
"type": "string",
|
||
"description": "输入 .vp 路径(相对根)"
|
||
},
|
||
"output": {
|
||
"type": "string",
|
||
"description": "输出 .ll 路径"
|
||
},
|
||
"run": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"args": {
|
||
"type": "string"
|
||
},
|
||
"level": {
|
||
"type": "string"
|
||
},
|
||
"encoding": {
|
||
"type": "string",
|
||
"default": "utf-8"
|
||
},
|
||
"cc": {
|
||
"type": "string"
|
||
},
|
||
"cflags": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"required": [
|
||
"input",
|
||
"output"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tpc_run_test",
|
||
"description": "编译并运行单个 Test/<Name>(--clean --run)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "Test/ 下子目录名,如 CoroTest"
|
||
},
|
||
"rebuild_includes": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"clear_cache": {
|
||
"type": "boolean",
|
||
"default": false
|
||
},
|
||
"asan": {
|
||
"type": "boolean",
|
||
"default": false
|
||
}
|
||
},
|
||
"required": [
|
||
"name"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tpc_run_regression",
|
||
"description": "全量回归(Test/regression_test.py)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "可选过滤测试名"
|
||
},
|
||
"timeout": {
|
||
"type": "integer",
|
||
"default": 300
|
||
}
|
||
},
|
||
"required": []
|
||
}
|
||
},
|
||
{
|
||
"name": "tpc_clean_project",
|
||
"description": "清理并编译工程(--clean,清理后继续完整编译流程)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"type": "string",
|
||
"description": "project.json 路径(相对根),如 Test/CoroTest/project.json"
|
||
},
|
||
"required": [
|
||
"project"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tpc_clear_cache",
|
||
"description": "清除全局 .transpyc_cache(--clear-cache)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"type": "string",
|
||
"description": "project.json 路径(相对根),如 Test/CoroTest/project.json"
|
||
},
|
||
"required": [
|
||
"project"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tpc_rebuild_includes",
|
||
"description": "重建 includes.binary 预编译缓存(--rebuild-includes)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"type": "string",
|
||
"description": "project.json 路径(相对根),如 Test/CoroTest/project.json"
|
||
},
|
||
"required": [
|
||
"project"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tpv_build",
|
||
"description": "TPC 编译 TransPyV → TransPyV/output/TransPyV.exe(Phase A)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"clean": {
|
||
"type": "boolean",
|
||
"default": true
|
||
},
|
||
"rebuild_includes": {
|
||
"type": "boolean",
|
||
"default": true
|
||
},
|
||
"clear_cache": {
|
||
"type": "boolean",
|
||
"default": true
|
||
}
|
||
},
|
||
"required": []
|
||
}
|
||
},
|
||
{
|
||
"name": "tpv_bootstrap",
|
||
"description": "自举链 Phase A/B/C 验证并对比产物",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"phases": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"enum": [
|
||
"A",
|
||
"B",
|
||
"C"
|
||
]
|
||
},
|
||
"default": [
|
||
"A",
|
||
"B",
|
||
"C"
|
||
]
|
||
},
|
||
"compare": {
|
||
"type": "boolean",
|
||
"default": true
|
||
}
|
||
},
|
||
"required": []
|
||
}
|
||
},
|
||
{
|
||
"name": "tpv_compile_project",
|
||
"description": "用 TransPyV/output/TransPyV.exe 编译工程(参数同 tpc_build)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string",
|
||
"description": "可选过滤测试名"
|
||
},
|
||
"timeout": {
|
||
"type": "integer",
|
||
"default": 300
|
||
}
|
||
},
|
||
"required": [
|
||
"project"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tpv_run_test",
|
||
"description": "运行 TransPyV/Test 自测(App/NegativeTest/Sha1Test)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"suite": {
|
||
"type": "string",
|
||
"enum": [
|
||
"App",
|
||
"NegativeTest",
|
||
"Sha1Test",
|
||
"all"
|
||
],
|
||
"default": "all"
|
||
},
|
||
"filter": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"required": []
|
||
}
|
||
},
|
||
{
|
||
"name": "tp_read_ast",
|
||
"description": "解析 .vp 源码输出 vast AST dump",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"file": {
|
||
"type": "string",
|
||
"description": ".vp 源文件路径(相对根)"
|
||
},
|
||
"dump": {
|
||
"type": "string",
|
||
"enum": [
|
||
"compact",
|
||
"full"
|
||
],
|
||
"default": "compact"
|
||
}
|
||
},
|
||
"required": [
|
||
"file"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tp_read_log",
|
||
"description": "读取项目内文本文件末尾 N 行或正则过滤",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"file": {
|
||
"type": "string",
|
||
"description": "文件路径(相对根),如 1.log"
|
||
},
|
||
"lines": {
|
||
"type": "integer",
|
||
"default": 50
|
||
},
|
||
"pattern": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"required": [
|
||
"file"
|
||
]
|
||
}
|
||
},
|
||
{
|
||
"name": "tp_sha1_map",
|
||
"description": "读取工程 temp/_sha1_map.txt(诊断缓存命中)",
|
||
"inputSchema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"project": {
|
||
"type": "string",
|
||
"description": "工程目录(相对根),如 Test/CoroTest"
|
||
},
|
||
"filter": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"required": [
|
||
"project"
|
||
]
|
||
}
|
||
}
|
||
] |