mcp-context-memory
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-context-memory search for user login logic"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 | shRelated MCP server: ProjectMind MCP
Available Tools
The server provides three MCP tools:
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.search_context(query: str): A unified search over AST nodes and past project decisions.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:
commandCommand:
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:
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.Capturing Core Architecture: Use
remember_decisionto 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...")
Indexing Documentation: If you have existing
DOCS.mdorARCHITECTURE.mdfiles, you can copy-paste their key insights intoremember_decisionto make them semantically searchable alongside the code.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`.Available Tools
3 toolsindex_projectA
Scans the directory, respects .gitignore, and performs AST-based decomposition to index class definitions, methods, and structural HTML/CSS into 'code_semantics'.
Args: path: The absolute or relative path of the directory to index. Defaults to current directory.
Inputs: path. Returns: result
remember_decisionB
Allows the LLM to save manual architectural notes or 'Why' something was built a certain way.
Args: topic: A short topic or category name for this decision. context: The detailed reasoning, architectural decision, or context.
Inputs: topic (required), context (required). Returns: result
search_contextA
A unified search that looks through both code structures (AST nodes) and past project decisions.
Args: query: The search query to find relevant context.
Inputs: query (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clear, distinct purpose: index_project builds the semantic index, search_context queries it, and remember_decision stores explicit architectural notes. There is no functional overlap between these three operations.
All tool names follow the same verb_noun pattern: index_project, search_context, remember_decision. The verbs are concise and the nouns accurately describe the target resource, making the API predictable and easy to navigate.
With only 3 tools, the server is tightly scoped to its stated purpose of context memory. Each tool covers a distinct fundamental operation (index, search, remember), and there is no bloat or redundancy.
The tool set covers the core lifecycle of context memory: ingest (index_project), query (search_context), and explicit knowledge persistence (remember_decision). Minor gaps include lack of delete/update for decisions and no re-indexing mechanism, but these are not critical for the primary workflow.
Maintenance
Related MCP Connectors
Shared memory for coding agents. Stop re-explaining your codebase every session.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Persistent engineering memory designed to follow developers across coding agents.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Related MCP Servers
- AlicenseAqualityBmaintenanceSelf-hosted semantic code search for AI coding agents. Indexes many repositories at once with tree-sitter AST chunking, local llama.cpp embeddings and Qdrant, so Claude Code, Cursor, Codex and any MCP client can find code by meaning, trace usages and callers, and read the git history behind each chunk. No API keys, and your code never leaves your machine.21835MIT
- AlicenseCqualityBmaintenanceGives AI coding assistants persistent project memory and semantic code search, running fully locally with no API keys required.56MIT
- FlicenseNot gradedqualityDmaintenanceProvides persistent codebase memory and semantic context for AI agents via AST-aware chunking and symbol graph indexing.1-
- AlicenseNot gradedqualityBmaintenanceProvides persistent long-term memory (semantic RAG) for AI coding assistants, enabling them to store and semantically search code and documentation across chat sessions without token limits.5MIT