Skip to main content
Glama

KernelMind MCP

Evidence-based Linux kernel engineering for AI agents — citations, not hallucinations.

License: GPL v2 MCP Compatible Python 3.12+

KernelMind MCP is a Model Context Protocol server that turns the public corpus of Linux kernel knowledge — git history, LKML / lore.kernel.org, Patchwork, and Documentation/ — into a queryable, evidence-ranked knowledge platform for AI coding and planning agents.

Every tool response carries an explicit evidence chain: which commit, which mailing-list thread, which patch state transition supports the conclusion — plus explicit assumptions and contradictions when the evidence is incomplete. Performance claims are never fabricated; the system flags them hardware_validation_required instead.

Why

LLMs hallucinate kernel facts — invented signatures, misremembered locking rules, APIs removed years ago cited as current. KernelMind's contract:

  1. Index primary sources, kept current by incremental sync (never full rebuild)

  2. Fuse dense vectors + BM25 + PostgreSQL full-text via Reciprocal Rank Fusion (k=60)

  3. Rank by a fixed evidence hierarchy: commit messages > LKML consensus > Documentation/ > maintainer comments > accepted patches > LWN > source code > rejected RFCs > vendor trees

  4. Return evidence_sources, assumptions, contradictions, and hardware_validation_required on every engineering conclusion

Subsystem-agnostic by design: works identically on mainline, stable, linux-next, and vendor trees.

Related MCP server: context-atlas

Features & Registered Tools

KernelMind MCP provides 16 specialized, evidence-first engineering tools across 5 categories:

Category

Available MCP Tools

Description

Source Code

search_kernel_code, lookup_symbol

Search kernel C source code and lookup symbol definitions with AST tree-sitter chunking

Git Intelligence

search_commits, get_commit_details, get_file_history, blame_line_range

Inspect commit history, blame line ranges, and trace file evolution

Patchwork & LKML

search_patches, get_patch_details, search_lkml, get_thread_details

Query patch discussions, LKML thread consensus, and patch state transitions

Research & Risk

analyze_patch_series, analyze_subsystem_risk

Evaluate stability ratings, race/locking risk factors, and hardware validation requirements

Documentation & LWN

search_docs, get_doc_details, search_lwn, get_lwn_article

Search kernel Documentation/ files and Linux Weekly News articles

MCP prompts implement a 9-stage agent workflow: Knowledge Gathering → Subsystem Understanding → Architecture Modeling → Maintainer Review → Hypothesis Generation → Experiment Design → Implementation Planning → Patch Review → Self-Critique.

Architecture

AI Agent (Opencode / Claude Code / any MCP host)
      │  JSON-RPC 2.0 — stdio (default) or Streamable HTTP
      ▼
MCP Gateway (validation, auth, audit)
      ▼
Tools → Hybrid Search (Qdrant + BM25 + PG FTS, RRF)
      → EvidenceCorrelator (priority tiers, assumptions, contradictions)
      ▼
PostgreSQL · Qdrant · Neo4j · Redis · MinIO
      ▲
Incremental Sync (Celery): git delta · LKML/lore · Patchwork
(state-transition tracking across all 12 patch states) · Documentation/

Indexing is kernel-aware: tree-sitter C grammar chunks at function/struct/macro granularity without splitting function bodies; subsystem attribution is parsed from MAINTAINERS (longest-prefix match) — no hardcoded maps.

Details: docs/ARCHITECTURE.md

Quick Start

git clone https://github.com/Reinazhard/kernelmind-mcp.git
cd kernelmind-mcp
cp .env.example .env       # set EMBEDDING_* and any overrides
docker compose up -d --build
curl http://localhost:8080/health

Opencode (opencode.json)

{
  "mcp": {
    "kernelmind": {
      "type": "local",
      "command": ["docker", "compose", "exec", "-T", "kernelmind-mcp",
                  ".venv/bin/python", "-m", "kernelmind.server", "--stdio"],
      "enabled": true
    }
  }
}

