Skip to main content

linux-kernel-mcp

linux-kernel-mcp is an MCP server that lets Codex look up Linux kernel documentation, upstream source files, release information, and optional local kernel source trees.

Chinese documentation is available in README.zh-CN.md.

You do not need a local Linux checkout to use the remote documentation tools. Local source-tree search is optional and can be enabled later when you have a kernel tree on your machine.

Quick Start

Register the server with Codex:

codex mcp add linux_kernel -- uvx linux-kernel-mcp

Restart Codex after adding the MCP server.

After that, ask Codex kernel-related questions such as:

Search the latest Linux kernel docs for GPIO descriptor APIs.
Fetch the upstream implementation of drivers/gpio/gpiolib.c around line 200.
What is the latest stable Linux kernel release?

What Works Without A Local Kernel Tree

These features work immediately after installation:

  • Search docs.kernel.org
  • Fetch and summarize a docs.kernel.org page
  • Query latest stable and mainline releases from kernel.org
  • Open online source-browsing entry points for kernel symbols
  • Fetch files from the upstream Torvalds tree through Gitiles
  • Build high-level implementation checklists for kernel-facing tasks

This is enough for documentation lookup, API research, and comparing against latest upstream code.

Optional Local Kernel Tree

If you also have a Linux kernel source tree locally, enable local inspection in one of two ways.

Set a default before starting Codex:

export LINUX_KERNEL_TREE=/path/to/linux

Or set it during a Codex session:

set_kernel_root("/path/to/linux")

Then local tools can search and read your tree:

search_local_kernel_api("devm_gpiod_get")
read_local_kernel_file("drivers/gpio/gpiolib.c", start_line=200)

Check the active local root:

get_kernel_root()

Use a different tree for one call:

search_local_kernel_api("platform_driver_register", root="/path/to/other/linux")

If no local tree is configured, local tools return a clear configuration error. Remote documentation and upstream source tools continue to work.

Available Tools

Remote lookup tools:

  • latest_kernel_releases
  • search_kernel_docs
  • fetch_kernel_doc
  • search_online_kernel_code
  • fetch_upstream_kernel_file
  • plan_kernel_implementation

Local source-tree tools:

  • get_kernel_root
  • set_kernel_root
  • search_local_kernel_code
  • read_local_kernel_file
  • search_local_kernel_api
  • inspect_kernel_capabilities
  • find_driver_examples

Driver-planning tools:

  • list_driver_template_blueprints_tool
  • get_driver_template_blueprint_tool
  • plan_driver_scaffold

Typical Workflow

  1. Search the latest official docs for the subsystem or API.
  2. Fetch upstream source snippets when the latest implementation matters.
  3. Configure a local kernel tree only if you need version-specific local code.
  4. Inspect local kernel capabilities before choosing helper APIs or callback signatures.
  5. Search nearby local examples and API call sites.
  6. Ask Codex to plan the implementation and call out version-sensitive checks.

Codex Configuration

The codex mcp add command writes this configuration for you:

[mcp_servers.linux_kernel]
command = "uvx"
args = ["linux-kernel-mcp"]

To make a project always use one local kernel tree, add:

[mcp_servers.linux_kernel.env]
LINUX_KERNEL_TREE = "/path/to/linux"

Local Development

If you are working from a local checkout of this repository instead of the PyPI package, register the checkout path:

codex mcp add linux_kernel -- uvx --from /path/to/linux-kernel-mcp linux-kernel-mcp

From inside the repository, you can build and test the package:

uv build
uvx --from dist/linux_kernel_mcp-0.1.0-py3-none-any.whl linux-kernel-mcp

The command starts an MCP stdio server and waits for a client handshake, so it does not print normal CLI output.

Limitations

  • The server provides lookup and planning tools; it does not guarantee that a kernel patch is correct.
  • Driver scaffold planning is metadata-first today; it does not emit final C source yet.
  • Upstream source lookup fetches by file path rather than by a full symbol index.
  • set_kernel_root is session-local state. After an MCP restart, set it again or provide LINUX_KERNEL_TREE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linux_kernel_mcp-0.1.3.tar.gz (93.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linux_kernel_mcp-0.1.3-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file linux_kernel_mcp-0.1.3.tar.gz.

File metadata

  • Download URL: linux_kernel_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 93.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for linux_kernel_mcp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 38aef19ae53cf5ed89d659362d52c2fe5074eb15219697bd236b17d5984f71a8
MD5 9c184fcf7a9bd2f23b9484435ac6209f
BLAKE2b-256 ada1ec8ee33567f1ab4fcad31e608a0bdca274173b9746dde05fbf38d7c52656

See more details on using hashes here.

Provenance

The following attestation bundles were made for linux_kernel_mcp-0.1.3.tar.gz:

Publisher: publish-pypi.yml on Jvlegod/linux-kernel-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file linux_kernel_mcp-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for linux_kernel_mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7c842ebe7fee11a4c3e725919dfc4ad0f068ae5465d8ecf1b24f0b9f49af8f26
MD5 f6bff545e1d0bf8c5b3f05f3e2ff5b12
BLAKE2b-256 df4cde1ca978a31ac21e888dde5fb8e64c9708dd9e25d6944cf943379b795279

See more details on using hashes here.

Provenance

The following attestation bundles were made for linux_kernel_mcp-0.1.3-py3-none-any.whl:

Publisher: publish-pypi.yml on Jvlegod/linux-kernel-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page