Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

10. Why Cerebro uses Model Context Protocol, or MCP: the right tool for the job

Date: 2026-06-06

Status

Accepted

Context

The cerebro MCP server solves one problem:

Give AI assistants standard, secure access to cerebro’s aggregated developer activity data, so coding help can draw on what the user has already done.

More specifically:

  • Cerebro collects and processes data from OpenCode sessions, git commits, TODO comments, and manual notes
  • A cortex, located via CORTEX_PATH and defaulting to ~/Projects/cortex, stores this data
  • The value is in access. An assistant that can query this data saves the user context switching
  • Assistants such as OpenCode, Claude Code, and similar tools need this data to give help grounded in the user’s own work

Decision

MCP matches the data access pattern

MCP has three core concepts that align exactly with cerebro’s needs:

Resources, for data exposure:

  • Cerebro’s primary asset is its data store
  • MCP Resources expose it:
    • Project information via the projects resource URI
    • Journal entries via the journal resource URI with a date parameter
    • Intent and goals via the intent resource URI with period and identifier parameters
    • TODO items via the todos resource URI with a project filter
    • Search results via the search resource URI with a query parameter

Tools, for actions:

  • Beyond reading data, users may want to trigger actions:
    • cerebro_build - Trigger a dashboard rebuild
    • add_journal_entry - Add a manual note
    • update_project_status - Mark project as active/inactive
    • refresh_cache - Force data re-collection

Prompts, for predefined interactions:

  • Common query patterns to define:
    • summarize_recent_activity
    • get_project_status
    • find_related_todos

Standards-based integration eliminates custom work

Without MCP, cerebro would need to:

  • Build custom HTTP/WebSocket APIs for each assistant type
  • Document and maintain separate integrations for OpenCode, Claude Code, etc.
  • Handle authentication, rate limiting, and error handling per integration

With MCP:

  • Implement the MCP protocol once
  • Any MCP-compatible assistant can discover and use cerebro’s capabilities
  • OpenCode, Claude Code, and other MCP hosts handle the client-side complexity
  • A single source of truth for what data and actions are available

Security boundaries come with the protocol

MCP draws clear security boundaries:

  • The assistant can only access what the MCP server explicitly exposes
  • No risk of arbitrary database access or unintended side effects
  • Tool invocations require explicit approval, configurable via permissions
  • MCP separates read-only resources from write-capable tools

The server layers on what cerebro already has

Cerebro already had:

  • Data collection logic for OpenCode, git, and TODOs
  • Processing and storage systems
  • Dashboard generation algorithms
  • Query capabilities for the web interface

The MCP server is a thin adaptation layer that:

  • Exposes existing capabilities through standard MCP interfaces
  • Requires minimal new business logic
  • Reuses the existing data processing work
  • Avoids re-implementing core cerebro features

Compatibility with a growing ecosystem

By adopting MCP, cerebro gains:

  • Compatibility with a growing list of MCP-hosted assistants
  • Continued relevance as more tools adopt the standard
  • Benefits from improvements to the MCP ecosystem
  • Less integration work for users trying multiple assistants

Why retrieval-augmented generation doesn’t cover it

A retrieval-augmented generation, or RAG, system could use cerebro’s data. MCP is the better fit because:

RAG is a pattern. MCP is a protocol.

  • RAG describes how to retrieve and use context within a single large language model, or LLM, interaction
  • MCP defines how systems connect to provide that context and more

MCP covers more than retrieval:

  • RAG focuses on fetching relevant information for a prompt
  • MCP also supports invoking actions through tools and defining interaction patterns through prompts
  • Cerebro also writes: assistants may need to trigger a build or add a journal entry

They can work together:

  • An agent can use MCP to discover what cerebro offers
  • Then apply RAG techniques to find the most relevant parts of large datasets
  • Or use MCP resources as the data source for a RAG system

Concrete example: how an assistant uses Cerebro MCP

When a user asks in OpenCode: “What work happened yesterday on the web-project?”

  1. OpenCode, acting as MCP host, connects to the cerebro-mcp server
  2. The server advertises its resources and tools via the MCP protocol
  3. OpenCode sees resources like: cerebro://journal/2026-04-16, cerebro://projects/web-project
  4. OpenCode reads the journal resource for yesterday
  5. Optionally reads project-specific data
  6. Combines this with the user’s question to form a complete prompt for the LLM
  7. The LLM responds with a summary of yesterday’s work on web-project
  8. If the user wants to take action, for example marking this project as inactive, OpenCode can invoke the appropriate MCP tool

Addressing the “RAG-shaped problem” intuition

The intuition is fair: at its core this is about making data available to augment LLM context, which is what RAG does. However:

  • MCP solves the connection and discovery layer: how to get the data to the assistant
  • RAG solves the relevance filtering layer: how to find the right data within a large corpus
  • Cerebro needs both layers:
    • MCP provides standardized access to the cerebro data store
    • RAG-like techniques could help cerebro rank journal entries by relevance, or help the assistant process large result sets

MCP is the right foundational choice because it sets the standard connection mechanism. Whether the assistant then uses simple retrieval, RAG, or another method is a separate concern. MCP doesn’t prescribe it. It makes the data available in a standard way, and stops there.

Consequences

The cerebro MCP server fits the job. MCP’s Resources, Tools, and Prompts map directly onto cerebro’s data access and action needs. The choice is standards-based, secure, uses infrastructure that already exists, and works with more assistants as the standard spreads. It isn’t overkill: it’s the minimum protocol that covers this exact use case. It complements RAG rather than replacing it.

The choice isn’t trend-following. It applies the right tool, MCP, to the right problem: standard AI-assistant access to a structured personal data store.