kernel-mcp
Provides tools for performing git bisect sessions to locate the commit that introduced a regression.
Enables AI-powered Linux kernel development tasks such as symbol search, building, static analysis, QEMU booting, and patch review.
Provides tools for booting kernel images in QEMU, configuring virtual machines, and managing session lifecycle including shutdown.
Click on "Install 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., "@kernel-mcpFind the definition of schedule() and show its call graph"
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.
kernel-mcp
AI-powered Linux kernel development assistant as an MCP server for IBM Bob.
kernel-mcp is a Python MCP server that exposes kernel development tools — symbol search, static analysis, build automation, QEMU, GDB, and more — to IBM Bob via the Model Context Protocol. It runs locally as a stdio child process and integrates with the existing LocalLLM-MCP server for LLM routing.
Features
Status | Tool | Description |
✅ Feature 1 |
| Search the Linux kernel source tree for a symbol by name |
✅ Feature 2 |
| Explain a kernel source file using a local LLM |
✅ Feature 3 |
| Build the kernel with a given config |
✅ Feature 4 |
| Run |
✅ Feature 5 |
| Run the Sparse static analyser |
✅ Feature 6 |
| Boot a kernel image in QEMU |
✅ Feature 7 |
| Analyse a kernel oops / crash log |
✅ Feature 8 |
| Assist with |
✅ Feature 9 |
| Review a patch with |
✅ Feature 10 |
| Run the Smatch static analyser ( |
✅ Feature 11 |
| Run Coccinelle semantic patch tool ( |
✅ Feature 12 |
| Generate a kernel-style commit message from a unified diff using a local LLM |
✅ Feature 13 |
| Route a kernel development prompt to the best local LLM using a capability matrix |
✅ Feature 14 |
| Attach GDB to a QEMU/KGDB kernel and execute debug commands (backtrace, registers, break, etc.) |
✅ Feature 15 |
| Identify the kernel subsystem that owns a file path, returning the MAINTAINERS entry, maintainer list, mailing list, git tree, and status |
✅ Feature 16 |
| List all available defconfig/specialconfig targets by parsing |
✅ Feature 16 |
| Return the terminal command needed to run |
✅ Feature 16 |
| Clean the kernel build tree with |
✅ Feature 17 |
| Stop a QEMU session previously started by |
✅ Feature 18 |
| Generate a call graph for a kernel function using |
✅ Feature 19 |
| Search the |
Related MCP server: nevercheese-pcileech-memprocfs-mcp
Architecture
See docs/Architecture.md for the full layered architecture diagram and design rationale.
IBM Bob ──MCP STDIO──► kernel-mcp/server.py
│
router.py (validation)
│
tools/*.py (business logic)
│
services/*.py (subprocess calls)
│
ripgrep / grep / make / qemu / gdb
│
Linux kernel source treePrerequisites
Requirement | Notes |
Python 3.11+ | 3.14 recommended |
Linux kernel source tree | Any version; clone from kernel.org |
| Strongly recommended for speed; falls back to |
| Standard fallback; available on all Linux/macOS systems |
IBM Bob with MCP support | For full integration |
Installation
1. Clone or copy the project
# kernel-mcp lives alongside LocalLLM-MCP in your workspace
git clone <your-repo> kernel-mcp
cd kernel-mcp2. Create a virtual environment
python -m venv .venv
# Linux / macOS
source .venv/bin/activate
# Windows
.venv\Scripts\activate3. Install dependencies
pip install -r requirements.txt4. Configure environment
cp .env.example .envEdit .env and set KERNEL_SOURCE_PATH:
KERNEL_SOURCE_PATH=/home/user/linux5. Verify configuration
python config.pyExpected output:
=== kernel-mcp Configuration Smoke Test ===
kernel_source_path : /home/user/linux
search_timeout_seconds : 30
max_results : 50
context_lines : 5
ripgrep_path : rg
grep_path : grep
=== Smoke test passed ===IBM Bob Integration
Add kernel-mcp to Bob's mcp.json:
Linux / macOS:
{
"mcpServers": {
"kernel-mcp": {
"command": "/path/to/kernel-mcp/.venv/bin/python",
"args": ["/path/to/kernel-mcp/server.py"],
"cwd": "/path/to/kernel-mcp",
"env": {
"KERNEL_SOURCE_PATH": "/home/user/linux",
"LOG_LEVEL": "INFO"
},
"alwaysAllow": ["search_kernel_symbol", "review_patch"],
"disabled": false
}
}
}Windows:
{
"mcpServers": {
"kernel-mcp": {
"command": "C:\\kernel-mcp\\.venv\\Scripts\\python.exe",
"args": ["C:\\kernel-mcp\\server.py"],
"cwd": "C:\\kernel-mcp",
"env": {
"KERNEL_SOURCE_PATH": "C:\\linux",
"LOG_LEVEL": "INFO"
},
"alwaysAllow": ["search_kernel_symbol", "review_patch"],
"disabled": false
}
}
}Usage Examples
Once Bob has the server connected, ask naturally:
Prompt | What happens |
"Find all declarations of task_struct in the kernel" |
|
"Search for kmalloc only in the mm subsystem" |
|
"Where is do_fork defined?" |
|
"Find netif_receive_skb in the network stack" |
|
"Generate a default kernel config" |
|
"Build the kernel for ARM64 with 8 jobs" |
|
"Clean the kernel build tree" |
|
"Build only the e1000e driver module" |
|
"Check my patch for style issues" |
|
"Run checkpatch on a source file" |
|
"Run strict checkpatch on a patch" |
|
"Run sparse on the mm subsystem" |
|
"Sparse-check a single object file" |
|
"Deep sparse check for ARM64" |
|
"Boot the default x86 kernel image" |
|
"Boot with a serial console and panic timeout" |
|
"Boot an ARM64 kernel with initrd" |
|
"Boot with 2 CPUs and 1 GiB RAM" |
|
"Analyse this oops log" |
|
"What caused this kernel panic?" |
|
"Analyse oops with a symbol map" |
|
"Start bisecting between v6.2 (bad) and v6.1 (good)" |
|
"Mark current commit as good" |
|
"Mark current commit as bad" |
|
"Skip the current untestable commit" |
|
"Run automated bisect with build test" |
|
"Show bisect session log" |
|
"Abort bisect and restore HEAD" |
|
"Review my patch for style issues" |
|
"Strict checkpatch on a patch file" |
|
"Review inline diff text for style" |
|
"Full review: checkpatch + LLM code review" |
|
"LLM review with Qwen Coder model" |
|
"Run Coccinelle kzalloc-simple script on drivers/net/" |
|
"Apply my custom .cocci script to the mm subsystem" |
|
"Run Coccinelle without headers" |
|
"Generate a commit message for my patch" |
|
"Write a kernel commit message for this fix.patch" |
|
"Use Qwen Coder to write a commit message" |
|
Running Tests
# From the kernel-mcp directory, with venv active
pytest tests/ -vTest groups (test_search_symbol.py):
A — Backend detection (ripgrep/grep/neither)
B — Subprocess execution and output parsing
C — MatchType classification heuristic
D — Context enrichment (async file reads)
E — Deduplication and result assembly
F — Router input validation
G — Smoke: server tool returns valid JSON
H — Integration: real backend against synthetic kernel tree
Test groups (test_build_kernel.py):
A —
locate_make: binary detectionB —
run_build: subprocess execution (mocked)C —
_parse_diagnostics: GCC/Clang error and warning extractionD —
_build_make_args: argument assembly (arch, jobs, target)E —
build_kerneltool layer (mocked service)F — Router input validation
G — Server smoke: tool returns valid JSON
Integration tests (group H) are automatically skipped if neither rg nor grep is found on PATH.
Test groups (test_run_checkpatch.py):
A —
locate_checkpatch: script detection (in-tree, explicit, missing)B —
run_checkpatchservice: subprocess execution (mocked)C —
_parse_issues: ERROR/WARNING/CHECK extractionD —
_parse_total_lines: summary line parsingE —
run_checkpatchtool layer (mocked service)F — Router input validation
G — Server smoke: tool returns valid JSON
Test groups (test_boot_qemu.py):
A —
locate_qemu: binary detection (found, missing, custom path, arch aliases)B —
run_qemuservice: subprocess execution (mocked)C —
_detect_events: boot/panic/oops detection from output textD —
_build_summary: summary string constructionE —
boot_qemutool layer (mocked service)F — Router input validation
G — Server smoke:
boot_qemureturns valid JSON
Test groups (test_analyze_oops.py):
A —
_detect_oops_type: crash-type detection (oops, bug, panic, warning, kasan, ubsan, lockdep, …)B —
_extract_metadata: CPU / PID / comm / kernel-version extractionC —
_extract_registers: register dump parsing (x86-64, ARM64, RISC-V)D —
_extract_call_trace: call-trace frame extraction and indexingE —
_build_summary/_build_root_cause_hint/_infer_subsystemF —
analyze_oopstool layer (direct call)G — Router input validation (
route_analyze_oops)H — Server smoke:
analyze_oopsreturns valid JSON
Test groups (test_run_sparse.py):
A —
locate_sparse: binary detection (found, missing)B —
run_sparse_via_makeservice: subprocess execution (mocked)C —
_parse_findings: sparse diagnostic extraction from stderrD —
_build_summary: summary string constructionE —
run_sparsetool layer (mocked service)F — Router input validation
G — Server smoke: tool returns valid JSON
Test groups (test_git_bisect.py):
A —
locate_git: binary detection (found, missing, custom path)B —
run_git_commandservice: subprocess execution (mocked)C —
_build_git_args: argument assembly for each actionD —
_parse_bisect_output: state detection from git outputE —
_build_summary: summary string constructionF —
git_bisecttool layer (mocked service)G — Router input validation (
route_git_bisect)H — Server smoke:
git_bisectreturns valid JSON
Test groups (test_review_patch.py):
A —
normalise_patch_input: file-path detection vs inline-text detectionB —
run_patch_checkpatchservice: subprocess delegation (mocked)C —
_parse_diff_metadata: changed-file extraction and statisticsD —
_infer_subsystem: top-level subsystem detectionE —
review_patchtool layer (mocked service + mocked LLM)F — Router input validation (
route_review_patch)G — Server smoke:
review_patchreturns valid JSON
Test groups (test_run_smatch.py):
A —
locate_smatch: binary detection (found, missing, custom path)B —
run_smatch_via_makeservice: subprocess execution (mocked)C —
_parse_findings: smatch diagnostic extraction from stderrD —
_build_summary: summary string constructionE —
run_smatchtool layer (mocked service)F — Router input validation
G — Server smoke: tool returns valid JSON
Test groups (test_run_coccinelle.py):
A —
locate_spatch: binary detection (found, missing, custom path)B —
run_spatchservice: subprocess execution (mocked)C —
_parse_transformations: unified diff parsing from stdoutD —
_parse_findings: Coccinelle diagnostic extraction from stderrE —
run_coccinelletool layer (mocked service)F — Router input validation
G — Server smoke: tool returns valid JSON
Test groups (test_generate_commit_message.py):
A —
_parse_diff_metadata: file path extraction and line countsB —
_infer_subsystem: top-level subsystem detectionC —
_build_prompt/_extract_commit_message/_split_subject_body: prompt + response post-processingD —
generate_commit_messagetool layer (LLM mocked)E — Router input validation (
route_generate_commit_message)F — Server smoke: tool returns valid JSON
Configuration Reference
kernel_mcp_config.json
Key | Type | Default | Description |
| int |
| Max seconds for a search subprocess |
| int |
| Hard cap on total matches returned |
| int |
| Lines above/below each match |
| string |
| Name or absolute path of ripgrep binary |
| string |
| Name or absolute path of grep binary |
| string |
| Name or absolute path of the make binary |
| int |
| Max seconds for a kernel build (30 min) |
| int |
| Default |
| string |
| Path to |
| string |
| Name or absolute path of the Perl interpreter |
| int |
| Max seconds for a |
| string |
| Name or absolute path of the |
| int |
| Max seconds for a |
| string |
| Name or absolute path of the |
| int |
| Max seconds for a |
| string |
| Name or absolute path of the |
| int |
| Max seconds for a |
| string |
| Name or absolute path of the qemu-system binary. Empty = auto-detect |
| int |
| Max seconds for a QEMU boot session |
| int |
| Default guest RAM in MiB ( |
| int |
| Max byte length of a kernel oops log accepted by |
| int |
| Max byte length of a unified diff accepted by |
Environment Variables
Variable | Required | Description |
| Yes | Absolute path to the Linux kernel source tree |
| No | Override |
| No | Override |
| No | Override |
| No | Override ripgrep binary path |
| No | Override grep binary path |
| No | Override make binary path |
| No | Override |
| No | Override |
| No | Override path to |
| No | Override Perl interpreter path |
| No | Override |
| No | Override |
| No | Override |
| No | Override qemu-system binary path |
| No | Override |
| No | Override |
| No | Override |
| No | Override |
| No | Override |
| No | Override |
| No | Override |
| No | Override |
| No |
|
Tool Reference
Relationship to LocalLLM-MCP
kernel-mcp is a sibling project to LocalLLM-MCP. They run as separate MCP servers registered independently in Bob's mcp.json. Kernel MCP does not modify or depend on LocalLLM-MCP's code. Future features will call LocalLLM-MCP tools via Bob's tool-routing to send kernel source code to local LLMs for explanation and review.
License
MIT
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 Servers
- AlicenseCqualityDmaintenanceA privacy-first MCP server that provides local LLM-enhanced tools for code analysis, security scanning, and automated task execution using backends like Ollama and LM Studio. It enables symbol-aware code reviews and workspace exploration while ensuring that all code and analysis remain strictly on your local machine.36ISC
- Alicense-qualityBmaintenanceA Linux-native MCP server that gives AI assistants direct access to DMA-based memory operations for memory inspection, process analysis, reverse engineering, and game engine SDK extraction via natural language.13AGPL 3.0
- Alicense-qualityDmaintenanceAn MCP server that exposes LLDB debugging capabilities, enabling AI-assisted interactive debugging of C/C++ applications through 40 specialized tools.2MIT
- Alicense-qualityAmaintenanceMCP server enabling structured search and querying over Linux kernel mailing list archives (lore.kernel.org) for LLM-powered developer tools.3MIT
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
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/amit11-ibm/kernel-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server