graph-mcp-java-gen
graph-mcp-java-gen
그래프 기반 MCP 서버 — 자연어 요청을 검증되고 컴파일 가능한 Java 테스트 메서드로 변환합니다. 환각된 임포트 없음, 근거 없는 심볼 없음, 조용한 실패 없음.
자연어 또는 구조화된 요청이 공식 Model Context Protocol(MCP) stdio 서버로 들어갑니다. 버전이 명시된 그래프 카탈로그(Neo4j 또는 JSON 스처)가 생성기가 인용할 수 있는 유일한 심볼을 공급합니다. 다층 검증 시스템은 소스가 반환되기 전에 구문, 프레임워크 계약, 근거(grounding), 금지 API 규칙을 검사합니다. 선택적 LLM 에이전트 두 개 — 인텐트 정규화기와 생성 후 검토기 — 는 결정적 안전 경계를 훼손하지 않으면서 파이프라인을 자유 입력까지 확장합니다.
아키텍처
%%{init: {"theme": "base", "themeVariables": {"primaryColor": "#1e3a5f", "primaryTextColor": "#ffffff", "primaryBorderColor": "#0d2137", "lineColor": "#4a9eca", "secondaryColor": "#2d6a4f", "tertiaryColor": "#7b2d8b"}}}%%
flowchart TD
classDef input fill:#7b2d8b,stroke:#4a1a54,color:#fff,font-size:13px
classDef mcp fill:#e07b00,stroke:#9a5700,color:#fff,font-size:13px
classDef agent fill:#1a6b8a,stroke:#0d3f52,color:#fff,font-size:13px
classDef core fill:#2d6a4f,stroke:#1b4332,color:#fff,font-size:13px
classDef graph fill:#1e3a5f,stroke:#0d1f3c,color:#fff,font-size:13px
classDef validate fill:#4a6741,stroke:#2d4026,color:#fff,font-size:13px
classDef ok fill:#155724,stroke:#0a3015,color:#fff,font-size:13px
classDef reject fill:#721c24,stroke:#3d0a0e,color:#fff,font-size:13px
NL["🌎 Free-form NL\n(generate_java_test_nlp)"]:::input
SF["📄 Structured fields\n(generate_java_test)"]:::input
TX["💬 Intent text\n(generate_java_test_from_intent)"]:::input
MCP["🔌 FastMCP stdio Server\n7 tools · zero raw Cypher"]:::mcp
A1["🤖 LLMIntentParser\nAgent 1 · gpt-4o-mini\nfield extraction"]:::agent
INT["✅ GenerationIntent\nclass · package · module\nconfig · version"]:::core
GDB["📊 Graph Catalog\nNeo4j 5.26 / JSON fixture\n8 symbols · 12 methods"]:::graph
GEN["⚙️ Template Generator\ndeterministic render"]:::core
VAL["🛡️ JavaValidator\nTree-sitter AST\ncontract · grounding\nsource-safety"]:::validate
A2["🤖 ReviewAgent\nAgent 2 · gpt-4o-mini\n6-item checklist"]:::agent
OK["✅ Accepted Java\nsource + citations\n+ review verdict"]:::ok
REJ["❌ Typed Rejection\nerror code + message\nno source returned"]:::reject
NL --> MCP
SF --> MCP
TX --> MCP
MCP -->|"NLP path"| A1
MCP -->|"direct path"| INT
A1 -->|"extracted fields"| INT
INT -->|"invalid"| REJ
INT -->|"valid"| GDB
GDB -->|"cited symbols"| GEN
GEN --> VAL
VAL -->|"any gate fails"| REJ
VAL -->|"all gates pass"| A2
A2 -->|"issues found"| REJ
A2 -->|"approved"| OK멀티 에이전트 파이프라인
%%{init: {"theme": "base", "themeVariables": {"actorBkg": "#1e3a5f", "actorTextColor": "#ffffff", "actorBorderColor": "#4a9eca", "activationBkgColor": "#2d6a4f", "activationBorderColor": "#155724", "noteBkgColor": "#fff8e1", "noteTextColor": "#333", "signalColor": "#4a9eca", "signalTextColor": "#1e3a5f"}}}%%
sequenceDiagram
autonumber
actor User
participant MCP as FastMCP Server
participant A1 as LLMIntentParser<br/>(Agent 1)
participant GDB as Graph Catalog<br/>(Neo4j / Fixture)
participant GEN as Generator +<br/>JavaValidator
participant A2 as ReviewAgent<br/>(Agent 2)
User->>MCP: generate_java_test_nlp(free-form NL)
MCP->>A1: extract intent fields
Note over A1: gpt-4o-mini · temp=0<br/>strict JSON schema
A1-->>MCP: {class, package, module, config, version}
MCP->>GDB: get versioned symbols
GDB-->>MCP: 7 cited GraphSymbol objects
MCP->>GEN: render Java + validate
Note over GEN: Tree-sitter AST<br/>contract · grounding · safety
GEN-->>MCP: validated Java source
MCP->>A2: review(source, class, package)
Note over A2: gpt-4o-mini · temp=0<br/>6-item checklist
A2-->>MCP: {approved, checklist, issues}
MCP-->>User: {status, source, citations, review}증거 대시보드
모든 측정은 독립적으로 생성된 CC0 라이선스 합성 스처를 사용합니다. 결과는 보류된 confirmation 분할에서 채택된 strict_graph_v2 정책의 결과입니다.
영역 | 결과 | 아티팩트 |
벤ㄶ치마크 규모 | CC0 인텐트 96개 — dev 32개 / val 32개 / confirmation 32개 | |
Confirmation 작업 성공 | 32 / 32 대 제빾된 작업 | |
생성된 소스 검증 | 24 / 24 지원 인텐트 — 구문 + 계약 + 근거 + 안전성 | |
안전한 안전한 거부 | 8 / 8 — 오탐 0건 | |
인용 정밀도 | 100% — 그래프에서 인용된 심볼만 임포 | |
필수 심볼 재헌율 | 100% — 모든 필수 심볼 포함 | |
라이브 Neo4j 통합 | Neo4j 5.26.29 — 심볼 8개, 메서그 12개 구체화 | |
공식 MCP 벤치마크 | 120 / 120가 예상 결과 — 프로토콜 오류 0 | |
MCP 웘 지연 시간 (p50 / p95 / p99) | 동시성 1에서 29.13 / 48.61 / 54.23ms | |
Java 컴파일 | 8 / 8 클래스 파일 — Eclipse ECJ 3.21 | |
외부 모델 호출 (결정적 경로) | 0회 호출 · $0.00 |
지연 시간 수치는 단일 프로세스 로컬 Windows 측정값이며, 프로덕션 SLO가 아닙니다.
정책 선택
네 가지 생성 정책을 평가했습니다. 선택 기준은 confirmation 분할을 열기 전에 선언되었습니다. 모든 안전 게이트를 통과한 후보 중에서 검증 작업 성공률을 최대화하는 것입니다. Confirmation 분할은 선택된 후보에 대해정확히 한 번만 열었습니다.
%%{init: {"theme": "base", "themeVariables": {"quadrant1Fill": "#155724", "quadrant2Fill": "#856404", "quadrant3Fill": "#721c24", "quadrant4Fill": "#856404"}}}%%
xychart-beta
title "Validation: task success vs safe-rejection recall (%)"
x-axis ["no_graph_v0", "lenient_repair_v1", "strict_graph_v2 ✓", "wide_context_v3"]
y-axis "Task success (%)" 0 --> 105
bar [21.9, 75.0, 100.0, 96.9]
line [87.5, 0.0, 100.0, 87.5]후보 | 작업 성공 | 생성 유효성 | 안전 거부 | 인용 정밀도 | 결정 |
| 21.9% | 0% | 87.5% | 0% | 거부됨 — 근거없음 |
| 75.0% | 100% | 0% | 100% | 거부됨 — 오탕 8건 |
| 100% | 100% | 100% | 100% | 선택됨 |
| 96.9% | 100% | 87.5% | 87.5% | 거부됨 — 무관한 문맥 + 오탕 1건 |
MCP 도구
도구 | 유형 | 동작 |
| 읽기 | 픽스처 식별정보, 출처(provenance), 라이선스, 백엔드, 심볼 수 반환 |
| 읽기 | 파라미터화된 이름/메서드 검색, 최대 20개 결과 |
| 생성 | 타입 필드 → 그래프 조회 → Java → 모든 검증 게이트 |
| 생성 | 제한된 3형식 형식 문법 → 동일한 엄격한 정책 |
| 검증 | 최대 20,000자까지 검사하며, 소스를 쓰거할 실행하지 않음 |
| 멀티에이전트 | LLM 인텐트 파서 → 생성기 → LLM 검토기. |
Neo4j 어댑터는 고정 파라미터화된 Cypher를 사용하며, URI에 자격 증명을 거부하고, 픽스처 식별자 충돌을 거부합니다.
빠른 시작
python -m venv .venv
# Windows
.\.venv\Scripts\Activate.ps1
# Linux / macOS
source .venv/bin/activate
pip install -r requirements-dev.txt
pip install --no-deps -e .
# Run the offline smoke test (no database needed)
python scripts/container_smoke.py python -m graph_mcp.serverMCP 클라이언트 구성 (VS Code / Claude Desktop)
{
"mcpServers": {
"graph-java-gen": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["-m", "graph_mcp.server"],
"cwd": "/absolute/path/to/repo"
}
}
}멀티 에이전트 NLP 도구 활성화
# Add to your environment or .env file
OPENAI_API_KEY=sk-...
GRAPH_BACKEND=neo4j # optional; defaults to local JSON fixture증거 재현
# Build the CC0 benchmark fixture
python scripts/build_evaluation_fixture.py
# Run all four candidate policies and select strict_graph_v2
python scripts/evaluate_workflow.py
# Validate the claims ledger and evidence privacy rules
python scripts/validate_evidence.py
# Full test suite
pytest --cov=src --cov-report=term-missing --cov-fail-under=75
# Lint and security
ruff check src tests scripts
bandit -r src scripts -q -ll
pip-audit -r requirements.txt --progress-spinner off라이브 Neo4j 경로
# Start a local Neo4j Community instance (Docker)
docker compose up -d neo4j
python scripts/wait_for_neo4j.py
# Seed the synthetic graph fixture and verify retrieval
python scripts/seed_graph.py
python scripts/verify_neo4j.py # writes evidence/neo4j_integration.json
# Full MCP benchmark over stdio with live graph
python scripts/benchmark_mcp.py # writes evidence/mcp_benchmark.jsonJava 컴파일
# Requires JDK 21 on PATH
python scripts/compile_generated.py --require-compiler
# Writes evidence/java_compile.json보안 설계
MCP 서버레벨에서 raw Cypher 금지 — 모든 그래프 쿼리는 파라미터화됩니다.
엄격한 필드 허용 목록 — 클래스 이름, 패키지 이름, 모듈 이름, 버전, 구성 경로는 모든그래프 조회 전에 컴파일된 정규식 패턴과 대조됩니다.
소스 안전 스캐너 — 생성된 Java가no." Runtime.getRuntime
,ProcessBuilder,System.exit,java.io,java.nio.file,java.net`을 참조하면 거부.경로 추적 방지 — 절대경로 및
..경로요소가 구성 경로 필드에서 거부됩니다.근거 강제 — 생성 소스의 모든 임포트는 해당 정확 preview 버전의 그래프에서 검색한 심볼만 참조해야 합니다.
LLM 출력 재검증 — LLM 문맥 추출기가 추출한 필드는 직접 API 호출과 동일한
GenerationIntent.from_mapping()검증을 통과합니다.Neo4j 자격 증명 — 환경 변수에서만 로드되고, 로그에 남기거나 결과 산출물에서 반환하지 않습니다.
XML 사전 검사 —
defusedxml가 프로젝트 구조 스캔에서 엔티티 확장 공격을 차단합니다.컨테이너 — 고정된 애플리케이션 이미지, 비루트 UID/GID 65532 사용; CI는 컨테이너 기반 MCP stdio 스모크 테스트를 수행합니다.
전체 위협 경계는 SECURITY문서를 참조하세요.
저장소 맵
src/graph_mcp/
workflow.py intent parsing · graph lookup · Java generation · validation
graph_store.py Neo4j catalog adapter (parameterised Cypher)
llm_intent_parser.py Agent 1 — LLM free-form NL → GenerationIntent
review_agent.py Agent 2 — LLM post-generation checklist reviewer
server.py FastMCP stdio server (7 tools)
evaluation.py candidate scoring and selection harness
fixtures/
synthetic_graph.json CC0 versioned framework symbol catalog (SHA-256 bound)
evaluation_cases.json 96 CC0 natural-language intents (32/32/32 split)
java_framework/ 7 independently generated Java stub classes
evidence/
claims.json machine-readable claims ledger (14 public claims)
evaluation_protocol.json pre-declared selection rules and safety gates
task_evaluation.json per-candidate, per-split, per-case results
evaluation_trace.json confirmation case-level trace
neo4j_integration.json live Neo4j integration result
mcp_benchmark.json MCP protocol benchmark (120 calls)
java_compile.json ECJ compilation result
scripts/
build_evaluation_fixture.py generate benchmark from seed
evaluate_workflow.py run and score all four candidates
validate_evidence.py verify claims ledger and privacy rules
benchmark_mcp.py official MCP stdio latency benchmark
verify_neo4j.py live graph integration check
compile_generated.py ECJ compile gate
seed_graph.py materialise fixture into Neo4j
tests/
test_generation_loop.py generation + validation unit tests
test_graph_store.py Neo4j adapter unit tests
test_mcp_protocol.py official MCP protocol conformance
test_evaluation.py evaluation harness tests
test_evidence.py claims ledger integrity tests
test_neo4j_live.py opt-in live graph tests (NEO4J_* env required)
docs/
ARCHITECTURE.md component design and data flow
POLICY_CARD.md candidate selection details
DATA_CARD.md fixture provenance and license
MCP_INTEGRATION.md client configuration guide
DEPLOYMENT.md Docker and container notes
templates/ MCP prompt templates for VS Code Copilot
examples/ sample project preflight scanner경계
이 저장소는 다음 항목을 주장하지 않습니다:
모델 버전과 관계없는 자유 형식 인텐트 파싱품질 — LLM 파이프라인은 옵트인이며, 사용 결과는 고정 평가 결과물에 포함되지 않습니다.
Proprietary 또는 기밀 Java 테스트 프레임워크와의 호환.
프로덕션 지연 SLO — 모든 측정은 단일 프로세스에서 순차 실행된로컬 벤치마크입니다.
동시성, 분산 또는 고가용성 동작 처리.
생성된 Java를 하드웨어 또는 테스트 기기에서 자동 실행.
생산성, 비용, 수율 또는 시간 단축 — 이 저장소에는 생성 및 검증의 근거만 포함되어 있습니다.
전체 기계가 읽을 수 있는 범위는 evidence/claims.json에 있습니다.
라이선스
MIT 라이선스하 배포. 그래프 픽스처, 것, Java 템플릿은 CC0-1.0 (픽스처 메타데이터에 명시).
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Deterministic validation for AI-generated artifacts: JSON Schema, OpenAPI response, SQL syntax.
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rajendarmuddasani/02-genai-test-method-generation'
If you have feedback or need assistance with the MCP directory API, please join our Discord server