codetest-mcp

codetest-mcp

MCP server for static code analysis using AST parsing and linters, providing tools to detect syntax errors, type issues, typos, and incorrect variable usage across multiple languages. It supports headless linting with tools like ast_check, lint_check, and health.

Category
Visit Server

README

codetest-mcp — 코드 기반 처리 전담 FastAPI 서비스

정의서:

LLM을 사용하여 판단하는 부분은 Agent, 코드 기반으로 단순 처리 및 판단을 진행하는 부분은 MCP 로 구분하여 Fast API를 통해 송/수신하는 방식으로 구현

이 서비스는 LLM 을 전혀 호출하지 않는다. 파서와 빌드 도구가 확정한 사실만 만들어 Agent 에게 돌려준다.

담당 기능 (전부 정의서 근거)

기능 정의서 근거
Git clone + AST 파싱 → 프로젝트 개요 DB 저장 [상세] 1
Git Diff + AST 로 변경된 코드 단위 식별 (2)
변경 영향도 / 메소드 추적 흐름 3
생성된 Test Code 에 @SpringBootTest 주입 (1)
Gradle + JaCoCo 로 Test Code 실행 [상세] 4

하지 않는 것: 변경 의도 해석, 중요도 판정, 테스트 코드 작성, 결과 적절성 판단 — 전부 Agent(LLM)의 몫이다.

API

메서드 경로 설명
GET /api/v1/health 헬스체크 (인증 불필요)
POST /api/v1/projects 프로젝트 등록 + 개요 수집(백그라운드)
DELETE /api/v1/projects/{id} 프로젝트·그래프·작업 사본 삭제
GET /api/v1/projects/{id}/overview 저장된 개요 조회
POST /api/v1/analysis/changes Diff + AST 변경 단위·영향도 식별
POST /api/v1/tests/execute @SpringBootTest 주입 + JaCoCo 실행

/api/v1/analysis/changes

// 요청
{ "project_id": "…", "diff": "<unified diff>", "sources": [{"path": "…", "content": "…"}] }

// 응답 — 확정된 사실만
{
  "changed_units":  [{"qualified_name": "com.example.demo.service.OrderService#calculateTotal(Order)",
                      "node_type": "Method", "start_line": 6, "end_line": 12, "entrypoint": false}],
  "impacted_units": [{"qualified_name": "…", "depth": 1, "via": "Calls"}],
  "risk": "MEDIUM", "risk_score": 30, "risk_reasons": ["직접 변경된 그래프 노드 1개 …"],
  "frameworks": ["Spring Boot"], "base_package": "com.example.demo",
  "graph_ready": true, "warnings": []
}

/api/v1/tests/execute

test_code@SpringBootTest 가 없으면 주입한 뒤 실행한다. 필요한 import 와 package 선언도 보강하고, src/test/java/<package>/<Class>.java 로 저장해 돌린다. 클라이언트가 보낸 sources(미커밋 변경분)를 작업 사본에 덮어쓴 뒤 실행하므로 개발자의 로컬 변경이 실제로 테스트된다. 실행이 끝나면 작업 사본을 원상 복구한다.

// 응답 — 판정 없이 사실만
{
  "exit_code": 0, "passed": 3, "failed": 0, "total": 3, "failures": [],
  "coverage": {"line_rate": 80.0, "branch_rate": 100.0, "line_covered": 16, "line_missed": 4},
  "jacoco_enabled": true, "springboot_applied": true,
  "applied": ["@SpringBootTest 주입 (class GeneratedOrderTest)", "import 보강: …"],
  "test_file_path": "src/test/java/com/example/demo/GeneratedOrderTest.java",
  "command": ["sh", "./gradlew", "test", "--tests", "…", "jacocoTestReport"]
}

실행

pip install -e .
uvicorn codetest_mcp.main:app --host 0.0.0.0 --port 8100
# 또는
python -m codetest_mcp

환경변수

변수 기본값 설명
CODETEST_MCP_PORT 8100 수신 포트
CODETEST_MCP_API_KEYS (없음) Agent 인증 키(CSV). 비우면 인증 비활성화
CODETEST_MCP_DATABASE_URL sqlite:///./data/codetest_mcp.db 개요/그래프 저장소
CODETEST_MCP_WORKSPACE_DIR ./workspace 대상 저장소 clone 위치
CODETEST_MCP_GRADLE_COMMAND gradle gradlew 가 없을 때 쓸 실행 파일
CODETEST_MCP_TEST_TIMEOUT 900 gradle test 최대 실행 시간(초)

대상 프로젝트에 gradlew 가 있으면 우선 사용한다. JaCoCo 커버리지는 프로젝트 build.gradlejacoco 플러그인이 적용되어 있을 때만 수집된다.

테스트

python -m pytest tests/ -q

배포 위치

Agent 와 동일한 별도 관리 서버. Agent 가 FastAPI 로 호출한다. 대상 저장소를 clone 하고 Gradle 을 실행하므로 JDK 와 Gradle 이 필요하다.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured