Introduction to MCB
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 codebase understanding capabilities. By utilizing vector embeddings and tree-sitter parsing, MCB enables agents to maintain cross-session observations and perform deep analysis of multi-language repositories.
The system is built on a "Clean Architecture" foundation, ensuring strict separation between domain logic, infrastructure, and transport layers. It supports various embedding providers (e.g., OpenAI, Ollama) and vector stores (e.g., Qdrant, Milvus), making it adaptable to both local and cloud-based AI workflows.
Sources: README.md:1-21, AGENTS.md:154-156
Architecture Overview
MCB follows a strict Clean Architecture pattern where dependencies flow inward toward the domain core. This structure is enforced at compile time through workspace crates and automated validation rules.
Core Crate Layers
The project is divided into several primary crates, each representing a specific architectural layer:
| Crate | Responsibility | Dependency Direction |
|---|---|---|
mcb | CLI facade and entry point binary | Depends on all layers |
mcb-server | MCP protocol, transport, and web controllers | Inward to Infrastructure/Domain |
mcb-infrastructure | DI, configuration, cache, and logging | Inward to Domain |
mcb-domain | Core entities, value objects, and port traits | Zero internal dependencies |
mcb-providers | Adapters for specific technologies (Git, Vector stores) | Implements Domain ports |
mcb-utils | Shared leaf utilities and constants | Shared by all |
Sources: README.md:73-88, AGENTS.md:213-228, crates/mcb-domain/src/lib.rs:13-28
Dependency Flow Diagram
The following diagram illustrates the inward-flowing dependency model used by MCB to maintain architectural integrity.
Sources: README.md:75-88, AGENTS.md:213-228
MCP Tools and Capabilities
MCB exposes its functionality through the MCP protocol, allowing clients like Claude Desktop to invoke specific tools. These tools are grouped into nine operation families.
Key Tool Families
- Search: Includes
search_codeandsearch_memoryfor natural language queries. - Index: Operations like
index_repoandclear_indexfor managing vector embeddings of codebases. - Memory: Facilities for
store_memoryandinject_contextto handle persistent cross-session observations. - Validate: Architecture and code analysis via
validate_code. - VCS: Git-aware tools for
compare_branchesandanalyze_impact.
Sources: README.md:55-69, AGENTS.md:255-272
Tool Call Sequence
This diagram shows how a tool request flows from an MCP client through the server to the domain logic.
Infrastructure and Configuration
MCB uses a multi-provider strategy for embeddings and storage, configurable via environment variables or YAML files.
Provider Support
MCB supports a wide range of integrations:
- Embedding Providers: OpenAI, VoyageAI, Ollama, Gemini, FastEmbed, Anthropic.
- Vector Stores: Milvus, EdgeVec, Qdrant, Pinecone, Encrypted.
- AST Parsing: Supported for 14 languages including Rust, Python, Go, and Java.
Sources: README.md:9-15, crates/mcb-infrastructure/Cargo.toml:86-102
Configuration Profiles
Configuration is managed through Loco-native sections and MCB-specific settings:
- Development: Uses SQLite, Ollama embeddings, and Milvus.
- Test: Enables destructive test database flags and uses FastEmbed.
- Production: Requires admin API keys and utilizes optimized storage.
Sources: AGENTS.md:241-252, config/mcb-validate.toml:13-23
Admin Interface
Beyond the MCP protocol, mcb-server provides a web-based admin UI for monitoring and managing the server state. These routes are registered under the /ui prefix.
UI Controllers
The admin interface includes several functional pages:
- Dashboard: Overview of system status.
- Config: Displays active runtime configurations.
- Health: Shows system metrics and connectivity status.
- Jobs: Monitors background tasks like indexing.
- Browse: Interface for navigating stored code collections.
Sources: crates/mcb-server/src/controllers/web/mod.rs:133-140, README.md:65
Summary
Memory Context Browser (MCB) serves as a bridge between AI agents and complex codebases by providing a persistent, searchable, and structured memory layer. Its adherence to Clean Architecture and its modular provider system allow it to scale from local development environments to production-grade Kubernetes deployments.
Sources: README.md:4-21, AGENTS.md:154-162