codebase-memory
Click on "Install 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., "@codebase-memoryshow me known architecture decisions"
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.
codebase-memory
Your AI agent forgets everything between sessions. This MCP server fixes that.
You: "What architecture pattern does this project use?"
Without codebase-memory:
AI: "I'd need to look through the codebase to determine that."
With codebase-memory:
AI: "This project uses a hexagonal architecture with ports and adapters.
The decision was made in March 2026 to improve testability.
Related files: src/ports/, src/adapters/, src/domain/"The Problem
AI coding agents (Cursor, Claude, Copilot) lose all context between sessions:
Architecture decisions get forgotten and re-asked
Code patterns get violated because the AI doesn't know your conventions
Bug workarounds get re-introduced after being fixed
Every session starts from zero
codebase-memory gives your AI persistent memory through the Model Context Protocol (MCP).
Related MCP server: ai-cortex
Quick Start
# Install
npm install -g codebase-memory
# Add to Claude Desktop config (~/.config/claude/claude_desktop_config.json)
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": ["codebase-memory"]
}
}
}That's it. Your AI agent now has 5 memory tools:
Tool | Description |
| Store architecture decisions, patterns, conventions, bugs, context |
| Search memories by query, category, tags, or file path |
| Update existing memories when things change |
| Delete outdated or incorrect memories |
| Get overview of all memories (call at session start) |
Memory Categories
Category | Use For |
| System design decisions, service boundaries, data flow |
| Code patterns: repository, factory, observer, etc. |
| Why choices were made ("We chose Postgres over MongoDB because...") |
| Package choices, version constraints, compatibility notes |
| Naming rules, file structure, formatting standards |
| Known bugs, workarounds, things that look wrong but aren't |
| Domain knowledge, business rules, user requirements |
| Planned improvements, tech debt, future work |
| How files/modules connect, dependency graphs |
How It Works
AI stores knowledge — As your agent learns about the codebase, it calls
rememberto save important informationPersisted in SQLite — Memories are stored locally in
.codebase-memory/memory.dbRetrieved on demand — When the agent needs context, it calls
recallwith a search queryFull-text search — SQLite FTS5 enables fast, relevant search across all memories
Importance scoring — High-importance memories surface first
Example Workflow
Session 1 (you're setting up the project):
AI remembers:
- "architecture: Monorepo with turborepo, apps/ for services, packages/ for shared"
- "convention: All API routes use zod validation middleware"
- "decision: Chose Drizzle ORM over Prisma for edge runtime support"
- "bug: Don't use Date objects in API responses, use ISO strings (timezone issues)"
Session 2 (next day, different task):
AI calls project_summary -> instantly knows the project structure
AI calls recall({query: "API validation"}) -> knows to use zod middleware
AI calls recall({filePath: "src/api/"}) -> gets all API-related memories
-> Writes code that follows all your established patternsConfiguration
Claude Desktop
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": ["codebase-memory"]
}
}
}Cursor
Create .cursor/mcp.json in your project root:
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": ["codebase-memory"]
}
}
}Custom Database Location
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": ["codebase-memory", "--db", "/path/to/memory.db"]
}
}
}Programmatic API
import { MemoryDatabase } from 'codebase-memory';
const db = new MemoryDatabase({ path: './memory.db' });
// Store a memory
const entry = db.create({
category: 'architecture',
title: 'Event-driven messaging',
content: 'Services communicate via RabbitMQ. Orders service publishes OrderCreated events.',
tags: ['messaging', 'rabbitmq'],
filePaths: ['src/events/', 'src/services/orders/'],
importance: 9,
});
// Search memories
const results = db.query({
query: 'messaging',
category: 'architecture',
minImportance: 7,
});
// Get project overview
const summary = db.getSummary();
console.log(`Total memories: ${summary.totalMemories}`);
console.log(`Top tags: ${summary.topTags.map(t => t.tag).join(', ')}`);
db.close();Data Storage
Location:
.codebase-memory/memory.db(in your project root)Format: SQLite with FTS5 full-text search
Size: Typically under 1MB for thousands of memories
Backup: Just copy the
.dbfileGit: Add
.codebase-memory/to.gitignore(per-developer memories) or commit it (shared team knowledge)
CLI Options
codebase-memory [options]
--db <path> SQLite database path (default: .codebase-memory/memory.db)
--project <path> Project root directory (default: cwd)
--version Show version
--help Show helpLicense
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yuga-hashimoto/codebase-memory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server