Home
Relevant source files
The following files were used as context for generating this wiki page:
Memory Context Browser (MCB) is a high-performance Model Context Protocol (MCP) server implemented in Rust. It provides AI coding agents with persistent memory, semantic code search, and deep codebase understanding. The system utilizes a multi-provider architecture for embeddings and vector storage, alongside AST-aware analysis for multiple programming languages.
Sources: README.md:1-15, AGENTS.md:120-123
Architecture Overview
MCB is built using Clean Architecture principles, enforcing strict inward-only dependency flow across seven workspace crates. This design ensures that business logic remains decoupled from external frameworks and infrastructure concerns.
Crate Hierarchy and Dependency Flow
The following diagram illustrates the structural organization and the direction of dependencies between the core crates:
This architecture ensures that mcb-domain remains the core with zero internal dependencies, while higher-level crates like mcb-server handle protocol transports and external interfaces.
Sources: README.md:65-82, AGENTS.md:188-212, config/mcb-validate-internal.toml:13-20
Core Components
| Component | Responsibility | Relevant Files |
|---|---|---|
| mcb-server | Handles MCP protocol, Axum HTTP server, and admin UI. | crates/mcb-server/Cargo.toml |
| mcb-infrastructure | Manages Dependency Injection (DI), config loading (Loco), and logging. | crates/mcb-infrastructure/Cargo.toml |
| mcb-domain | Contains core entities, value objects, and port traits. | AGENTS.md:197-200 |
| mcb-providers | Adapter implementations for embeddings, vector stores, and Git. | README.md:78-80 |
| mcb-validate | Architecture rule engine and analysis CLI. | config/mcb-validate-internal.toml |
Technical Features
Semantic Search & Indexing
MCB supports natural language queries over indexed codebases using vector embeddings. It features a multi-provider architecture supporting 6 embedding providers (e.g., OpenAI, VoyageAI, Ollama) and 5 vector stores (e.g., Milvus, Qdrant, Pinecone).
Sources: README.md:8-12, README.md:46-56
AST-Aware Analysis
The system uses Tree-sitter parsing to provide deep codebase understanding for 14 languages, including Rust, Python, JS/TS, Go, and Java. This allows for structural analysis beyond simple text matching.
Sources: README.md:14-16, crates/mcb-infrastructure/Cargo.toml:79-92
MCP Tooling Surface
MCB exposes 24 public tool names registered via linkme descriptors, categorized into 9 operation families:
| Family | Key Tools |
|---|---|
| Search | search_code, search_memory |
| Index | index_repo, index_status, clear_index |
| Validate | validate_code, analyze_code, list_rules |
| Memory | store_memory, get_memories, list_memories |
| VCS | list_repos, compare_branches, analyze_impact |
Sources: README.md:58-64, AGENTS.md:231-246
Development Workflow
The project utilizes a Makefile backed by a monopoly script (scripts/lib/mcb.sh) to manage the development lifecycle.
Common Commands
make build # Builds the release binary
make test # Runs unit, integration, and e2e tests
make check # Runs full pipeline: fmt + lint + validate
make validate # Architecture rule enforcement via mcb-validate
Sources: README.md:104-112, AGENTS.md:154-180
Quality Gates
Contributors must adhere to strict quality gates enforced at compile-time and via pre-commit hooks:
- Zero Warnings: All code must pass
clippywith zero warnings. - Architecture Validation: No internal dependency violations (e.g., Domain layer cannot depend on Infrastructure).
- Safety:
unsafe_codeis denied. - Error Handling:
unwrap()andexpect()are forbidden in production code paths.
Sources: README.md:114-120, CONVENTIONS.md:10-20, AGENTS.md:11-50
Summary
MCB serves as a robust foundation for AI agents by providing high-performance, context-aware tools via the Model Context Protocol. Its adherence to Clean Architecture and strict engineering principles ensures a maintainable and scalable codebase capable of deep codebase analysis and persistent memory management.
Sources: README.md:1-15, AGENTS.md:120-125