graph-mcp-java-gen
graph-mcp-java-gen
그래프 기반 MCP 서버 — 자연어 요청을 검증되고 컴파일 가능한 Java 테스트 메서드로 변환합니다. 허구의 import, 근거 없는 심볼, 조용한 실패는 없습니다.
자연어 또는 구조화된 요청이 공식 Model Context Protocol (MCP) stdio 서버로 들어옵니다. 버전 관리되는 그래프 카탈로그(Neo4j 또는 JSON 픽스처)가 생성기가 인용할 수 있는 유일한 심볼 소스를 제공합니다. 다층 검증기가 소스가 반환되기 전에 구문, 프레임워크 계약, 근거(grounding), 금지 API 규칙을 확인합니다. 두 개의 선택적 LLM 에이전트 — 의도 정규화기(intent normaliser)와 생성 후 검토기(post-generation reviewer) — 가 결정론적 안전 경계를 훼손하지 않으면서 자유 형식 입력까지 파이프라인을 확장합니다.
아키텍처
%%{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 정책에 따른 것입니다.
표면 | 결과 | 아티팩트 |
벤치마크 규모 | 96개 CC0 의도 — 32 dev / 32 val / 32 confirmation | |
확인 작업 성공 | 32 / 32 경계 작업 | |
생성 소스 검증 | 24 / 24 지원 의도 — 구문 + 계약 + 근거 + 안전 | |
안전한 적대적 거부 | 8 / 8 — 오수용(false accept) 0건 | |
인용 정밀도 | 100% — 그래프에서 인용된 심볼만 import됨 | |
필수 심볼 재현율 | 100% — 모든 필수 심볼 존재 | |
실시간 Neo4j 통합 | Neo4j 5.26.29 — 8개 심볼, 12개 메서드 구체화 | |
공식 MCP 벤치마크 | 120 / 120 기대 결과 — 프로토콜 오류 0건 | |
MCP 웜 레이턴시 (p50 / p95 / p99) | 29.13 / 48.61 / 54.23 ms (동시성 1) | |
Java 컴파일 | 8 / 8 클래스 파일 — Eclipse ECJ 3.21 사용 | |
외부 모델 호출 (결정론적 경로) | 0회 호출 · $0.00 |
레이턴시 수치는 단일 프로세스 로컬 Windows 측정값이며, 프로덕션 SLO가 아닙니다.
정책 선택
4가지 생성 정책이 평가되었습니다. 선택 목표는 확인 분할을 열기 전에 선언되었습니다: 모든 안전 게이트를 통과하는 후보 중 검증 작업 성공률을 최대화합니다. 확인은 선택된 후보에 대해 정확히 한 번만 열렸습니다.
%%{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 도구
도구 | 유형 | 동작 |
| 읽기 | 픽스처 식별자, 출처, 라이선스, 백엔드, 심볼 수 반환 |
| 읽기 | 매개변수화된 이름/메서드 검색; 최대 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 표면에 원시 Cypher 없음 — 모든 그래프 쿼리는 매개변수화됩니다.
엄격한 필드 허용 목록 — 클래스 이름, 패키지 이름, 모듈 이름, 버전, 구성 경로는 그래프 조회 전에 컴파일된 정규식 패턴으로 검사됩니다.
소스 안전 스캐너 — 생성된 Java가
Runtime.getRuntime,ProcessBuilder,System.exit,java.io,java.nio.file또는java.net을 참조하면 거부됩니다.경로 탐색 방지 — 구성 경로 필드에서 절대 경로와
..세그먼트가 거부됩니다.근거 강제 — 생성된 소스의 모든 import는 해당 정확한 버전에 대해 그래프에서 검색된 심볼과 일치해야 합니다.
LLM 출력 재검증 — LLM 의도 파서가 추출한 필드는 직접 API 호출과 동일한
GenerationIntent.from_mapping()검증을 통과합니다.Neo4j 자격 증명 — 환경 변수에서만 로드되며, 증거 아티팩트에 기록되거나 반환되지 않습니다.
XML 사전 점검 —
defusedxml이 프로젝트 구조 스캔에서 엔티티 확장 공격을 방지합니다.컨테이너 — 고정된 Chainguard Linux 이미지, 비-root UID/GID 65532; CI는 컨테이너 기반 MCP stdio 스모크 테스트를 수행합니다.
전체 위협 경계는 SECURITY.md를 참조하세요.
저장소 맵
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 파이프라인은 선택 사항이며 그 결과는 고정된 평가 아티팩트에 포함되지 않습니다.
독점 또는 기밀 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.
Proves AI-generated Python does what you asked: lint, types, security, sandbox run, exact fixes.
Browser-backed QA with evidence and fix-ready reports for coding agents.
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/GraphDB_GenAI_MCP_Test_Program_Development'
If you have feedback or need assistance with the MCP directory API, please join our Discord server