该项目提供了一个用于分析遗留代码库(特别是COBOL、CLIST和Python等大型机技术)的服务器和工具。它利用大语言模型(LLMs)来提取程序流程、数据结构,并进行文件分类,从而更容易理解和现代化遗留系统。
uv 包管理器uv 是一个快速的Python包管理和虚拟环境工具。
# 在Windows(PowerShell)上
iwr https://astral.sh/uv/install.ps1 -useb | iex
# 在macOS/Linux上
curl -Ls https://astral.sh/uv/install.sh | sh
参见uv安装文档了解更多信息。
# 同步依赖项并创建虚拟环境
uv sync
# 运行主服务器
uv run main.py
npx @modelcontextprotocol/inspector uv run python main.py
在VS Code设置中添加以下内容以集成MCP:
"servers": {
"legacy-code-analyzer-server-v1-01": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp>=2.8.0",
"--with",
"gitpython>=3.1.44",
"--with",
"mcp-llm>=0.1.0",
"--with",
"uvicorn>=0.34.3",
"python",
"G:\\source\\python\\mcp_legacy_analysis\\main.py"
]
}
},
"chat.mcp.serverSampling": {
"Global in Code: legacy-code-analyzer-server-v1-01": {
"allowedDuringChat": true
}
}
main.py — FastMCP服务器的入口点。legacy_analysis_server.py — 注册用于分析的工具和资源。analysis.py — 文件内容检索和分类逻辑。data_structure.py — COBOL数据结构提取和伪代码转换。flow_analysis.py — 提取COBOL、CLIST和Python的程序流程。sampling.py — LLM采样辅助。templates/ — 各种分析任务的提示模板。workspace/ — 克隆的仓库和分析工件。MIT许可证。详情请参见LICENSE。 </中文翻译>