codeparse-mcp
Enables GitHub Copilot to generate unit tests with full MC/DC coverage for Java/Xtend code by providing code structure, control flow, and MC/DC conditions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codeparse-mcpget UT context for class MyService"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
codeparse-mcp
Java/Xtend Code Parser → IR → Graph DB → MCP Server Knowledge base for AI-driven ISO 26262 ASIL-D unit test generation with 100% MC/DC + C0 + C1 coverage.
Architecture (v3)
Java/Xtend Sources
│
├── JavaParser AST Extractor (Java CLI, production)
│ └── Decision IR (JSON, camelCase)
│ │
├── Xtend AST Extractor (line-based POC)
│ └── Decision IR (JSON, camelCase)
│ │
├── Fallback JS Java Parser (java-parser npm CST)
│ └── Decision IR (JSON, camelCase)
│ │
└── Fallback JS Xtend Parser (pattern-based)
└── Decision IR (JSON, camelCase)
│
▼
┌─────────────────────┐
│ ir-ingest.js │
│ Validate IR schema │
│ Compute MC/DC │
│ (centralized, not │
│ duplicated per │
│ parser) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ SQLite Graph DB │
│ (better-sqlite3) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ MCP Server │
│ 20 tools via stdio │
│ Compatible with: │
│ • GitHub Copilot │
│ • Claude Desktop │
│ • Any MCP client │
└─────────────────────┘Key design: AI reads MCP only — never reads raw IR or source files directly. IR is an internal transport format.
Related MCP server: NOMIK
Quick Start
Local
git clone <repo>
cd codeparse-mcp
npm install
# Initialize DB for your project
node src/cli/index.js init --root /path/to/your/project
# Parse all Java/Xtend files
node src/cli/index.js sync --root /path/to/your/project
# Check status
node src/cli/index.js statusDocker
docker build -t codeparse-mcp:latest .
# Init DB
docker run --rm \
-v /your/project:/project:ro \
-v codeparse-data:/data \
codeparse-mcp:latest init
# Sync
docker run --rm \
-v /your/project:/project:ro \
-v codeparse-data:/data \
codeparse-mcp:latest sync
# Status
docker run --rm \
-v /your/project:/project:ro \
-v codeparse-data:/data \
codeparse-mcp:latest status
# Or with docker compose
PROJECT_ROOT=/your/project docker compose run --rm codeparse syncCLI Commands
Command | Description |
| Initialize/reset graph database |
| Parse all files, sync changes only |
| Show graph stats and health |
| Sync a single file (incremental) |
| Import JUnit/JaCoCo results |
| Generate ISO 26262 evidence package |
Sync Options
codeparse sync \
--force # Re-parse all files
--include "**/*.java,**/*.xtend" # Custom patterns
--exclude "**/generated/**" # Extra exclusions
--verbose # Per-file progressImport Test Results
# Import JUnit XML + JaCoCo coverage
codeparse import-results \
--junit build/test-results/test # JUnit Surefire XML dir
--jacoco build/reports/jacoco/test/jacoco.xmlGenerate Evidence Package
codeparse evidence \
--asil D \
--class com.example.SafetyController \
--output evidence/Generates 10-file ISO 26262 evidence package:
Decision list, MC/DC matrix, test mapping, traceability matrix
Coverage gap analysis, audit summary, test specification
Requirements cross-reference, review checklist, compliance report
MCP Integration
GitHub Copilot (.vscode/mcp.json)
{
"servers": {
"codeparse": {
"type": "stdio",
"command": "node",
"args": ["${workspaceFolder}/src/mcp/server.js"]
}
}
}Claude Desktop (claude_desktop_config.json)
See config/claude-desktop-mcp.json for full example.
MCP Tools (20 total)
Lifecycle
Tool | Description |
| Initialize/reset DB |
| Parse and sync all files |
| DB health and statistics |
| Sync a single file |
Class Queries
Tool | Description |
| Full class info (fields, hierarchy, annotations, ASIL) |
| Find classes by name pattern |
Method Queries
Tool | Description |
| All methods for a class |
| Find methods by name/signature |
| Full source context: code, fields, calls, decisions, parse quality |
Control Flow Graph
Tool | Description |
| CFG nodes + edges for a method (C0/C1 coverage) |
| All decisions with decomposed atomic conditions (decision-UID scoped) |
MC/DC (ISO 26262 ASIL-D)
Tool | Description |
| MC/DC conditions, truth tables, independence pairs per method |
| All MC/DC data for entire class |
Call Graph
Tool | Description |
| Methods called by a method (mock targets) |
| Methods that call a method (impact analysis) |
UT Generation (primary AI workflow)
Tool | Description |
| Primary tool — full context: class + methods + CFG + MC/DC + field accesses + boundary hints + mock targets in one call |
| Import dependencies for a file |
Evidence & Coverage (v2.5)
Tool | Description |
| Import JUnit XML + JaCoCo XML coverage data |
| Query line/branch/instruction coverage per class/method |
| Generate 10-file ISO 26262 evidence package |
What Gets Parsed
Java
Package and import declarations
Class/interface/enum/annotation declarations (nested included)
All modifiers, annotations, Javadoc
Method signatures, parameters, return types, throws
Field declarations with types and visibility
CFG: if/for/while/do/switch/try/catch/return/throw/break/continue nodes and edges
MC/DC: boolean condition decomposition via AST tree parser, truth tables, independence pairs
else ifkind detection (not plainif)Call graph: method invocations with line numbers
Field access tracking (reads and writes via
this./obj.)ASIL level detection from
@ASIL_Dannotations or/** @ASIL D */JavadocException types on CATCH/THROW CFG nodes
Ternary expressions (
cond ? a : b) as decisions
Xtend
Package, import, class declarations
def,override,dispatchmethodsval/varfields + Java-style fieldsAll visibility modifiers
CFG: if/for/while/do/switch/try/catch/return/throw (pattern-based) with loop body edges
MC/DC analysis on boolean expressions
Balanced-parenthesis condition extraction (handles nested parens)
Extension method detection
«IF»/«ELSEIF»template condition parsingTernary expressions with nested ternary support
ASIL annotation detection
Graph DB Schema
The SQLite database stores:
files → source file registry + SHA-256 for change detection
packages → Java package index
classes → class/interface/enum with full metadata + ASIL level
methods → method signatures + CFG stats + MC/DC summary + ASIL level
fields → class fields
cfg_nodes → CFG nodes per method (ENTRY, STATEMENT, BRANCH, LOOP, CATCH, THROW, ...)
cfg_edges → CFG edges (sequential, true_branch, false_branch, exception, loop_back)
call_edges → caller → callee relationships
field_accesses → per-method field read/write tracking (mock/state setup)
dependencies → file-level import and type dependencies
decisions → each branch point (if/while/for/ternary/etc.) with expression
conditions → atomic conditions decomposed from decisions (condition-UID scoped)
mcdc_conditions → expanded MC/DC with truth tables and independence pairs
mcdc_pairs → normalized per-condition independence pairs with test vectors
test_cases → test-to-target method traceability
test_results → JUnit execution results (from Surefire XML)
coverage_records → JaCoCo line/branch/instruction coverage
evidence_log → evidence package generation tracking
parse_errors → per-file error logEvidence Export Package (v2.5)
The export_evidence_plan MCP tool (or codeparse evidence CLI) generates 10 ISO 26262 evidence files:
File | Content |
| All decisions with UIDs, kind, expression, conditions |
| MC/DC independence pairs per condition |
| Test cases mapped to decisions/conditions |
| Requirements → decisions → tests |
| Uncovered branches/pairs analysis |
| Audit trail with timestamps |
| Generated test specification |
| ISO 26262 requirement cross-reference |
| Peer review checklist |
| ASIL-D compliance summary |
Incremental Sync
Files tracked by SHA-256 hash. On each sync:
New files → parsed and inserted
Changed files → deleted from DB (cascade) and re-parsed
Unchanged files → skipped (fast)
Call graph → second-pass resolution of caller→callee IDs
Content hash prevents re-parsing identical files on repeated runs
Safe to run on every save or in CI without performance penalty.
Extractor Chain (Auto-Fallback)
When parsing a file, the system tries in order:
Java AST Extractor (
extractors/java/) — Java CLI tool using JavaParser library, produces full IRXtend AST Extractor (
extractors/xtend/) — line-based POC, template_if/elseif/ternary supportFallback JS parser —
java-parser.js(CST via npm) orxtend-parser.js(pattern-based)
Extractors produce camelCase IR JSON. Fallback runs if Java is not available.
MC/DC pair computation is centralized in ir-ingest.js — not duplicated per parser.
Configuration (.codeparse.json)
{
"projectRoot": "/path/to/project",
"dbPath": "/path/to/.codeparse/graph.db",
"include": ["**/*.java", "**/*.xtend"],
"exclude": [
"**/node_modules/**",
"**/build/**",
"**/target/**",
"**/.gradle/**",
"**/generated/**"
]
}Environment variable override (for Docker): CODEPARSE_PROJECT_ROOT, CODEPARSE_DB_PATH.
Extending: Add More Languages
Add parser in
src/parser/<lang>-parser.jsexportingparse<Lang>(source, path)→{ packageName, imports, classes }Add AST extractor in
extractors/<lang>/producing camelCase IR JSONAdd extension to
includeglobs in configRegister parsing branch in
src/graph/builder.jssyncProjectswitchIR ingest in
src/graph/ir-ingest.jshandles MC/DC automatically
Known Gaps (P3)
No lambda/stream support —
.filter().map()logic invisible to CFGNo switch expressions (Java 17+
->arrow cases)No
dispatchmethod support in Xtend parserNo Xtend extension method resolution
No JML/pre-post condition parsing
No requirement/safety-goal traceability table in schema
Requirements
Node.js ≥ 20
Or Docker (no Node required on host)
SQLite (bundled via better-sqlite3)
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
AI-powered codebase analysis — call graphs, security, dead code, complexity. 150+ tools.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceDev intelligence layer that builds a knowledge graph from any codebase and exposes 7 MCP tools for graph-powered reasoning, impact analysis, and preflight safety and governance checks.222 PyPI32Apache 2.0
- FlicenseNot gradedqualityDmaintenanceAI-native code intelligence graph that builds a persistent knowledge graph of your codebase in Neo4j and exposes it to AI assistants via MCP, enabling contextual code analysis, impact analysis, and dependency tracking.23-
- AlicenseNot gradedqualityAmaintenanceProvides code intelligence for AI coding agents by indexing repositories into a hybrid knowledge graph, enabling agents to query dependencies, impact, and context through 28 MCP tools.3Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables parsing, indexing, and querying source code as structured knowledge, providing code exploration, spec generation, and migration tools via 20 MCP tools.MIT