# fw-context-mcp

Builds a compiler-aware index for embedded C/C++ firmware and lets coding agents query symbols, call paths, callbacks, and active code.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 10
- Author: turbyho
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/turbyho/fw-context-mcp
- Updated: 2026-10-19
- HTML: https://affpapa.org/en/nevibecode/mcp/fw-context-mcp

## What it does

fw-context-mcp creates a persistent project index from `compile_commands.json` and the `libclang` AST, then serves that information over MCP. An agent can inspect the implementation selected by a build, trace direct or indirect callers, locate callback registration, follow function-pointer paths, and filter out code removed by preprocessing.

The index stores symbols, source bodies, references, call edges, inheritance data, macros, and build metadata. FTS5 provides full-text search, while changed translation units can be processed incrementally after the first run. Project setup uses `fw-context init`, followed by `fw-context index --build`.

The project needs Python 3.11 or newer, `libclang`, and a build that can produce `compile_commands.json`. Ollama supplies embeddings and LLM-generated symbol descriptions; without it, those features fall back to full-text search or expose raw prompts.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add fw-context-mcp -- uvx fw-context-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from fw-context-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add fw-context-mcp -- uvx fw-context-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from fw-context-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "fw-context-mcp": {
            "command": "uvx",
            "args": [
                "fw-context-mcp"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from fw-context-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "fw-context-mcp": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "fw-context-mcp"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from fw-context-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add fw-context-mcp uvx fw-context-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from fw-context-mcp <command>

## When to use it
- identify the implementation selected by a firmware build
- trace execution from an ISR into application code
- list direct and indirect callers of an API
- locate callback registrations and function-pointer paths

## Example prompts
- Index this firmware from `compile_commands.json` and show which driver implementation is active.
- Trace every direct and indirect caller of this function, including callbacks.
- Assess which code paths are affected if this API changes, using the active preprocessor configuration.

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
