Acpi Mcp

io.github.0xmortuex由 GitHub 账号 0xmortuex 发布v0.1.0更新于 Oct 24, 2026

Read ACPI tables from a live QEMU guest or files and explain them for OS developers.

概览

AI 生成的概览

从运行中的 QEMU 客户机或表文件读取 ACPI 固件表,并为操作系统开发者解释其含义。

可以做什么
  • 从 QEMU gdbstub 端口或表文件目录加载表集,并列出已加载的表集
  • 列出所有表及其地址、长度、校验和与 OEM,并可对原始字节做十六进制转储
  • 解码并解释单个表,如 FADT、MADT、HPET、MCFG、DSDT/SSDT 和 FACS
  • 将 ISA IRQ 映射到 GSI 与 I/O APIC 引脚,并给出极性和触发方式
  • 回答关机、复位、HPET、PCI 配置空间、CPU、PM 定时器、键盘、串口和 SCI 等 OS 开发问题
  • 在安装了 iasl 时把 AML 反汇编为 ASL
适用场景
适合在 x86 上编写或调试业余或研究用操作系统内核时,需要了解固件实际构建了什么:CPU 与 APIC 布局、中断路由、PCIe 配置空间,或关机与复位的具体端口写入。也适合在不读规范的情况下查看已抓取的 acpidump 输出。
运行要求
以 Python 包形式本地运行(pip install acpi-mcp),通过 stdio 通信。实时读取需以 -s 启动 QEMU 的 gdbstub;从 /sys/firmware/acpi/tables 读取本机表需要 root 权限。AML 反汇编需可选安装 iasl。无需账号、API 密钥或环境变量。
安装前请注意
连接 gdbstub 会暂停客户机,且 QEMU 同时只允许一个调试器,可能与其他调试工具冲突;resume=False 会让虚拟机保持暂停。以 root 读取本机表会暴露固件数据。AML 读取器是结构化遍历器而非解释器,不会求值 _STA 等运行时计算的值。实时读取不支持 UEFI/OVMF 客户机和 ARM。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Acpi Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

acpi-mcp

Let your AI agent read the firmware's ACPI tables and tell you what they mean.

acpi-mcp is an MCP server that reads ACPI tables and explains them for OS developers. It covers how many CPUs there are and their APIC IDs, where the I/O APIC lives, which ISA IRQs are remapped, where the HPET and PCIe config space are, and the exact port writes that power the machine off or reset it.

It reads tables from three places:

  • a live QEMU guest, out of guest physical memory through QEMU's gdbstub (works even after the guest turns on paging);
  • a directory of table files: Linux's /sys/firmware/acpi/tables, or acpidump -b output from any machine;
  • optionally, AML disassembly with iasl if you have it installed. Nothing else needs it.

Companion to qemu-mcp (boot and drive the VM) and gdbstub-mcp (debug the kernel).

What it looks like

This is real output from QEMU 11 (-M q35 -smp 2), read live from the guest:

> acpi_table MADTMADT revision 3: local APIC base 0xfee00000 (dual 8259 PICs present: mask them before using the APIC)  2 usable CPU(s), APIC IDs [0, 1]  The BSP is usually APIC ID 0; start the others with INIT-SIPI-SIPI  I/O APIC id 0 at 0xfec00000, GSI base 0  Interrupt source overrides (legacy ISA IRQ -> GSI):    IRQ0 -> GSI 2 (I/O APIC 0 pin 2), bus default, bus default - this is why the PIT timer shows up on I/O APIC pin 2, not 0    IRQ9 -> GSI 9 (I/O APIC 0 pin 9), active high, level - non-ISA polarity/trigger: program the redirection entry to match    ...  Local APIC NMI on LINT1 for all CPUs (bus default, bus default) - program LVT LINT1 as NMI
> acpi_find "how do I shut down the machine?"Soft power-off (S5): \_S5_ = SLP_TYPa 0, SLP_TYPb 0  1. If SMI_CMD (0xb2) is non-zero and SCI_EN (bit 0 of PM1a_CNT) is clear, enable ACPI: outb(0xb2, 0x2) and wait for SCI_EN  2. outw(0x604, 0x2000)   # SLP_TYPa << 10 | SLP_EN (bit 13)
> acpi_find "reboot"Reset: write 0xf to I/O port 0xcf9 (8-bit) (FADT RESET_REG, RESET_REG_SUP set). Fall back to the 8042 if it returns.
> acpi_find "pci config space"MCFG: PCI Express ECAM (memory-mapped config space)  segment 0, buses 0-255: base 0xb0000000 (256 MiB)    config address of bus B, device D, function F, offset O = 0xb0000000 + ((B - 0) << 20 | D << 15 | F << 12 | O)
> acpi_table DSDT  8491 bytes of AML bytecode, 37 Device objects  Recognised devices:    \_SB_.PCI0                   PNP0A08 (compatible PNP0A03) PCI Express host bridge    \_SB_.HPET                   PNP0103                    HPET    \_SB_.PCI0.SF8_.KBD_         PNP0303                    PS/2 keyboard (8042)    \_SB_.PCI0.SF8_.COM1         PNP0501                    16550 serial port (COM)    ...

