Code2MCP: 将代码仓库转化为MCP服务
Code2MCP: Transforming Code Repositories into MCP Services
AI总结:
Code2MCP通过自动化将GitHub仓库转换为MCP兼容服务,解决现有MCP工具池不足的问题,促进MCP协议的普及与应用。
摘要:
模型上下文协议(MCP)旨在为大型语言模型使用工具创建标准。然而,当前大多数研究集中在从现有工具池中选择工具。一个更为根本但长期被忽视的问题是如何通过将大量现有软件项目转换为MCP兼容服务来充实这个池。为弥合这一差距,我们引入了Code2MCP,一个基于代理的框架,能够自动将GitHub仓库转换为功能性的MCP服务,且最小化人工干预。Code2MCP采用多代理工作流进行代码分析、环境设置、工具功能设计和服务生成,通过自我纠正循环来确保可靠性。我们证明Code2MCP成功地将科学领域如生物信息学、数学和流体动力学中的开源计算库转换为MCP兼容服务,这些库在现有MCP服务器中不可用。通过提供一种新的自动化途径,使世界上最大的代码仓库GitHub对MCP生态系统开放,Code2MCP成为加速该协议采用和实际应用的催化剂。代码可在https://github.com/DEFENSE-SEU/Code2MCP上公开。
英文摘要:
The Model Context Protocol (MCP) aims to create a standard for how Large Language Models use tools. However, most current research focuses on selecting tools from an existing pool. A more fundamental, yet largely overlooked, problem is how to populate this pool by converting the vast number of existing software projects into MCP-compatible services. To bridge this gap, we introduce Code2MCP, an agent-based framework that automatically transforms a GitHub repository into a functional MCP service with minimal human intervention. Code2MCP employs a multi-agent workflow for code analysis, environment setup, tool function design, and service generation, enhanced by a self-correcting loop to ensure reliability. We demonstrate that Code2MCP successfully transforms open-source computing libraries in scientific fields such as bioinformatics, mathematics, and fluid dynamics that are not available in existing MCP servers. By providing a novel automated pathway to unlock GitHub, the world's largest code repository, for the MCP ecosystem, Code2MCP serves as a catalyst to significantly accelerate the protocol's adoption and practical application. The code is public at https://github.com/DEFENSE-SEU/Code2MCP.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。