
Kconfig Mcp
io.github.0xmortuex由 GitHub 账号 0xmortuex 发布v0.1.0更新于 Oct 24, 2026
Why can't I enable CONFIG_X? Explains Kconfig dependencies and finds a verified fix.
概览
解释 Kconfig 选项(如 CONFIG_X)为何无法启用,给出带文件与行号的依赖链和经过验证的最小修复方案。
- 可以做什么
- 把 Kconfig 源码树(可附带现有 .config)加载为命名会话并管理多个会话
- 递归解释 bool 或 tristate 选项为何不是 y/m/n,附文件与行号,并给出经验证的最小修复及其副作用
- 查看选项的类型、提示、取值、可赋值、依赖、默认值、select/imply 双向关系与帮助文本
- 列出所有 select 或 imply 该选项的符号,并按正则搜索名称、提示与帮助文本
- 像 menuconfig 一样赋值并报告随之改变的其他选项,与另一份配置、defconfig 或片段做对比
- 写出 .config 或最小 defconfig
- 适用场景
- 适用于配置 Linux 内核、Zephyr、U-Boot 或 Buildroot 时,某个选项在 menuconfig 中缺失或变灰,或需要在改动配置前弄清会连带开启或关闭哪些选项。
- 运行要求
- 本机运行 Python 3.10+ 进程,从 PyPI 安装 kconfig-mcp。需要包含 Kconfig 文件的源码树,稀疏检出即可,无需内核构建环境。加载 Linux 时需传入 SRCARCH、ARCH 等架构变量,没有编译器时可使用 shell="dry"。
安装
在 SourceWeft 中
- 打开 控制台中的 Kconfig Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
kconfig-mcp
"Why can't I enable CONFIG_X?", answered with file:line and a fix that's been checked.
kconfig-mcp is an MCP server that lets an AI agent reason about Kconfig, the configuration system used by the Linux kernel, Zephyr, U-Boot, Buildroot and others.
Everyone who has configured a kernel has hit this: the option you want isn't in
menuconfig, or it's there but greyed out, and the reason is five depends on hops
away in a different directory. kconfig-mcp walks that chain for you. Then it searches
for the smallest set of changes that would unlock the option, and applies them to
the real tree to verify they work before it shows them to you.
What it looks like
This is real output on the current Linux tree (18,913 symbols) for x86:
The same question on a 32-bit build (ARCH=i386) ends somewhere no symbol change can
reach, and the tool says so instead of inventing a fix:
Why it's built this way
- Fixes are verified, not guessed. Kconfig is full of edge cases: tristate
mneedsMODULES, bools promotemtoy, choices deselect their other members,selectoverridesdepends on, anddefault yturns things on silently. So every candidate plan is applied to the loaded tree and checked. Only plans that really reach the goal are shown as fixes, together with their side effects (what elseselect/imply/defaults switch on or off). - It parses current Linux. It's built on Kconfiglib, which hasn't had a release
since 2020 and can't parse Linux's newer
modules,transitionalanddepends on X if Ysyntax. kconfig-mcp rewrites those lines as files are read, keeping every line number exact.depends on X if Yis lowered with a line-by-line port ofexpr_trans_comparefromscripts/kconfig/expr.c, so it behaves exactly as kconfig does, including how kconfig treats!Swhen S ism. - Environment problems are named. Linux sources
arch/$(SRCARCH)/Kconfig, and an unset variable silently becomes"". kconfig-mcp tracks undefined variables and names them in the error (undefined variable(s): SRCARCH (the arch/ directory to use, ...)) instead of leaving you witharch//Kconfig not found.
Install
Python 3.10+. You don't need a kernel build environment. A source tree with its Kconfig files is enough, even a sparse checkout:
Loading trees
shell controls the tree's $(shell,...) calls, which is how Linux probes the
compiler:
"run"(default) runs them with a POSIXsh, asmake menuconfigwould. Compiler-dependent symbols then reflect your real toolchain."dry"runs nothing. Linux's probe idioms get fixed answers: feature probes read as absent, and the toolchain reports as GCC 13.2.$(error-if)checks become warnings. Results then carry a note that compiler-dependent symbols such asCC_HAS_*read as absent.
Tools
Symbol names work with or without CONFIG_. A misspelt name gets "Did you mean: ...".
Limitations
transitionalsymbols are alwaysn. Real kconfig reads them from an old.configto migrate a value during a rename. Kconfiglib has no equivalent.- The fix search is bounded. Selects and defaults are only explored when a symbol can't be reached through its own prompt, and the search has an expansion budget. If no verified fix is found, the result says whether the budget ran out or every route is genuinely blocked.
why_notcovers bool and tristate symbols. For int/hex/string symbols, usekconfig_symbolandkconfig_set.- Dry mode answers compiler probes generically (see above), so trust
CC_HAS_*-style symbols only withshell="run"on a real toolchain. - It depends on Kconfiglib 14.1.0, pinned because
compat.pyhooks two of its internal methods. CI parses the latest Linux tree every week, so the next new keyword shows up as a failing build rather than a silent wrong answer.
Tests
The fixture tree in tests/fixtures/tree exercises every construct the explainer
handles: depends on, select, imply, choice, visible if, menuconfig/if blocks,
defaults, tristate and modules, and an arch directory chosen by $(SRCARCH). The
Linux tests assert real facts, such as x2APIC's dependencies, the i386 dead end, and
the x86_64 defconfig already enabling it. CI runs them against a sparse checkout of
the current tree.
License
MIT. Kconfiglib is ISC-licensed.
来源:README.md,提交 6a23bfb
工具
0版本历史
1- v0.1.0最新Oct 11, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分