Any stdio MCP client uses the same command. For remote hosts, set KERNELMIND_TRANSPORT=streamable-http and connect to http://<host>:8080/mcp. See docs/OPENCODE.md and docs/DEPLOYMENT.md.

Configuration

All config via environment variables (Pydantic, fail-fast at startup) — see .env.example.

Variable

Default

Purpose

KERNELMIND_TRANSPORT

stdio

stdio or streamable-http

KERNELMIND_EMBEDDING_BASE_URL / KERNELMIND_EMBEDDING_API_KEY / KERNELMIND_EMBEDDING_MODEL

—

Embedding provider (required)

KERNELMIND_POSTGRES_DSN, KERNELMIND_QDRANT_URL, KERNELMIND_NEO4J_URI, KERNELMIND_REDIS_URL, KERNELMIND_S3_ENDPOINT

compose defaults

Storage backends

KERNELMIND_HOST / KERNELMIND_PORT

0.0.0.0 / 8080

HTTP Server Bind Address

Project Status

Phase completion and known limitations: docs/PROGRESS.md. Available tool reference: docs/TOOLS.md. Deployment guide: docs/DEPLOYMENT.md.

License

GPL-2.0 — see LICENSE.

Available Tools

16 tools
analyze_patch_seriesA

Analyze a series of kernel patches for risks, subsystems, and evidence.

Args: patches: Sequence of patch dictionaries containing name/diff_content. subsystem_hint: Optional initial subsystem assumption.

Returns: Dictionary with analysis summary, risk flags, and evidence sources.

Inputs: patches (required), subsystem_hint. Returns: object

analyze_subsystem_riskA

Analyze overall engineering risk and stability for a kernel subsystem.

Args: subsystem: Kernel subsystem identifier (e.g. 'mm', 'sched', 'net'). time_range: Time period for analysis (default: '30d').

Returns: Dictionary containing risk_score, stability_rating, risk_factors, hardware_validation_required, summary, and evidence_sources.

Inputs: subsystem (required), time_range. Returns: object

blame_line_rangeA

Get commit attribution for a specific line range in a file.

Args: file_path: Relative file path in kernel tree. start_line: Starting line number (1-indexed). end_line: Ending line number. repo: Optional repository filter.

Returns: Dictionary with line range attributions and evidence sources.

Inputs: end_line (required), file_path (required), start_line (required), repo. Returns: object

get_commit_detailsA

Retrieve detailed metadata for a specific kernel commit SHA.

Args: sha: Complete or prefix commit SHA. repo: Optional repository name filter.

Returns: Dictionary with commit metadata and evidence sources.

Inputs: sha (required), repo. Returns: object

get_doc_detailsA

Retrieve full content and section headings for a kernel document.

Args: doc_id: Document file path (e.g. Documentation/net/core.rst).

Returns: Dictionary containing document title, sections, and evidence_sources.

Inputs: doc_id (required). Returns: object

get_file_historyA

Get commit history and symbol evolution for a kernel file path.

Args: file_path: Relative file path in kernel tree. repo: Optional repository filter. limit: Max commits to return.

Returns: Dictionary with file commit history and evidence sources.

Inputs: file_path (required), repo, limit. Returns: object

get_lwn_articleA

Retrieve full details and symbol references for an LWN article.

Args: article_id: Unique LWN article ID (e.g. LWN-900100).

Returns: Dictionary containing article title, author, body, and evidence_sources.

Inputs: article_id (required). Returns: object

get_patch_detailsA

Retrieve full metadata and state transition history for a patch.

Args: patch_id: Patchwork message/patch ID.

Returns: Dictionary with patch details, history, and evidence sources.

Inputs: patch_id (required). Returns: object

get_thread_detailsB

Retrieve full details and body excerpt for an LKML thread.

Args: message_id: Email message ID of the thread.

Returns: Dictionary with thread metadata and evidence sources.

Inputs: message_id (required). Returns: object

lookup_symbolA

Look up a specific symbol (function, struct, macro) in kernel source.

Args: name: The name of the symbol to look up. kind: Optional kind of symbol (e.g., 'function', 'struct'). repo: Optional repository to filter by.

