Fw Context Mcp
@turbyho
fw-context builds a compiler-accurate semantic index of your C/C++ firmware from
概要
What is Fw Context Mcp?
Fw Context Mcp is a model context protocol server that builds a compiler-accurate semantic index of embedded C/C++ projects from compile_commands.json and the libclang AST. It exposes tools for LLMs to query symbol definitions, references, call relationships, callback registrations, function pointer assignments, active source content, and other project metadata—giving coding agents the right context instead of raw source files.
How to use Fw Context Mcp?
Run fw-context init followed by fw-context index --build to create the persistent index, then restart your LLM client. After that, ask questions about your firmware project. Detailed installation and configuration guides are available in the documentation (docs/README.md, docs/installation.md).
Key features of Fw Context Mcp
- Compiler-accurate semantic index from
compile_commands.json - Exposes high-level queries through MCP tools for LLMs
- Persistent, local-first index optimized for repeated questions
- Supports callback registration, function pointer assignments, and inheritance
- Handles preprocessor configuration and active implementation detection
- Reduces irrelevant token usage by returning only needed semantic information
Use cases of Fw Context Mcp
- Reviewing firmware commits with build-aware context and finding all callers of an API
- Tracing callback registration and indirect invocation paths in RTOS projects
- Understanding ISR, work queue, and task relationships without reading entire files
- Identifying dead-code candidates and active implementations selected by the current build
- Navigating large source files through symbol maps instead of reading them whole
FAQ from Fw Context Mcp
Why not just use an LSP like clangd?
Language servers are designed for interactive editing (completion, diagnostics, go-to-definition). Fw Context Mcp is built for LLM-assisted reasoning over firmware projects—it exposes high-level semantic queries through MCP, stores a persistent index, and optimizes for repeated questions from an LLM, not for editor latency.
What dependencies or runtime requirements does Fw Context Mcp have?
It requires a compile_commands.json file from your build system and uses libclang to index the AST. The server is local‑first and works with any LLM client that supports the MCP protocol.
How does Fw Context Mcp handle data and where is it stored?
The index is built locally from your project’s compilation database and stored persistently on your machine. No project data is sent to external servers; the only communication is between the MCP server and the LLM client over the local machine.
Can I use Fw Context Mcp for projects that don’t use a standard build system?
Fw Context Mcp explicitly requires compile_commands.json. It supports Zephyr, PlatformIO, Mbed OS, Arduino, FreeRTOS‑based projects, and custom embedded builds that can produce this file. Without a compilation database, it cannot index the project.
What are the known limits of Fw Context Mcp?
The server does not replace an LLM; it provides better input. It cannot analyze files that are not part of the build index, and its accuracy depends on the quality of the compilation database. It is not designed for interactive editing tasks.