Fw Context MCP logo

Fw Context MCP

by turbyho

Build-aware C/C++ firmware indexing with libclang, SQLite/FTS5, call graphs, semantic search, and embedded-focused analysis.

Install Fw Context MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "turbyho-fw-context-mcp": {
      "command": "uvx",
      "args": [
        "fw-context-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Install not yet sandbox-tested— the server itself is confirmed live (we called its tools/list endpoint). The stdio install command is a separate, ongoing check.

Overview

turbyho/fw-context-mcp builds a persistent, build-aware index of embedded C and C++ projects from compile_commands.json using libclang, SQLite, and FTS5. Its MCP tools expose symbol and source search, active-build metadata, references, direct and recursive call graphs, function-pointer relationships, interrupt vector analysis, dead-code checks, hotspots, and data-flow tracing. Optional Ollama or another configured chat API adds embeddings, natural-language search, and symbol explanations, while core indexing and lexical queries work without an LLM. Reach for it when an agent needs to reason about the code actually selected by a firmware build rather than reconstructing relationships from text files alone.

Use cases

  • Trace firmware execution from an ISR through callbacks and dispatch code
  • Find callers, callees, and indirect registrations before changing an API
  • Locate the implementation selected by a board or build configuration
  • Identify dead-code candidates and high-impact call-graph hotspots
  • Search active project code while excluding vendor SDK paths

Key features

  • Compile-database indexing with libclang and SQLite/FTS5
  • Build-aware symbol, body, and full-file search
  • Direct, recursive, and indirect call-graph analysis
  • Interrupt vector and function-pointer relationship inspection
  • Optional Ollama-backed embeddings and symbol explanations
  • Incremental file reindexing and multi-variant metadata

Tools39

What Fw Context MCP lets your agent do. Expand a tool for its parameters.

Verified live~46.6k tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 1d ago

Recent health check succeeded.

19/20 checks healthy over the last 79d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 9d ago via OSV.dev · fw-context-mcp (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars10Stargazers on the source repository.
Last commit10d agoMost recent push to the default branch.
Tools exposed39Callable tools this server registers over MCP.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

How Fw Context MCP works

What turbyho/fw-context-mcp does

turbyho/fw-context-mcp gives coding agents structured access to the C and C++ program represented by a firmware build. It reads compile_commands.json and parses translation units with libclang, then stores symbols, source extents, active preprocessor content, macros, references, call-graph edges, inheritance data, and project/vendor classification in a persistent SQLite index with FTS5 search.

The build context matters for embedded projects: multiple implementations, compiler definitions, generated headers, board selections, and RTOS configuration can coexist in one source tree. Queries are tied to an indexed build and can distinguish project code from SDK or vendor paths. Multi-variant projects can expose variant, image, board, linker entry-point, and memory-region information.

How it works

Initialize a project and create its compilation database, then run the fw-context index command. The server checks index health with get_active_build and can reparse changed files incrementally. Full indexing uses the compiler flags from compile_commands.json, while file-level reindexing updates one source file or parses a header through an including translation unit.

Core analysis comes from libclang and SQLite. Search tools operate on active, ifdef-filtered code for the selected build. Reference and call-graph tools model ordinary calls as well as function-pointer assignments, callback registrations, interrupt-vector relationships, implicit constructors, and selected dispatch bridges. Optional LLM features use precomputed analysis or query a configured backend; semantic search requires embeddings, and smart_search uses an LLM-driven search pipeline with fallbacks.

Setup and configuration

Install with Python 3.11 or newer, libclang, and the fw-context-mcp package:

Terminal
pip install fw-context-mcp

From a firmware project, initialize the integration and build the index:

bash
fw-context init
fw-context index --build

Restart the coding agent after initialization. The project must be able to produce compile_commands.json. Supported project families include Zephyr, PlatformIO, Mbed OS, Arduino, ESP-IDF, generic CMake, Makefile-based projects, and custom builds that provide a compilation database. Additional setup paths cover Keil, IAR, STM32CubeIDE, and TI Code Composer Studio.

Ollama is optional. Without an LLM backend, symbol indexing, source search, call-graph queries, and core SQLite-backed analysis remain available. Embedding-based search falls back to lexical search when embeddings are unavailable, and explanation or enrichment requests can return source and a prompt instead of generated analysis. A configured external chat endpoint may receive source snippets, so its use should be reviewed against applicable data-security requirements.

Tools and capabilities

  • Check dependencies, build metadata, compile-database state, index freshness, project registration, and available build variants.
  • Search exact or prefixed symbols, names and documentation with lookup_symbol and search_code.
  • Search active function and type bodies with search_bodies, or whole ifdef-filtered files with search_content.
  • Use semantic_search and smart_search for concept-oriented retrieval when the required LLM or embedding services are configured.
  • Inspect callers, callees, call paths, all references, indirect targets and indirect call sites.
  • Analyze dead-code candidates, highly referenced functions, wrapper classes, recursive dependencies, and type-based data flow.
  • Inspect interrupt vector tables, including C, assembly, linker, runtime, dispatcher, data, and unhandled entries where the build exposes them.
  • Retrieve symbol explanations, source context, macros, class relationships, and build-specific metadata.
  • Reindex individual files, reset an index, configure per-project LLM settings, and audit the environment.

Limitations and notes

Queries depend on the quality and coverage of compile_commands.json. A source file absent from that database cannot be incorporated by a normal file reparse. Header reindexing through one including translation unit may not represent every compilation context; a full index is needed for complete coverage.

Call-graph results can omit ambiguous fallback edges rather than risk assigning a call to the wrong method. Dead-code detection identifies symbols with no indexed references, not full reachability from application entry points, and possibly-dead function-pointer assignments require review. Data-flow tracing is intended for synchronous paths and cannot follow asynchronous queues, interrupts, or callback flows completely.

Index status should be checked before querying. Structural mismatches may require reindexing, while an index written with a newer row format requires restarting the client rather than rewriting the database. Semantic search answers for the active build and does not select a variant or image; build-specific lexical and body searches should be used when that distinction matters. Interrupt analysis cannot represent architectures whose vector tables are built from branch instructions, and some link-resolved handler addresses have no source-level name.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Fw Context MCP

turbyho/fw-context-mcp is an MCP server that connects AI coding agents to embedded C and C++ firmware indexed from compile_commands.json with libclang, SQLite, and FTS5. Its main tools support symbol and source search, call-graph and reference analysis, function-pointer tracing, build-status inspection, dead-code and hotspot analysis, and optional semantic search.

Install it with pip using `pip install fw-context-mcp`, then run `fw-context init` in the firmware project and `fw-context index --build` to create the index. Python 3.11 or newer, libclang, and a project that can produce compile_commands.json are required.

No, Ollama is optional. Core indexing, symbol lookup, lexical search, source retrieval, references, and call-graph analysis use libclang and SQLite. Ollama or another configured chat backend is used for embeddings, natural-language search, and on-demand or precomputed symbol explanations.

It supports projects that provide a compilation database, including Zephyr, PlatformIO, Mbed OS, Arduino, ESP-IDF, generic CMake, Makefile-based projects, and custom builds. Setup paths are also available for Keil, IAR, STM32CubeIDE, and TI Code Composer Studio.

Use the reindex_file MCP tool for a targeted update, or run a full `fw-context index` when broader build or header changes require it. The file must be represented in compile_commands.json; a header is reparsed through one including translation unit and may require a full index for complete coverage.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewFw Context MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/turbyho-fw-context-mcp?style=directory)](https://allmcps.com/mcp/turbyho-fw-context-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/turbyho-fw-context-mcp"><img src="https://allmcps.com/api/badge/turbyho-fw-context-mcp?style=directory" alt="Fw Context MCP on AllMCPs" /></a>