{"id":49077319,"url":"https://github.com/maschmann/mcp-context-memory","last_synced_at":"2026-04-20T10:33:41.263Z","repository":{"id":347525579,"uuid":"1194355599","full_name":"maschmann/mcp-context-memory","owner":"maschmann","description":"Semantic Project Brain MCP Server with AST Parsing","archived":false,"fork":false,"pushed_at":"2026-03-28T10:27:40.000Z","size":272,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-28T13:25:57.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maschmann.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-28T08:37:14.000Z","updated_at":"2026-03-28T10:26:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/maschmann/mcp-context-memory","commit_stats":null,"previous_names":["maschmann/mcp-context-memory"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/maschmann/mcp-context-memory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Fmcp-context-memory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Fmcp-context-memory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Fmcp-context-memory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Fmcp-context-memory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maschmann","download_url":"https://codeload.github.com/maschmann/mcp-context-memory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maschmann%2Fmcp-context-memory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32043097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T10:33:29.490Z","status":"ssl_error","status_checked_at":"2026-04-20T10:32:30.107Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-20T10:33:40.540Z","updated_at":"2026-04-20T10:33:41.250Z","avatar_url":"https://github.com/maschmann.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Semantic Project Brain MCP Server\n\nA 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.\n\nThe server uses [ChromaDB](https://docs.trychroma.com/) for fast, local embedding storage, and stores its data in a `.context_db` folder within your current project directory.\n\n## Prerequisites\n\nYou need [uv](https://github.com/astral-sh/uv) installed to run the server without managing virtual environments manually.\n\n```bash\n# Install uv if you haven't already\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n```\n\n## Available Tools\n\nThe server provides three MCP tools:\n1. `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.\n2. `search_context(query: str)`: A unified search over AST nodes and past project decisions.\n3. `remember_decision(topic: str, context: str)`: Saves manual architectural notes or reasoning (e.g., \"Why we chose framework X\").\n\n## Usage with AI Assistants\n\nYou 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.\n\n### Claude Desktop Integration\n\nTo install and use this MCP server with Claude Desktop, add the following to your `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"semantic-brain\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-context-memory\"],\n      \"alwaysAllow\": [\n        \"index_project\",\n        \"search_context\",\n        \"remember_decision\"\n      ]\n    }\n  }\n}\n```\n\n### Cursor Integration\n\nIn Cursor, go to **Settings \u003e Features \u003e MCP** and add a new MCP Server:\n- **Name:** Semantic Brain\n- **Type:** `command`\n- **Command:** `uvx mcp-context-memory`\n\n## Bootstrapping an Existing Project\n\nTo get the most out of the Semantic Project Brain in an existing codebase, follow these steps to seed it with relevant context:\n\n1.  **Initial Semantic Indexing**:\n    Run the indexing tool to build the initial AST-based map of your code:\n    `index_project(path=\".\")`\n    This allows the brain to immediately understand your classes, methods, and structural HTML.\n\n2.  **Capturing Core Architecture**:\n    Use `remember_decision` to document the foundational \"Why\" of the project. Good candidates for initial entries include:\n    - **Tech Stack Choice**: `remember_decision(topic=\"Tech Stack\", context=\"We use Symfony 7 with PHP 8.3 because...\")`\n    - **Database Schema**: `remember_decision(topic=\"Data Model\", context=\"The 'Orders' table is partitioned by year to handle high volume...\")`\n    - **Authentication Flow**: `remember_decision(topic=\"Auth\", context=\"JWT tokens are handled via LexikJWTAuthenticationBundle with a 1-hour TTL...\")`\n\n3.  **Indexing Documentation**:\n    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.\n\n4.  **Verification**:\n    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.\n\n## Instructions for AI Agents (AGENTS.md)\n\nCopy 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:\n\n```markdown\n# Semantic Project Brain Usage Guidelines\n\nYou have access to the `semantic-brain` MCP server. Follow these rules rigorously:\n\n1. **Re-indexing:** \n   - 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.\n   - If you cannot find expected code in `search_context`, trigger an index update first.\n\n2. **Understanding the Codebase:**\n   - 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.\n\n3. **Remembering Decisions:**\n   - Before completing a task that involved a notable architectural decision, tradeoff, or complex logic, you are OBLIGATED to call `remember_decision(topic=\"...\", context=\"...\")`.\n   - Store \"Why\" something was built a certain way, so you and other agents can retrieve it in future sessions using `search_context`.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaschmann%2Fmcp-context-memory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaschmann%2Fmcp-context-memory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaschmann%2Fmcp-context-memory/lists"}