Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

A local semantic memory and code-indexer that uses AST parsing for structural understanding and persists architectural decisions to help AI assistants bypass context window limits.

README.md

Semantic Project Brain MCP Server

A high-end Python-based MCP (Model Context Protocol) server that provides a local, semantic memory and code-indexer. It uses tree-sitter for AST-based parsing of source code to understand class definitions, method signatures, and structures, rather than naive text chunking. It also acts as a "Long-Term Memory" to help AI assistants bypass context window limits by persisting architectural decisions across sessions.

The server uses ChromaDB for fast, local embedding storage, and stores its data in a .context_db folder within your current project directory.

Prerequisites

You need uv installed to run the server without managing virtual environments manually.

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

Available Tools

The server provides three MCP tools:

  1. index_project(path: str = "."): Scans a directory, parses code semantically using AST (Python, Java, PHP, TS, JS, HTML), and indexes it. Defaults to current directory.
  2. search_context(query: str): A unified search over AST nodes and past project decisions.
  3. remember_decision(topic: str, context: str): Saves manual architectural notes or reasoning (e.g., "Why we chose framework X").

Usage with AI Assistants

You can use uvx (part of uv) to run this server directly from PyPI. This is the recommended way to use the Semantic Project Brain as it handles all dependencies automatically.

Claude Desktop Integration

To install and use this MCP server with Claude Desktop, add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "semantic-brain": {
      "command": "uvx",
      "args": ["mcp-context-memory"],
      "alwaysAllow": [
        "index_project",
        "search_context",
        "remember_decision"
      ]
    }
  }
}

Cursor Integration

In Cursor, go to Settings > Features > MCP and add a new MCP Server:

  • Name: Semantic Brain
  • Type: command
  • Command: uvx mcp-context-memory

Bootstrapping an Existing Project

To get the most out of the Semantic Project Brain in an existing codebase, follow these steps to seed it with relevant context:

  1. Initial Semantic Indexing:

Run the indexing tool to build the initial AST-based map of your code: index_project(path=".") This allows the brain to immediately understand your classes, methods, and structural HTML.

  1. Capturing Core Architecture:

Use remember_decision to document the foundational "Why" of the project. Good candidates for initial entries include:

  • Tech Stack Choice: remember_decision(topic="Tech Stack", context="We use Symfony 7 with PHP 8.3 because...")
  • Database Schema: remember_decision(topic="Data Model", context="The 'Orders' table is partitioned by year to handle high volume...")
  • Authentication Flow: remember_decision(topic="Auth", context="JWT tokens are handled via LexikJWTAuthenticationBundle with a 1-hour TTL...")
  1. Indexing Documentation:

If you have existing DOCS.md or ARCHITECTURE.md files, you can copy-paste their key insights into remember_decision to make them semantically searchable alongside the code.

  1. Verification:

Test the brain's "memory" by asking it a question through search_context(query="How is authentication handled?"). If it returns your stored decisions, it's ready to assist.

Instructions for AI Agents (AGENTS.md)

Copy the following block and paste it into your project's .cursorrules, AGENTS.md, or GEMINI.md to instruct the LLM on how to use this server:

# Semantic Project Brain Usage Guidelines

You have access to the `semantic-brain` MCP server. Follow these rules rigorously:

1. **Re-indexing:** 
   - If you make significant structural changes (e.g., creating a new module, renaming classes, or refactoring), you MUST trigger `index_project(path=".")` when you finish to keep the AST index up to date.
   - If you cannot find expected code in `search_context`, trigger an index update first.

2. **Understanding the Codebase:**
   - Use `search_context(query="ClassName")` to understand class hierarchies, locate method definitions, and retrieve precise semantic chunks of code instead of grepping the entire workspace.

3. **Remembering Decisions:**
   - Before completing a task that involved a notable architectural decision, tradeoff, or complex logic, you are OBLIGATED to call `remember_decision(topic="...", context="...")`.
   - Store "Why" something was built a certain way, so you and other agents can retrieve it in future sessions using `search_context`.

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Vector & Memory servers.