codebase-context
Local-first Second brain for AI agents working on your codebase - detects your team coding conventions and patterns, brings in persistent memory, code-generation checks, and hybrid search with evidence scoring. Exposed through CLI and MCP server.
claude mcp add --transport stdio patricksys-codebase-context npx -y codebase-context /path/to/your/project
How to use
codebase-context is an MCP server that provides a rich, local-first context for AI agents working on your codebase. It surfaces curated context about your project’s conventions, patterns, and memories, enabling agents to reason with actual team practices rather than generic guidance. The server analyzes your repository to extract team-wide conventions from code and git history, tracks decisions and memories across sessions, and auto-refreshes the index as you edit. When an agent queries the MCP, it receives a structured context that includes code wiring, related files, quality indicators, and adoption trends, helping the agent make safer edits and better decisions.
Common tool commands exposed by this MCP server include metadata, patterns, and memory lists, which let you quickly understand the current state of your codebase. For example, metadata gives a quick overview of the repo, patterns shows current team coding habits and their adoption percentages, and memory list reveals past decisions and why they were made. When using an agent in conjunction with this MCP, you can rely on the one-shot tool call to retrieve that comprehensive context instead of piecing together multiple sources yourself.
How to install
Prerequisites:
- Node.js and npm installed on your machine
- Access to the internet to fetch the MCP package
Install steps:
- Ensure you have Node.js installed. You can verify with:
node -v
npm -v
- Install or run the MCP server using npx (no permanent installation required):
npx -y codebase-context /path/to/your/project
- (Optional) Install globally if you want a persistent CLI:
npm install -g codebase-context
- Verify installation by running a quick metadata query:
npx -y codebase-context metadata
- Integrate with your preferred client (Claude/VS Code/OpenCode/etc.) using the example configurations in the README.
Additional notes
Tips and caveats:
- The MCP runs locally by default; you can opt into cloud embeddings by configuring EMBEDDING_PROVIDER, but be aware that this may transmit your code.
- The index auto-refreshes as you edit, so you don’t have to manually reindex after every change.
- If you’re using the single-shot integration in an agent, pass the project path as shown in the examples so the server can scope the context correctly.
- If you see stale context, trigger a manual reindex or restart the MCP server to refresh memories and patterns.
Related MCP Servers
Overture
Overture is an open-source, locally running web interface delivered as an MCP (Model Context Protocol) server that visually maps out the execution plan of any AI coding agent as an interactive flowchart/graph before the agent begins writing code.
toolhive-studio
ToolHive is an application that allows you to install, manage and run MCP servers and connect them to AI agents
Pare
Dev tools, optimized for agents. Structured, token-efficient MCP servers for git, test runners, npm, Docker, and more.
codingbuddy
Codingbuddy orchestrates 29 specialized AI agents to deliver code quality comparable to a team of human experts through a PLAN → ACT → EVAL workflow.
cortex-ast
A powerful Model Context Protocol (MCP) server and Omni-AST engine. It empowers AI agents to seamlessly parse complex codebases, execute secure cross-project operations, and dynamically fetch token-optimized rules.
AiDex
MCP Server for persistent code indexing. Gives AI assistants (Claude, Gemini, Copilot, Cursor) instant access to your codebase. 50x less context than grep.