What kconfig-mcp MCP server does
The kconfig-mcp MCP server gives an AI agent structured access to Kconfig configuration logic. It can parse a top-level Kconfig file and an optional existing .config, then explain how symbols derive their current values. The server is intended for Kconfig-based projects including the Linux kernel, Zephyr, U-Boot, and Buildroot, but it can load other trees when their expanded variables are supplied.
Its main diagnostic use is answering why a boolean or tristate option cannot reach y, m, or n. The explanation follows dependency chains recursively, identifies relevant select, imply, defaults, prompts, and choices, and includes source file and line locations. When possible, it searches for a small change set, applies that plan to the loaded tree, and reports only fixes that pass verification. Resulting side effects are included.
How it works
A loaded tree is kept in a named session. During parsing, kconfig-mcp tracks warnings and variables that were referenced but not defined, which helps distinguish a configuration problem from an incomplete load environment. Symbol names may be provided with or without the CONFIG_ prefix, and misspellings produce a suggested name.
The parser is based on Kconfiglib 14.1.0 and includes compatibility handling for newer Linux Kconfig constructs. Files are rewritten while preserving source line locations, allowing diagnostics to point back to the original tree. The server also models tristate behavior, module requirements, choices, defaults, and the effects of selecting or implying other symbols.
For Linux trees, loading may require values such as SRCARCH and ARCH. Shell expressions can either run through a POSIX shell or use dry mode. Dry mode avoids compiler probes and gives generic results for those checks, while run mode reflects the available toolchain. This makes the kconfig-mcp MCP server useful without a complete kernel build environment, provided the Kconfig files are available.
Setup and configuration
Install it with Python 3.10 or newer:
The server is started as a standard stdio MCP process. For example, Claude Desktop can register it with:
claude mcp add kconfig -- kconfig-mcp
Call kconfig_load with the path to the top-level Kconfig file, an optional .config, and any environment mappings needed by the tree. A Linux load commonly points to linux/Kconfig and supplies architecture values. Use shell="dry" when compiler or shell probing should not run, such as on Windows or where no compiler is installed.
Tools and capabilities
kconfig_load parses a tree and optionally an existing configuration.
kconfig_why_not traces unmet conditions and searches for a verified fix.
kconfig_symbol reports a symbol’s type, value, prompt, dependencies, defaults, help, and assignment options.
kconfig_what_selects lists symbols that select or imply a target and identifies active ones.
kconfig_search searches names, prompts, and help text with regular expressions.
kconfig_set assigns values using menuconfig-like behavior and reports cascading changes.
kconfig_diff compares configurations, defconfigs, or fragments.
kconfig_save writes a .config or minimal defconfig.
kconfig_sessions and kconfig_unload manage loaded trees.
Limitations and notes
The fix search has an expansion limit, so a missing fix may reflect either a genuinely unreachable condition or an exhausted search budget. Transitional symbols are always treated as n, because the underlying library does not reproduce their migration behavior. kconfig_why_not is for bool and tristate symbols; use kconfig_symbol and kconfig_set for integer, hexadecimal, or string values.
Dry mode is not equivalent to a real compiler environment: compiler feature symbols such as CC_HAS_* are treated as absent. Use shell="run" with the intended toolchain when those results matter. The kconfig-mcp MCP server also depends on a pinned Kconfiglib version because it hooks internal methods for compatibility.