search_codeLABSCO SUMMARY
Written for the gap between the repository and the firmware that ships.
In embedded projects a repository often holds several plausible implementations of one subsystem while only one is compiled for the target — an agent can reason convincingly about the wrong driver. Indexing through the same compilation database the build uses is what closes that gap. The included firmware-review case study publishes its numbers and its methodology, so the token claims can be inspected rather than taken on faith.
What it is
Build-aware code intelligence for agents working on embedded firmware. It builds a persistent semantic index from compile_commands.json and the libclang AST, then answers structural questions — callers, callbacks, function-pointer targets, preprocessor exclusions, inheritance — instead of making the agent reconstruct the program from file reads and text searches.
What you get
- Search that degrades gracefully —
search_coderuns FTS5 with a kind filter and, when that returns nothing, broadens through six documented fallback steps, tagging each result with which one matched - Three search surfaces kept distinct:
search_codefinds symbols by name,search_bodiessearches only what is between a function's braces,search_contentsearches anywhere in files - Call-graph queries —
find_callers,find_references,find_call_path,find_all_callers_recursive,find_callees_recursive,find_dead_code,find_hotspots,find_wrapper_callers - The indirect layer that text search cannot reach —
find_indirect_call_sites,find_indirect_targets,trace_data_flow - C++ structure —
get_inheritance_chain,get_class_members,get_template_instances,get_method_overrides - Build awareness —
get_active_build,list_variants,check_dependencies,get_environment_status, so a multi-variant project is queried per variant or across all withvariant: "*" - Source retrieval and explanation —
lookup_symbol,get_source,get_symbol_context,get_file_map,explain_symbol,read_file,smart_search,semantic_search,find_variables
Requirements
Python 3.11 or newer, libclang, a project that can produce compile_commands.json, and an MCP-capable agent. Install with pip install fw-context-mcp (version 0.27.6, stdio), then fw-context init in the project and fw-context index --build to build and index. Indexing is incremental by default — only changed translation units are re-parsed; --build forces a clean build, --force bypasses mtime checks. Ollama is optional and only powers local semantic enrichment and symbol explanations; the compiler-derived core index does not need it.
Setup effort
One command — pip install fw-context-mcp
USE CASES
Confirming which implementation the build actually compiles
Query the active build and its variants before reading any source, so the answer is about the target you ship.
Finding out who calls a function you want to change
Walk the callers, then the recursive callers, to see the real blast radius rather than the direct one.
Chasing a callback with no visible caller
List the indirect call sites and the function-pointer assignments that can reach them — the relationships text search cannot see.
Finding an implementation pattern rather than a name
Search inside function bodies for the call shape you are looking for, instead of matching symbol names.
Spotting code nothing reaches
Run the dead-code query against the indexed build, so "unreachable" means unreachable in this configuration.
38 tools
Listed in project docs. Your client may show a different list.
search_bodiessearch_contentlookup_symbolsmart_searchsemantic_searchfind_variablesget_file_mapget_sourceexplain_symbolget_symbol_contextread_filefind_callersfind_referencesfind_call_pathfind_all_callers_recursivefind_callees_recursivefind_dead_codefind_hotspotsfind_wrapper_callersfind_indirect_call_sitesfind_indirect_targetstrace_data_flowget_inheritance_chainget_class_membersget_template_instancesget_method_overridesget_environment_statuscheck_dependenciesget_active_buildlist_variantsreindex_filereindex_file_implreset_indexlist_projectsget_project_infocheck_ollamaconfigure_llmBEFORE YOU INSTALL
What to know first
Tools you get
38 tools named in the project's documentation.
Requires
- pip on PATH
- Python 3.11 or later
INSTALLATION
Connect your client
Server setup
pip install fw-context-mcpMCP Clients
Claude Code
fw-context init --tool claude-codeOpenCode
fw-context init --tool opencode