# DeusData/codebase-memory-mcp Source Code Location: C Core and Python Wrapper Guide

> Find the DeusData/codebase-memory-mcp source code. Discover where the C core is in src/ and the Python wrapper is in pkg/pypi/src/codebase_memory_mcp/.

- Repository: [Martin Vogel/codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp)
- Tags: how-to-guide
- Published: 2026-07-14

---

**The DeusData/codebase-memory-mcp project stores its implementation in two main directories: the C/C++ core engine lives in `src/` while the Python wrapper and CLI entry point reside in `pkg/pypi/src/codebase_memory_mcp/`.**

The `DeusData/codebase-memory-mcp` repository is organized as a hybrid codebase that combines a high-performance C engine with a convenient Python interface. Understanding exactly where the source code is located helps developers navigate the architecture, whether they need to modify the core memory indexing logic or adjust the Python CLI wrapper.

## C/C++ Core Implementation in `src/`

The bulk of the functionality lives under the `src/` directory, organized into functional sub-modules that handle everything from memory management to the embedded web server.

### Foundation Utilities

The `src/foundation/` directory contains low-level utilities for memory handling, logging, and cryptographic hashing. Key files include:

- [`src/foundation/mem.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/foundation/mem.c) – Memory management routines
- [`src/foundation/log.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/foundation/log.c) – Logging infrastructure
- [`src/foundation/sha256.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/foundation/sha256.c) – SHA-256 hashing implementation

### Discovery and Analysis

The `src/discover/` module handles code-base analysis, including language detection and gitignore parsing:

- [`src/discover/discover.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/discover/discover.c) – Language detection and file system scanning logic
- [`src/discover/userconfig.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/discover/userconfig.c) – User configuration parsing

### MCP Core Engine

The `src/mcp/` directory contains the "memory code-path" core responsible for indexing and compact output generation:

- [`src/mcp/mcp.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/mcp/mcp.c) – Core indexing logic that walks the file system and builds data structures
- [`src/mcp/index_supervisor.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/mcp/index_supervisor.c) – Index management and supervision

### Web Interface and File Watching

The project includes an embedded web UI served by a custom HTTP server:

- [`src/ui/http_server.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/ui/http_server.c) – Embedded HTTP server that delivers the React UI
- [`src/ui/layout3d.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/ui/layout3d.c) – 3-D layout calculations for the visualization
- [`src/watcher/watcher.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/watcher/watcher.c) – File-system watching utilities for detecting changes

### Program Entry Point

The main entry point for the compiled binary is located at:

- [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c) – Contains the `main()` function that parses high-level flags and starts the UI server

## Python Wrapper Location

The Python wrapper provides a pip-installable entry point that invokes the native binary. This code resides in `pkg/pypi/src/codebase_memory_mcp/`:

- [`pkg/pypi/src/codebase_memory_mcp/__main__.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/pkg/pypi/src/codebase_memory_mcp/__main__.py) – Enables `python -m codebase_memory_mcp` execution
- [`pkg/pypi/src/codebase_memory_mcp/_cli.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/pkg/pypi/src/codebase_memory_mcp/_cli.py) – Handles argument parsing and forwards commands to the compiled binary
- [`pkg/pypi/src/codebase_memory_mcp/__init__.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/pkg/pypi/src/codebase_memory_mcp/__init__.py) – Exposes a small public API for programmatic use

## React UI Source Code

The front-end visualization layer is built with React and TypeScript. These assets are located in:

- `graph-ui/src/*` – React/TypeScript source files that visualize the memory map produced by the C core

The UI assets are compiled into the binary and served by the embedded HTTP server defined in [`src/ui/http_server.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/ui/http_server.c).

## Building and Running from Source

To build and run the project from the source code locations described above:

**Building the C core:**

```bash

# Navigate to the C source directory

cd src

# Build with make (requires a C compiler)

make

# Run the binary directly

./codebase_memory_mcp /path/to/your/project

```

**Installing and running the Python wrapper:**

```bash

# Install the package in editable mode

pip install -e ./pkg/pypi

# Invoke via CLI

python -m codebase_memory_mcp /path/to/your/project

```

**Programmatic Python usage:**

```python
from codebase_memory_mcp import _cli

_cli.main(["/path/to/your/project"])

```

**Launching the web interface:**

```bash

# Start the server (default port 8000)

./codebase_memory_mcp /my/project

# Access in browser at http://localhost:8000/

```

## Summary

- The **C/C++ core** resides in `src/` and is organized into functional modules: `foundation/`, `discover/`, `mcp/`, `ui/`, and `watcher/`.
- The **Python wrapper** is located in `pkg/pypi/src/codebase_memory_mcp/` and provides CLI access to the native binary.
- The **React UI** source files are found in `graph-ui/src/` and are compiled into the binary for the embedded server.
- The **entry point** for the C application is [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c), which initializes the UI server and core indexing logic.

## Frequently Asked Questions

### Where is the main entry point in the DeusData/codebase-memory-mcp source code?

The main entry point is located at [`src/main.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/main.c) in the C source directory. This file contains the `main()` function responsible for parsing command-line flags, initializing the core engine, and starting the embedded HTTP server on the default port 8000.

### What programming languages are used in the codebase-memory-mcp project?

The project uses three primary languages: **C** for the core engine (located in `src/`), **Python** for the wrapper and CLI (located in `pkg/pypi/src/codebase_memory_mcp/`), and **TypeScript/React** for the web interface (located in `graph-ui/src/`). The C layer handles performance-critical tasks like file system indexing, while Python provides a convenient entry point for pip installation.

### How does the Python wrapper interact with the C core?

The Python wrapper acts as a thin layer that invokes the native binary. According to the source code in [`pkg/pypi/src/codebase_memory_mcp/_cli.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/pkg/pypi/src/codebase_memory_mcp/_cli.py), the Python CLI handles argument parsing and then forwards commands to the compiled C binary. The [`__init__.py`](https://github.com/DeusData/codebase-memory-mcp/blob/main/__init__.py) file exposes a minimal public API that allows programmatic invocation of the core functionality.

### Where are the web UI components located in the codebase-memory-mcp repository?

The React-based web UI source code is located in the `graph-ui/src/` directory. These TypeScript and React components are compiled and embedded into the binary, where they are served by the HTTP server defined in [`src/ui/http_server.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/ui/http_server.c). The 3-D layout logic is specifically handled in [`src/ui/layout3d.c`](https://github.com/DeusData/codebase-memory-mcp/blob/main/src/ui/layout3d.c).