neurocode
NeuroCode is an MCP server for local code-graph analysis, bounded context extraction, safe patching, and on-device model-assisted repair.
Slice repository context under a strict token budget using Code Property Graph reachability.
Analyze a symbol or file’s structural blast radius: upstream callers and downstream callees.
Discover root-cause candidate functions/classes from an issue or traceback.
Look up symbols with exact file paths, line spans, callers, and callees.
Validate proposed SEARCH/REPLACE patches for target existence and syntax before writing.
Graft or replace AST subtrees across Python, TypeScript, JavaScript, Go, and Rust, with preview, optional tests, and auto-rollback.
Trace execution call paths between two symbols.
Generate Mermaid.js architecture and call-edge diagrams.
Run single-turn bug repair through a local Ollama model, optionally applying the patch.
Check local hardware health, including VRAM/GPU headroom and tmpfs RAM availability.
Provides a repair tool that streams single-turn patch generation to a local Ollama daemon at http://localhost:11434, enabling offline code repair with local models such as Qwen2.5-Coder.
NeuroCode: Heterogeneous Code-Graph Slicing for On-Device Autonomous Software Engineering
NeuroCode is a lightweight, heterogeneous neuro-symbolic framework and Model Context Protocol (MCP) server that enables small, local language models (1.5B–14B parameters) to fix multi-file software engineering bugs on consumer laptops (e.g., 4GB–8GB VRAM) without cloud API dependency or Out-of-Memory (OOM) crashes.
📌 Academic Reproducibility Notice:
For benchmark reproduction and evaluation datasets corresponding to the 35th IEEE/ACM ICPC 2027 (Submission #63) and the Elsevier Journal of Parallel and Distributed Computing (JPDC), please refer to frozen release tagv0.1.1. Themasterbranch represents the actively maintained multi-language production release.
🌐 Multi-Language Code Property Graph & AST Grafting
NeuroCode natively parses and deterministically mutates code across 5 programming languages using in-memory Tree-sitter AST grammars:
Python (
.py)TypeScript (
.ts,.tsx)JavaScript (
.js,.jsx,.mjs,.cjs)Go (
.go)Rust (
.rs)
Related MCP server: obsidian-local-mcp
🏛️ System Architecture

Unlike traditional coding agents that dump entire raw files into context windows (causing severe VRAM OOMs) or get trapped in multi-turn exploratory shell loops (grep, find, cat), NeuroCode divides cognitive labor across the PC hardware boundary:
Host CPU & RAM (Deterministic Graph Engine):
Uses Tree-sitter and NetworkX to build an in-memory Code Property Graph (CPG) in milliseconds.
Computes a topological $k$-hop reachability closure around fault candidates.
Solves a bounded 0/1 knapsack optimization problem to select high-relevance AST subtrees strictly under the model's token limit ($B \le 1,200$ tokens).
Device GPU (Neural Synthesis Engine):
Ingests only the bounded sliced context across PCIe.
Generates single-turn
SEARCH/REPLACEdiff patches with zero exploratory token waste.Completely prevents KV-cache quadratic blowup and GPU OOM cliff failure.
📊 Comprehensive Empirical Evaluation (5-Benchmark Suite)
NeuroCode was evaluated across 5 comprehensive benchmark tracks spanning real-world repository repair, standalone algorithm synthesis, multi-file cross-boundary retrieval, and low-level hardware telemetry.
Benchmark Suite | Metric | Baseline / BM25 | NeuroCode (Ours) | Advantage |
SWE-bench Lite ($N=292$) | Valid Diff Apply / Resolved | 0.0% (OOM on 4GB) / 0.0% | 41.4% apply / 9.5% resolved | Prevents OOM cliff; +23.9% apply over BM25 |
HumanEval ($N=164$) | Pass@1 (Unit Test) | 80.5% | 86.0% (141/164) | +5.5% via syntax-aware graph repair |
MBPP ($N=100$) | Pass@1 (Unit Test) | 81.0% | 87.0% (87/100) | +6.0% algorithmic verification |
RepoBench-R ($N=150$) | Recall@1 / Token Budget | 18.0% (745 tokens) | 100.0% (428 tokens) | -42.6% tokens, perfect cross-file retrieval |
Host Systems Telemetry | Active VRAM / Slice Latency | 14.2 GB (OOM) | 961.2 MB / 0.62 ms | 93.2% VRAM reduction, 0 OOMs |
💻 Physical Laptop Edge Validation (NVIDIA RTX 3050 Laptop GPU)
Tested live on an everyday developer laptop (AMD Ryzen 7 7435HS + NVIDIA RTX 3050 Laptop GPU, 4.0 GB VRAM):
Peak Active VRAM: 961.2 MB (Only 25.5% GPU capacity, leaving 2.54 GB buffer for system desktop UI).
Throughput: 15.8 tokens/second locally.
Host Slicing Overhead: 0.04 ms on CPU.
Disk SSD Wear: 0.0 GB (100% in-memory ephemeral RAM execution via
/dev/shm).
🔌 Model Context Protocol (MCP) Integration
NeuroCode provides an official stdio Model Context Protocol (MCP) server conforming to specification 2024-11-05. Connect NeuroCode directly to Claude Desktop, Cursor, Continue.dev, or VS Code!
Native MCP Tools Exposed:
neurocode_slice: In-memory CPG reachability slicing bounded strictly under token budget ($B \le 1,200$).neurocode_graft: Deterministic AST subtree grafting with automatic indentation alignment and optional test verification with auto-rollback.neurocode_trace: Sub-millisecond execution call-chain path tracing connecting functions and symbols.neurocode_map: Instant zero-token architecture flowchart (Mermaid.js) of the codebase.neurocode_impact: Structural blast radius inspection (all upstream callers and downstream callee invocations in <2 ms).neurocode_symbol: Sub-millisecond AST symbol lookup returning file locations, line spans, and callers.neurocode_validate_patch: In-memory pre-flight patch verification for syntax errors before writing to disk.neurocode_seeds: Static root-cause candidate entity discovery in $<2$ ms.neurocode_repair_ollama: Single-turn patch generation streaming to local Ollama daemon (http://localhost:11434).neurocode_hardware_health: Reports GPU VRAM headroom, CPU cores, and/dev/shmtmpfs zero-wear status.
1. Claude Desktop Setup
Add the following to your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"neurocode": {
"command": "/absolute/path/to/neurocode/.venv/bin/neurocode-mcp",
"args": []
}
}
}2. Cursor IDE Setup
Add to .cursor/mcp.json or your Cursor settings:
{
"mcpServers": {
"neurocode": {
"command": "neurocode-mcp",
"args": []
}
}
}3. Continue.dev Setup
Add to your ~/.continue/config.json:
{
"experimental": {
"modelContextProtocolServers": [
{
"name": "neurocode",
"command": "neurocode-mcp",
"args": []
}
]
}
}💻 Visual Studio Code Extension
Install directly from the Visual Studio Marketplace:
code --install-extension DeepakR.neurocode-ai(Or download the .vsix binary from the v0.1.0 Release)
Extension Features:
Status Bar Telemetry: Live VRAM headroom and
/dev/shmRAM health indicators.Context Slicing: Right-click any active file or code block to extract sub-1,200 token reachability closure in $<100$ ms.
1-Click Prompt Copy: Instant paste into Cursor, Claude, or Copilot without context overflow.
Autonomous Diff Viewer: Direct side-by-side patch inspection powered by local Ollama backbones.
🚀 Quickstart & CLI Usage
1. Installation via PyPI
pip install neurocode-ai(Or install locally from source: git clone https://github.com/Arkz-Deepak/neurocode.git && cd neurocode && pip install -e .)
2. Extract Token-Bounded Slice for Any Issue
# Slices your codebase into a tight, bug-focused prompt under 1200 tokens
neurocode slice --repo /path/to/repo --issue "Fix ZeroDivisionError in matrix normalization" --budget 12003. Repair Code via Local Ollama Daemon (Zero Cloud API)
# Runs full repair using local Qwen2.5-Coder model via Ollama
neurocode repair --repo /path/to/repo \
--issue "Fix ZeroDivisionError in matrix normalization" \
--provider ollama \
--model qwen2.5-coder:7b \
--apply4. Interactive Copilot Direct on Laptop GPU
neurocode-copilot👤 Author & Affiliation
Author: Deepak R.
Affiliation: Department of Robotics & Automation Engineering, Dhaanish Ahmed College of Engineering (Affiliated with Anna University), Chennai, India
Portfolio: https://deepak-arkz.me
GitHub: @Arkz-Deepak
📄 Publications & Preprints
35th IEEE/ACM International Conference on Program Comprehension (ICPC 2027):
Track: Tool Demonstration Track (Submission #63)
Title: NeuroCode: In-Memory Code Property Graph Slicing and Edge SWE Agent for Resource-Constrained Environments
Journal of Parallel and Distributed Computing (Elsevier, JPDC):
Track: Full Research Article (Traditional Subscription, ₹0 APC)
Title: On-Device Autonomous Software Engineering: In-Memory Code Property Graph Reachability Slicing under Edge VRAM Constraints
Status: Transferred & Under Review (Scopus Q1)
Kaggle Empirical Reproduction: Kaggle Notebook Live
Citation
@article{deepak2026neurocode,
title={NeuroCode: Budget-Constrained Heterogeneous Code-Graph Slicing for Local Software Repair},
author={Deepak, R.},
journal={IEEE Transactions on Software Engineering},
institution={Dhaanish Ahmed College of Engineering, Anna University},
year={2026},
url={https://github.com/Arkz-Deepak/neurocode}
}📜 License
This project is licensed under the MIT License.
Available Tools
10 toolsneurocode_graftA
Perform deterministic AST subtree grafting on Python, TypeScript, JavaScript, Go, or Rust code. Directly mutates/replaces a specific function, class, or method AST node without fragile whitespace diff errors. Supports test_command with automated rollback on test failures.
Inputs: symbol (required), file_path (required), replacement_code (required), apply, +3 more.
neurocode_hardware_healthB
Check local hardware capacity (VRAM allocation, GPU headroom, and tmpfs RAM availability).
Inputs: no named parameters.
neurocode_impactA
Analyze the structural blast radius before editing code. Statically reveals all upstream callers, downstream invocations, and file locations in <2 ms.
Inputs: target (required), repo_path.
neurocode_mapB
Generate a zero-token high-level architecture diagram (Mermaid.js flowchart) showing module relationships and call edges across the codebase.
Inputs: repo_path.
neurocode_repair_ollamaC
Perform single-turn bug repair by sending a knapsack-sliced prompt to a local Ollama model instance.
Inputs: issue (required), apply, model, repo_path, +1 more.
neurocode_seedsA
Statically identify root-cause candidate functions, methods, and classes from an issue description or traceback in <2 ms.
Inputs: issue (required), repo_path.
neurocode_sliceA
Extract an AST-sliced repository context bounded strictly under token budget (<=1,200 tokens) using Host-side Code Property Graph reachability. Use this instead of reading entire files into LLM context.
Inputs: entry, issue, budget, repo_path.
neurocode_symbolA
Instantly lookup classes, functions, or methods in the Code Property Graph without reading files. Returns exact file path, lines, callers, and callees in <2 ms.
Inputs: symbol (required), repo_path.
neurocode_traceB
Trace execution call paths connecting two functions, classes, or symbols across the codebase in <1 ms using in-memory Code Property Graph reachability.
Inputs: to (required), from (required), repo_path.
neurocode_validate_patchA
Pre-flight verification for proposed code patches. Checks that the target search block exists in the file and verifies that the replacement parses as valid syntax with zero AST syntax errors before writing to disk.
Inputs: patch, file_path, repo_path, search_block, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools have clearly distinct purposes (lookup vs. slicing vs. mutation vs. repair). There is mild overlap between the call-graph analysis trio (impact, trace, seeds) and between slice and symbol, since all retrieve or reason about code structure, but the descriptions give enough cues to separate them.
All tools use the same neurocode_ prefix and snake_case, which is predictable. The only deviation is that some names are verbs (validate_patch, slice, graft) while others are nouns (impact, seeds, symbol, map), so the verb_noun pattern is not uniform.
Ten tools is well within the sweet spot and each maps to a distinct phase of the workflow (discover, analyze, patch, repair, verify). No tool feels redundant padding.
The surface covers discovery, structural analysis, mutation, validation, and an LLM repair path, which is strong lifecycle coverage for a code-editing server. Minor gaps exist: no raw file-read/search tool and no standalone test-execution tool (tests are only an argument to graft), which an agent might need in some workflows.
Maintenance
Related MCP Connectors
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
Codebase knowledge graph — architectural awareness for AI coding agents via MCP
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Related MCP Servers
- AlicenseAqualityAmaintenanceKnowledge graph for token-efficient code reviews. Builds a structural map of your codebase with Tree-sitter, tracks changes incrementally, and gives AI agents precise context via MCP tools. Features fixed multi-word search, qualified call resolution, dual-mode embedding (ONNX local + LiteLLM cloud), and output pagination.676Apache 2.0
- FlicenseBqualityBmaintenanceTurns local code repositories into a queryable dependency graph built from AST parsing and git co-edit history, then exposes it alongside an Obsidian vault as persistent memory. Enables context retrieval, impact analysis of proposed changes, and curation of durable prose knowledge through full-text search and Personalized PageRank classification—all fully offline without API keys or embeddings.30-
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents and IDEs to query a local structural code graph and retrieve focused, token-bounded context on code entities, Git relationships, callers/callees, impact, paths, and recorded mistakes for more efficient sessions.24 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents to query a local structural code graph and receive focused, token-bounded context about source entities, relationships, Git co-change, and selected project memory without reading full files.24 npmMIT