The recipes are tested, not just printed. The integration tests write the exact instructions acpi_find prescribes into a live guest, run them, and check the result: the shutdown recipe powers off both -M pc and -M q35, and the reset recipe resets q35. A control case that only runs hlt keeps running.

Why

ACPI is the first wall every hobby OS hits after "hello world". You need it for SMP, the I/O APIC, the HPET, PCIe and power-off. The tables are binary structures spread across firmware memory, the spec runs to over a thousand pages, and the bugs are silent: miss the IRQ0 → GSI2 override and your timer simply never fires. This server reads the tables your firmware actually built and answers in terms of what to program.

As far as I could find, no other MCP server reads or explains ACPI tables.

Install

bash
pip install acpi-mcpclaude mcp add acpi -- acpi-mcp

Usage

Start QEMU with its gdbstub (-s). -S is fine, because acpi-mcp lets the firmware run until the tables exist:

bash
qemu-system-x86_64 -M q35 -smp 2 -kernel kernel.elf -s -S

Then ask your agent something like "load the ACPI tables from the VM on port 1234 and tell me how to route the keyboard interrupt through the I/O APIC".

On a Linux machine you can read its own tables (as root):

acpi_load(name="host", path="/sys/firmware/acpi/tables")

Tools

ToolWhat it does
acpi_loadLoad tables under a name from port= (live VM; boot_wait_s lets firmware run first; resume chooses whether the guest runs on afterwards) or from path= (a directory).
acpi_tablesList every table: address, length, checksum, OEM, and what the table is for.
acpi_tableDecode one table and explain it: FADT, MADT, HPET, MCFG, DSDT/SSDT, FACS, RSDT/XSDT, WAET, RSDP.
acpi_interrupt_routingMap ISA IRQs 0-15 to GSI and I/O APIC pin, with polarity and trigger mode.
acpi_findAnswer OS-dev questions: shutdown, reset, HPET, PCI config, CPUs, IRQ routing, PM timer, keyboard, serial, RTC century, SCI.
acpi_dumpHexdump a table's raw bytes.
acpi_disassembleAML to ASL with iasl -d, if installed.
acpi_setsList loaded table sets.

How it reads a live VM

  1. It connects to the gdbstub. QEMU pauses the guest while a debugger is attached.
  2. It switches the stub to physical memory with QEMU's Qqemu.PhyMemMode:1, so ACPI's physical pointers work even when the guest has paging on. On stubs without this packet it reads virtual addresses and says so in the output.
  3. It searches the EBDA and 0xE0000-0xFFFFF for a checksummed RSD PTR , then walks the XSDT (or RSDT), the FADT, the DSDT and the FACS.
  4. If the CPU hasn't run the firmware yet (-S), it runs the guest in short bursts until a complete, checksum-valid table set exists. It returns as soon as one does.
  5. It detaches with D;1, and the guest continues. Pass resume=False to leave it paused, for example before attaching gdbstub-mcp to a -S VM. QEMU allows only one debugger at a time.

Limits

  • The AML reader is a structured walker, not an interpreter. It parses the Scope, Device and Name objects that describe devices and skips Method bodies. Anything a method computes at runtime, such as a _STA that hides a device, isn't evaluated. If it ever has to fall back to byte-scanning a region (an If at scope level), the output says so. Use acpi_disassemble (iasl) for an exact listing.
  • UEFI guests (OVMF) pass the RSDP to the OS through the EFI system table, not the BIOS area, so the live search won't find it. Load those tables from a directory (acpidump -b) for now.
  • x86 only for now. ARM's ACPI (GICC/GICD in the MADT, GTDT) is on the backlog.

Tests

bash
pip install ".[test]" "ruff==0.16.0" "mypy==2.3.0"ruff check src tests && mypy --strict srcpytest tests

The unit tests run on real tables captured from QEMU (tests/fixtures/tables/), so they need no QEMU. tests/test_qemu_integration.py reads live tables from i386 and x86_64 guests on both pc and q35, checks that the CPU count follows -smp, checks resume semantics, and runs the shutdown and reset recipes inside the guest. It skips any QEMU binary that isn't installed.

License

MIT

来源:README.md,提交 7416f8b

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Oct 11, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分