Returns: Dictionary containing location, definition, and evidence sources.

Inputs: name (required), kind, repo. Returns: object

search_commitsA

Search kernel git commits by message, author, or subsystem.

Args: query: Keywords to search in commit messages. author: Optional author filter. file_path: Optional file path filter. subsystem: Optional subsystem filter. limit: Max number of commits to return.

Returns: Dictionary with matching commits and evidence sources.

Inputs: query (required), limit, author, file_path, +1 more. Returns: object

search_docsA

Search kernel documentation files by query or subsystem.

Args: query: Keywords to search in document titles and headings. subsystem: Optional subsystem filter (e.g. 'net', 'mm'). limit: Maximum number of documentation results to return.

Returns: Dictionary containing matching 'docs' list and 'evidence_sources'.

Inputs: query (required), limit, subsystem. Returns: object

search_kernel_codeA

Search for kernel code using hybrid search across all indexed data.

Args: query: The search query string. repo: Optional repository to filter by. subsystem: Optional subsystem to filter by. limit: Maximum number of results to return.

Returns: Dictionary containing results and correlated evidence sources.

Inputs: query (required), repo, limit, subsystem. Returns: object

search_lkmlA

Search Linux Kernel Mailing List threads by subject or excerpt.

Args: query: Search keywords. subsystem: Optional subsystem filter. author: Optional from_addr filter. limit: Max results.

Returns: Dictionary with matching threads and evidence sources.

Inputs: query (required), limit, author, subsystem. Returns: object

search_lwnA

Search Linux Weekly News (LWN) articles on kernel development.

Args: query: Keywords to search in article titles and body. subsystem: Optional subsystem filter (e.g. 'mm', 'sched'). limit: Maximum number of articles to return.

Returns: Dictionary containing 'articles' list and 'evidence_sources'.

Inputs: query (required), limit, subsystem. Returns: object

search_patchesA

Search submitted kernel patches by query, submitter, or state.

Args: query: Search terms for patch name. submitter: Optional submitter filter. state: Optional patch state filter. subsystem: Optional subsystem filter. limit: Max results.

Returns: Dictionary of matching patches and evidence sources.

Inputs: query (required), limit, state, submitter, +1 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 16 tools

    Disambiguation5/5

    Every tool targets a distinct resource type and action. Search tools are differentiated by target (code, commits, patches, LKML, docs, LWN), and detail tools map one-to-one to those search targets. Even similar tools like search_kernel_code and lookup_symbol are clearly separated by broad search vs. exact symbol lookup.

    Naming Consistency5/5

    All tool names follow a consistent lowercase snake_case verb_noun pattern (search_*, get_*, lookup_symbol, blame_line_range, analyze_*). No mixed conventions or ambiguous verbs; the naming scheme is uniform and predictable.

    Tool Count4/5

    At 16 tools, the set is slightly above the typical 3-15 ideal range, but the breadth of the domain (code, commits, patches, LKML, docs, LWN, risk analysis) justifies each tool's existence. No redundant or trivial tools are present.

    Completeness5/5

    The tool surface provides full lifecycle coverage for kernel intelligence: search and retrieve operations for each data type (code, commits, patches, LKML, docs, LWN), plus specialized analysis (patch series, subsystem risk, file history, blame). No obvious gaps prevent an agent from answering kernel-related questions or performing deep investigations.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables LLMs to query a local commitment ledger and knowledge base extracted from email, calendar, and meeting transcripts, allowing natural language search for facts, people, and open commitments, and suggesting closures with evidence.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to query a local, versioned knowledge graph of a software project, retrieving overviews, context packs, evidence, and explanations to make informed changes.
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to interrogate a local repository deterministically for symbols, dependencies, call paths, routes, tests, and Git impact, returning verified structured evidence with exact line citations instead of requiring the whole codebase to be read.
      45 PyPI
      5
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to query repository structure, symbols, dependencies, Git history, architecture, memory, impact, and guarded edits through a stable MCP interface, returning ranked task-specific evidence within a context budget.
      49 PyPI
      8
      Apache 2.0