DS

defense-seu/code2mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

136 stars 17 forks 品質 81 トレンド 14

defense-seu/code2mcpは、https://github.com/defense-seu/code2mcp.からインポートされたMCPサーバー候補です。

概要

defense-seu/code2mcpは、https://github.com/defense-seu/code2mcp.からインポートされたMCPサーバー候補です。

概要(AI 翻訳)

欧陽超前(Chaoqian Ouyang)*     岳凌(Ling YUE)* ,     邸世民(   Shimin Di) ✉ 鄭立彬(リビン・ジェン) ✉    

岳立楠(Linan Yue)は、     邵韶武(   Shaowu Pan) 印鉴(Jian Yin)     張敏灵(Min-Ling Zhang)    

* 均等な貢献 ✉ 通信著者

プロジェクト概要

Code2MCPは、既存のコードリポジトリをMCP(Model Context Protocol)サービスに変換する自動化ワークフローシステムです。システムは最小限の侵入原則に従い、元のリポジトリのコアコードを保持しつつ、サービス関連ファイルやテストのみを追加します。

コア機能

  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" } } }