MCP Hub
Back to servers

llm-helper

A code intelligence MCP server that implements a structured phase-gate workflow to give LLMs Cursor-like codebase understanding through semantic search, symbol analysis, and impact verification.

Tools
22
Updated
Jan 14, 2026

Code Intelligence MCP Server v1.1

An MCP server that provides Cursor IDE-like code intelligence capabilities using open source tools.

Overview

Even with the same Opus 4.5 model, behavior differs depending on the caller:

CallerBehavior
CursorModifies code after understanding the entire codebase
Claude CodeTends to modify only the specific location

This MCP server provides mechanisms to make Claude Code "understand the codebase".


Design Philosophy

Don't let the LLM decide. Design so it can't proceed without compliance.
And have a mechanism to learn from failures.
PrincipleImplementation
Phase EnforcementTool usage restrictions (semantic_search forbidden in EXPLORATION, etc.)
Server EvaluationConfidence calculated by server, eliminating LLM self-reporting
Structured InputHallucination prevention via Quote verification
Embedding VerificationObjective evaluation of NL→Symbol relevance via vector similarity
Write RestrictionOnly explored files allowed
Improvement CycleLearning via DecisionLog + OutcomeLog + agreements
Automatic Failure DetectionAuto-detect and record previous failures at /code start
Project IsolationIndependent learning data for each project
Essential Context (v1.1)Auto-provide design docs and project rules at session start
Impact Analysis (v1.1)Enforce impact verification before READY phase

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    MCP Clients (Claude Code)                 │
└─────────────────────────────────────────────────────────────┘
                               │
                               ▼
                    ┌─────────────────┐
                    │   code-intel    │  ← Unified MCP Server
                    │  (orchestrator) │
                    └─────────────────┘
                               │
               ┌───────────────┼───────────────┐
               ▼               ▼               ▼
        ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
        │ ChromaDB    │ │ ripgrep     │ │ ctags       │
        │ (map/forest)│ │ (search)    │ │ (symbols)   │
        └─────────────┘ └─────────────┘ └─────────────┘
               │
               ▼
    ┌───────────────────┐
    │ Project/.code-intel│  ← Project-specific
    │ ├─ config.json     │
    │ ├─ chroma/         │  ← ChromaDB data
    │ ├─ agreements/     │
    │ ├─ logs/           │  ← DecisionLog, OutcomeLog
    │ └─ sync_state.json │
    └───────────────────┘

Forest and Map

NameCollectionRoleData Nature
ForestforestSemantic search of entire source codeRaw data / HYPOTHESIS
MapmapPast success pairs / agreementsConfirmed data / FACT

Short-circuit Logic: Map score ≥ 0.7 → Skip Forest exploration


Phase Gates

EXPLORATION → SEMANTIC → VERIFICATION → IMPACT ANALYSIS → READY
     ↓           ↓           ↓               ↓               ↓
  code-intel  semantic    verify         analyze_impact   implementation
   tools      search    (confirm)        (v1.1)           allowed
             (hypothesis)
PhaseAllowedForbidden
EXPLORATIONcode-intel toolssemantic_search
SEMANTICsemantic_searchcode-intel
VERIFICATIONcode-intel toolssemantic_search
IMPACT ANALYSISanalyze_impact, code-intelsemantic_search
READYall-

Tool List

Code Intelligence

ToolPurpose
queryIntelligent query in natural language
find_definitionsSymbol definition search (ctags)
find_referencesSymbol reference search (ripgrep)
search_textText search (ripgrep)
analyze_structureCode structure analysis (tree-sitter)
get_symbolsGet symbol list
sync_indexIndex source code to ChromaDB
semantic_searchUnified vector search of map/forest
analyze_impactAnalyze impact of changes (v1.1)

Session Management

ToolPurpose
start_sessionStart session
set_query_frameSet QueryFrame (Quote verification)
get_session_statusCheck current phase/status
submit_understandingComplete EXPLORATION
validate_symbol_relevanceEmbedding verification
submit_semanticComplete SEMANTIC
submit_verificationComplete VERIFICATION
check_write_targetCheck write permission
add_explored_filesAdd explored files
revert_to_explorationReturn to EXPLORATION

Improvement Cycle

ToolPurpose
record_outcomeRecord outcome (auto/manual)
get_outcome_statsGet statistics

Setup

Step 1: MCP Server Setup (once only)

# Clone repository
git clone https://github.com/tech-spoke/llm-helper.git
cd llm-helper

# Setup server (venv, dependencies)
./setup.sh

Step 2: Project Initialization (per project)

# Initialize target project (index entire project)
./init-project.sh /path/to/your-project

# Option: Index only specific directories
./init-project.sh /path/to/your-project --include=src,packages

# Option: Specify additional exclude patterns
./init-project.sh /path/to/your-project --exclude=tests,docs,*.log

This creates:

your-project/
└── .code-intel/
    ├── config.json       ← Configuration
    ├── chroma/           ← ChromaDB data (auto-generated)
    ├── agreements/       ← Agreements directory
    └── logs/             ← DecisionLog, OutcomeLog

Step 3: Configure .mcp.json

Add the configuration output by init-project.sh to .mcp.json:

{
  "mcpServers": {
    "code-intel": {
      "type": "stdio",
      "command": "/path/to/llm-helper/venv/bin/python",
      "args": ["/path/to/llm-helper/code_intel_server.py"],
      "env": {"PYTHONPATH": "/path/to/llm-helper"}
    }
  }
}

Step 4: Setup Skills (optional)

