DS

defense-seu/code2mcp

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

136 stars 17 forks 품질 81 트렌드 14

defense-seu/code2mcp는 [[T0]에서 가져온 MCP 서버 후보입니다.

개요

defense-seu/code2mcp는 [[T0]에서 가져온 MCP 서버 후보입니다.

개요(AI 번역)

조첸 오양(欧阳超前)* ,     영유(岳凌)* ,     시민디(邸世民) ✉ ,     정립(郑立彬) ✉ ,    

리난위에(岳立楠),     샤오우판(潘韶武) ,     지안 인(印鉴),     민령 장(张敏灵) ,    

* 동등한 기여 ✉ 교신저자

프로젝트 개요

Code2MCP는 기존 코드 저장소를 MCP(모델 컨텍스트 프로토콜) 서비스로 변환하는 자동화된 워크플로우 시스템입니다. 이 시스템은 최소한의 침입 원칙을 따르며, 원래 저장소의 핵심 코드를 보존하고 서비스 관련 파일과 테스트만 추가합니다.

핵심 기능

  1. 지능형 코드 분석
  • 기본적으로 AST보다 먼저 소스 분석, 선택적 LLM 강화 기능
  • 실제 코어 모듈, 공개 함수, 클래스, 서명, 가져오기, 파일 경로의 자동 식별
  • MCP 서비스 코드의 스마트 생성
  1. MCP 서비스 생성
  • mcp_service.py, adapter.py 및 기타 핵심 파일 자동 생성
  • 여러 프로젝트 구조(src/, source/, root 디렉터리 등) 지원

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

Project Overview

Code2MCP is an automated workflow system that transforms existing code repositories into MCP (Model Context Protocol) services. The system follows a minimal intrusion principle, preserving the original repository’s core code while only adding service-related files and tests.

Core Features

  1. Intelligent Code Analysis

    • AST-first source analysis by default, with optional LLM enrichment
    • Automatic identification of real core modules, public functions, classes, signatures, imports, and file paths
    • Smart generation of MCP service code
  2. MCP Service Generation

    • Automatic generation of mcp_service.py, adapter.py, and other core files
    • Support for multiple project structures (src/, source/, root directory, etc.)
    • Ranks safer wrapper candidates first and avoids complex parameters, unsafe paths, and classes that require constructor arguments
  3. Workflow Automation

    • Complete 7-node workflow: download -> analysis -> env -> generate -> run -> review -> finalize
    • Automatic environment configuration and test validation
    • Comprehensive logging and status tracking
    • Intelligent error recovery and retry mechanisms
  4. End-to-End Automation

    • Generates HuggingFace Spaces/Docker deployment scaffolding
    • Automatic client configuration after a validated local or remote service is available
    • Runtime validation is required before a conversion is marked successful

Quick Start

1. Create a Python Environment

Code2MCP requires Python 3.10 or newer because FastMCP does not support Python 3.9.

Conda example:

conda create -n code2mcp python=3.12 -y
conda activate code2mcp

venv example, when your python is already 3.10+:

python -m venv .venv

Windows PowerShell:

.\.venv\Scripts\Activate.ps1

Bash/macOS/Linux:

source .venv/bin/activate

Confirm the version:

python --version

2. Configure Environment Variables

Copy the environment variables template:

cp env.example .env

Windows PowerShell:

Copy-Item .\env.example .\.env

Edit .env and fill OPENAI_API_KEY before running:

MODEL_PROVIDER=openai
OPENAI_API_KEY=sk-...

If you already have a local Codex/OpenAI auth cache, you may use Codex auth instead:

MODEL_PROVIDER=openai-codex
OPENAI_API_KEY=
OPENAI_CODEX_AUTH_FILE=C:\Users\\.codex\auth.json
GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "{alias}": { "url": "https://{your-username}-{space-name}.hf.space/mcp" } } }