arXiv:2509.05941cs.SEcs.LG2025-09KDD被引 16

自动将开源代码库转为MCP服务,让大模型直接调用海量现成工具。

Code2MCP: Transforming Code Repositories into MCP Services

  • 用多智能体流程自动分析代码、设计接口并生成MCP服务。
  • 成功转换生物信息学等领域的开源库,使其可在MCP中使用。
  • 无需人工干预,为大模型工具生态提供自动化接入方案。

模型上下文协议(MCP)旨在为大语言模型使用工具制定标准,但当前研究多聚焦于从现有工具池中选择工具,而如何将海量现有软件项目转化为MCP兼容服务这一根本问题却鲜受关注。为此,我们提出Code2MCP——一个基于智能体的框架,可自动将GitHub仓库转化为功能完整的MCP服务,几乎无需人工干预。该框架采用多智能体工作流完成代码分析、环境配置、工具函数设计与服务生成,并引入自纠正机制保障可靠性。实验表明,Code2MCP成功将生物信息学、数学和流体动力学等领域的开源计算库转化为MCP服务,这些库此前未在任何MCP服务器中可用。通过为全球最大的代码库GitHub提供自动化接入路径,Code2MCP显著加速了MCP协议的落地应用。代码已公开:https://github.com/DEFENSE-SEU/Code2MCP。

原文摘要 · Abstract (English)

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.

代码转换MCP协议智能体系统自动化工具

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。