mkdir -p /path/to/your-project/.claude/commands
cp /path/to/llm-helper/.claude/commands/*.md /path/to/your-project/.claude/commands/

Step 5: Restart Claude Code

Restart to load the MCP server. Index is automatically built on first session start.

Step 6: Essential Context (v1.1, automatic)

Design docs and project rules are automatically detected and summarized.

How it works:

  1. On first sync_index, server auto-detects design docs and project rules
  2. Creates .code-intel/context.yml with detected sources
  3. Returns document content + prompt for LLM to generate summaries
  4. LLM generates summaries and saves via update_context tool
  5. On subsequent syncs, detects changes and regenerates summaries as needed

Auto-detected locations:

  • Design docs: docs/architecture/, docs/design/, docs/
  • Project rules: CLAUDE.md, .claude/CLAUDE.md, CONTRIBUTING.md

Manual customization (optional):

You can edit .code-intel/context.yml to add extra_notes (implicit knowledge not in source docs):

essential_docs:
  source: "docs/architecture"
  summaries:
    - file: "overview.md"
      path: "docs/architecture/overview.md"
      summary: "..."                     # ← Auto-generated by LLM
      extra_notes: |                     # ← Optional: add your implicit knowledge
        - Exception: Simple CRUD can bypass Service layer

project_rules:
  source: "CLAUDE.md"
  summary: "..."                         # ← Auto-generated by LLM
  extra_notes: |                         # ← Optional: add your implicit knowledge
    - Legacy code in /old can ignore these rules
FieldDescription
sourceAuto-detected source path
summaryAuto-generated by LLM
extra_notesManual addition (preserved on regeneration)
content_hashAuto-generated for change detection

Upgrade (v1.0 → v1.1)

If you have existing projects initialized with v1.0, follow these steps to upgrade:

Step 1: Update llm-helper Server

cd /path/to/llm-helper
git pull
./setup.sh  # Update dependencies

Step 2: Update Skills (if copied to project)

cp /path/to/llm-helper/.claude/commands/*.md /path/to/your-project/.claude/commands/

Step 3: Restart Claude Code

Restart to reload the MCP server.

What Changes

Itemv1.0v1.1
Phases45 (IMPACT_ANALYSIS added)
context.ymlNoneAuto-generated
Design docs summaryNoneAuto-provided at session start
Project rulesManual CLAUDE.md referenceAuto-provided at session start

No Changes Required

  • .code-intel/config.json - Compatible, no changes needed
  • .code-intel/chroma/ - Existing index continues to work
  • .mcp.json - No changes needed

The context.yml file will be automatically created on next session start.


Usage

Using /code skill (recommended)

/code Fix the bug in AuthService's login function where no error is shown when password is empty

The skill automatically:

  1. Failure check (auto-detect and record previous failures)
  2. Intent determination
  3. Session start (auto-sync, essential context)
  4. QueryFrame extraction and verification
  5. EXPLORATION (find_definitions, find_references, etc.)
  6. Symbol verification (Embedding)
  7. SEMANTIC if needed
  8. VERIFICATION (hypothesis verification)
  9. IMPACT ANALYSIS (v1.1 - analyze affected files)
  10. READY (implementation)

Direct tool invocation

# Text search
Search for pattern "Router" with mcp__code-intel__search_text

# Definition search
Find definition of "SessionState" with mcp__code-intel__find_definitions

# Semantic search
Search for query "login functionality" with mcp__code-intel__semantic_search

Improvement Cycle

Two Logs

LogFileTrigger
DecisionLog.code-intel/logs/decisions.jsonlOn query execution (auto)
OutcomeLog.code-intel/logs/outcomes.jsonlOn failure detection (auto) or manual

Automatic Failure Detection

At /code start, automatically determines if current request indicates "previous failure":

  • Detects patterns like "redo", "doesn't work", "wrong", etc.
  • Automatically records failure to OutcomeLog
  • No need to manually call /outcome

Dependencies

System Tools

ToolRequiredPurpose
ripgrep (rg)Yessearch_text, find_references
universal-ctagsYesfind_definitions, get_symbols
Python 3.10+YesServer

Python Packages

mcp>=1.0.0
chromadb>=1.0.0
tree-sitter>=0.21.0
tree-sitter-languages>=1.10.0
sentence-transformers>=2.2.0
scikit-learn>=1.0.0
PyYAML>=6.0.0
pytest>=7.0.0

Project Structure

MCP Server (llm-helper/)

llm-helper/
├── code_intel_server.py    ← MCP server main
├── tools/                  ← Tool implementations
│   ├── session.py          ← Session management
│   ├── query_frame.py      ← QueryFrame
│   ├── router.py           ← Query routing
│   ├── chromadb_manager.py ← ChromaDB management
│   ├── ast_chunker.py      ← AST chunking
│   ├── sync_state.py       ← Sync state management
│   ├── outcome_log.py      ← Improvement cycle log
│   ├── context_provider.py ← Essential context (v1.1)
│   ├── impact_analyzer.py  ← Impact analysis (v1.1)
│   └── ...
├── setup.sh                ← Server setup
├── init-project.sh         ← Project initialization
└── .claude/commands/       ← Skill definitions
    └── code.md

Target Project

your-project/
├── .mcp.json               ← MCP config (manual setup)
├── .code-intel/            ← Code Intel data (auto-generated)
│   ├── config.json
│   ├── context.yml         ← Essential context config (v1.1)
│   ├── chroma/             ← ChromaDB data
│   ├── agreements/         ← Success pairs
│   ├── logs/               ← DecisionLog, OutcomeLog
│   └── sync_state.json
├── .claude/commands/       ← Skills (optional copy)
└── src/                    ← Your source code

Documentation

DocumentContent
DESIGN_v1.0.mdOverall design
INTERNALS_v1.0.mdInternal details
DESIGN_v1.0.md (Japanese)Overall design (Japanese)
INTERNALS_v1.0.md (Japanese)Internal details (Japanese)

License

MIT

Reviews

No reviews yet

Sign in to write a review