mcp-chromadb-memory

stevenjjobson/mcp-chromadb-memory

3.2

If you are the rightful owner of mcp-chromadb-memory and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP ChromaDB Memory Server is an AI-driven server that utilizes the Model Context Protocol to manage intelligent memory storage and retrieval using ChromaDB.

Tools
  1. store_memory

    Stores information based on AI-assessed importance.

  2. recall_memories

    Retrieves relevant memories with context-aware filtering.

  3. health_check

    Verifies server status and ChromaDB connection.

🧠 MCP ChromaDB Memory Server - Cognitive State Management Platform

MCP ChromaDB TypeScript Docker

A comprehensive Cognitive State Management Platform that transforms how developers preserve context, manage knowledge, and maintain continuity across projects, sessions, and teams.

Features β€’ Platform Vision β€’ Installation β€’ Usage β€’ API β€’ Architecture β€’ Contributing


🌟 Overview

The MCP ChromaDB Memory Server has evolved from a simple memory storage tool into a comprehensive Cognitive State Management Platform with revolutionary Dual Vault Architecture.

🎯 Key Innovation: Dual Vault Architecture

Maintain two separate but connected knowledge bases:

  • 🧠 Core Vault: Your personal "second brain" that grows with every project
  • πŸ“¦ Project Vault: Clean, isolated context for each specific project

Never lose valuable insights again - learn once, apply everywhere!

πŸš€ Platform Vision

This project implements a complete cognitive platform that:

  • Preserves Context: Never lose your mental state when switching tasks or devices
  • Learns from Usage: Automatically extracts patterns and insights from development sessions
  • Scales Intelligently: Hierarchical memory system optimized for performance
  • Integrates Deeply: Works seamlessly with your existing development workflow

See for detailed vision.

Platform Capabilities

🌟 Headline Features
  • 🎯 Dual Vault Architecture - Separate core knowledge from project contexts while maintaining connections
  • πŸš€ 60x Performance Boost - PostgreSQL hybrid storage eliminates ChromaDB throttling
  • 🧠 Intelligent Categorization - Automatically routes memories to the appropriate vault
  • πŸ”„ Cross-Vault Search - Query both vaults with weighted, relevant results
  • πŸ“ˆ Memory Promotion - Elevate project insights to permanent core knowledge
Current Features
  • πŸ€– Autonomous Storage - AI-assessed importance determines what gets stored
  • πŸ” Intelligent Retrieval - Multi-factor scoring combines semantic similarity, recency, importance, and access frequency
  • 🎯 Context-Aware - Supports different memory contexts (general, user preferences, critical tasks, notes)
  • πŸ“Š Smart Scoring - Retrieval uses weighted scoring: Semantic (40%), Recency (30%), Importance (20%), Frequency (10%)
  • πŸ”Ž Exact Search - Fast string matching with keyword indexing for precise lookups
  • πŸ”€ Hybrid Search - Combines exact and semantic search with configurable weights
  • πŸ—œοΈ Token Optimization - Smart compression (50-90% reduction) while preserving important content
  • πŸ“ˆ Access Pattern Analysis - Track hot/warm/cold memories with tier recommendations
  • πŸ“ Obsidian Integration - Read, write, and search notes in your Obsidian vault with semantic search
  • πŸ“š Session Logging - Automatically log Claude Code conversations to Obsidian with summaries and code highlights
  • πŸ“‹ Template System - Import and manage documentation templates from webhooks with Handlebars support
  • πŸ—οΈ Hierarchical Vault Structure - Universal Developer Documentation System with automated folder generation and hooks
  • πŸ₯ Health Monitoring - Real-time system health checks with visual dashboard and startup verification
  • πŸ“Š Vault Index - Comprehensive vault statistics and navigation system with automatic updates
  • πŸ—οΈ Hierarchical Memory System - Three-tier architecture (Working, Session, Long-term) with automatic migration
  • πŸ”„ Vault Management - Multi-project support with instant context switching
  • πŸ’Ύ State Capture - Save and restore complete working context across devices
  • 🧠 Code Intelligence - Automatic codebase indexing with symbol tracking and relationships
  • πŸ” Code-Aware Search - Stream-based symbol search, find implementations and patterns instantly
  • πŸ“Š Code Pattern Recognition - Detect and learn from coding patterns, suggest improvements
  • ⚑ Streaming Responses - Fast, incremental results optimized for Claude Code and large codebases
  • πŸš€ Hybrid Storage - PostgreSQL + ChromaDB for optimal performance (644 symbols/second, 60x faster than ChromaDB alone) βœ…
  • πŸ”„ Dual-Write Migration - Safe migration with writes to both databases, configurable read ratios βœ…
  • ⚑ No Throttling - Bulk operations complete in <1s vs 60s+ with ChromaDB alone βœ…
Platform Implementations
  • 🎯 CoachNTT - Specialized conversational AI implementation with voice synthesis and VSCode integration
    • AI-powered text-to-speech with ElevenLabs
    • Rich VSCode extension with audio controls
    • Conversation-aware memory scoring
    • See
Platform Enhancements (Coming Soon)
  • 🧬 Advanced Pattern Recognition - Deep learning from development patterns across projects
  • πŸ”„ Memory Consolidation - Intelligent deduplication and memory merging
  • πŸ”€ Git Integration - Link memories to commits, branches, and pull requests

πŸ“‹ Requirements

  • Node.js 20+
  • Docker & Docker Compose
  • PostgreSQL 16+ with pgvector extension (included in docker-compose)
  • OpenAI API key (for embeddings)
  • 4GB RAM minimum (increased for PostgreSQL)
  • Windows/macOS/Linux

πŸ“– Quick References

🎯 Get Started with Dual Vaults

  • - Set up dual vaults in 5 minutes
  • - Migrate from single vault

Core Documentation

  • - Learn how to effectively use the memory system
  • - PostgreSQL + ChromaDB hybrid architecture
  • - Code-aware features and symbol indexing
  • - Set up isolated development environment
  • - Current progress and roadmap
  • - Conversational AI with voice synthesis

πŸ“š New User Guides

  • - Complete guide for Claude Code & Desktop with WSL/Windows paths
  • - Essential commands and tips on one page
  • - Advanced techniques and productivity patterns

πŸš€ Quick Start

Using Docker Compose (Recommended)

  1. Clone the repository

    git clone https://github.com/stevenjjobson/mcp-chromadb-memory.git
    cd mcp-chromadb-memory
    
  2. Set up environment

    cp .env.example .env
    # Edit .env and add your OpenAI API key
    
  3. Start services

    # For Claude Desktop - start ChromaDB and PostgreSQL (both required)
    docker-compose up -d coachntt-chromadb coachntt-postgres
    
    # Or use the convenience script (Windows)
    .\start-chromadb.ps1
    

    Note: Claude Desktop creates its own MCP container automatically. Both ChromaDB and PostgreSQL are now required for the hybrid storage architecture.

  4. Verify installation

    docker-compose logs -f coachntt-chromadb
    

Note: The MCP server container will exit immediately when run standalone. This is normal behavior - MCP servers communicate via stdio and need a client to connect. Use the Claude Desktop configuration below to properly connect to the server.

🎯 Dual Vault Architecture

Transform Your Development Workflow

The Dual Vault Architecture revolutionizes how you manage knowledge across projects:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Core Vault       β”‚         β”‚   Project Vault     β”‚
β”‚  (Your Brain 🧠)    │◄────────│  (Current Work πŸ“¦)  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β€’ Best Practices    β”‚         β”‚ β€’ Project Decisions β”‚
β”‚ β€’ Code Patterns     β”‚         β”‚ β€’ Local Config      β”‚
β”‚ β€’ Personal Prefs    β”‚         β”‚ β€’ Client Context    β”‚
β”‚ β€’ Learned Wisdom    β”‚         β”‚ β€’ Session Logs      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–²                                 β–²
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
                  Smart Search
                  Categorization
                  Memory Promotion

Quick Setup (2 minutes)

  1. Enable Dual Vaults in .env.PRODUCTION:

    VAULT_MODE=dual
    CORE_VAULT_PATH=C:/Users/YourName/Obsidian/YourVault
    PROJECT_VAULT_PATH=./vault
    
  2. Update Claude Desktop config to mount both vaults

  3. Start using - memories automatically go to the right vault!

See for complete setup.

Local Development Setup

  1. Install dependencies

    npm install
    
  2. Start required services

    # Both ChromaDB and PostgreSQL are required
    docker-compose up -d coachntt-chromadb coachntt-postgres
    
  3. Build and run

    npm run build
    npm run dev
    

πŸš€ Quick Start with WSL

Using the Startup Script (Recommended)

For WSL users, we provide a comprehensive startup script that ensures all services are running correctly:

# Make the script executable (first time only)
chmod +x start-mcp-platform.sh

# Run the startup script
./start-mcp-platform.sh

The script will:

  • βœ… Verify Docker is running
  • βœ… Check ChromaDB status and start if needed
  • βœ… Validate environment configuration
  • βœ… Build TypeScript if needed
  • βœ… Run health checks
  • βœ… Display a visual dashboard
  • βœ… Optionally launch Claude Desktop when ready

See for detailed information.

πŸ”§ Configuration

Environment Variables

Create a .env file in the project root:

# ChromaDB Configuration
CHROMA_HOST=coachntt-chromadb  # Use 'localhost' for local development
CHROMA_PORT=8000

# OpenAI Configuration (required for embeddings)
# API key is stored securely in Docker secrets - see Security section below

# Obsidian Integration (optional)
OBSIDIAN_VAULT_PATH=/path/to/your/vault

# Memory Configuration
MEMORY_IMPORTANCE_THRESHOLD=0.7    # Minimum importance score to store (0-1)
MEMORY_COLLECTION_NAME=coachntt_memories
MAX_MEMORY_RESULTS=10

# Server Configuration
MCP_SERVER_NAME=coachntt-cognitive-server
MCP_SERVER_VERSION=1.0.0

Claude Desktop Integration

  1. Locate the configuration file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Add the MCP server configuration:

{
  "mcpServers": {
    "memory": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--network", "mcp-chromadb-memory_coachntt-platform-network",
        "-v", "C:/Users/Steve/Dockers/mcp-chromadb-memory/vault:/vault:rw",
        "-e", "DOCKER_CONTAINER=true",
        "-e", "CHROMA_HOST=coachntt-chromadb",
        "-e", "CHROMA_PORT=8000",
        "-e", "POSTGRES_HOST=coachntt-postgres",
        "-e", "POSTGRES_PORT=5432",
        "-e", "POSTGRES_USER=coachntt_user",
        "-e", "POSTGRES_PASSWORD=coachntt_pass",
        "-e", "POSTGRES_DATABASE=coachntt_cognitive_db",
        "-e", "USE_HYBRID_STORAGE=true",
        "-e", "OBSIDIAN_VAULT_PATH=/vault",
        "-e", "AUTO_START_SESSION_LOGGING=true",
        "-e", "SESSION_LOGGING_PROJECT_NAME=CoachNTT Cognitive Platform",
        "mcp-chromadb-memory-mcp-memory"
      ]
    }
  }
}
  1. Restart Claude Desktop to load the new configuration

For local development without Docker:

{
  "mcpServers": {
    "memory-local": {
      "command": "node",
      "args": ["C:\\path\\to\\mcp-chromadb-memory\\dist\\index.js"],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here",
        "CHROMA_HOST": "localhost",
        "CHROMA_PORT": "8000",
        "POSTGRES_HOST": "localhost",
        "POSTGRES_PORT": "5432",
        "POSTGRES_DATABASE": "coachntt_cognitive_db",
        "POSTGRES_USER": "coachntt_user",
        "POSTGRES_PASSWORD": "coachntt_pass",
        "USE_HYBRID_STORAGE": "true"
      }
    }
  }
}

πŸ“š API Reference

Tools

store_memory

Stores information based on AI-assessed importance.

{
  content: string;      // The information to store
  context?: string;     // Context category (general, user_preference, task_critical, obsidian_note)
  metadata?: object;    // Additional metadata
}

Response:

{
  "stored": true,
  "id": "mem_1234567890_abc",
  "importance": 0.85
}
recall_memories

Retrieves relevant memories with context-aware filtering.

{
  query: string;        // Search query
  context?: string;     // Optional context filter
  limit?: number;       // Max results (default: 5)
}

Response:

[
  {
    "content": "User prefers dark mode interfaces",
    "context": "user_preference",
    "importance": "0.80",
    "timestamp": "2024-01-15T10:30:00Z",
    "scores": {
      "total": "0.825",
      "semantic": "0.920",
      "recency": "0.750",
      "importance": "0.800",
      "frequency": "0.600"
    }
  }
]
health_check

Verifies server status and ChromaDB connection.

Response:

{
  "status": "ok",
  "chromadb_connected": true,
  "server_version": "1.0.0",
  "platform": "linux",
  "docker": true
}

Session Logging Tools

start_session_logging

Begins logging a Claude Code session to Obsidian.

{
  project?: string;     // Project name (default: "General")
}
save_session_log

Saves the current session to Obsidian with auto-generated summary.

{
  summary?: string;     // Optional manual summary
}
log_session_event

Manually logs specific events during the session.

{
  type: string;         // Event type: user, assistant, tool, decision, achievement
  content: string;      // Event content
  metadata?: object;    // Additional metadata
}

Automatic Session Logging: Set AUTO_START_SESSION_LOGGING=true in your environment to automatically start logging when Claude Code connects. The session will be auto-saved on exit if SESSION_LOGGING_SAVE_ON_EXIT=true (default).

See for detailed usage.

Template Management Tools

import_template

Import a documentation template from an external webhook source.

{
  source: string;        // URL of the template to import
  category?: string;     // Template category (session, decision, pattern, etc.)
  variables?: object;    // Variables to apply immediately
  saveAs?: string;       // Filename to save generated document
}
list_templates

List all available templates in the system.

{
  category?: string;     // Filter by category
  source?: string;       // Filter by source URL
}
apply_template

Apply a template with variables to generate a document.

{
  templateId: string;    // ID of the template
  variables: object;     // Variables to apply
  outputPath: string;    // Where to save the document
}
configure_template_webhook

Configure a webhook source for importing templates.

{
  name: string;          // Name for this webhook
  url: string;           // Webhook URL
  authType?: string;     // Authentication type (none, bearer, api-key, oauth)
  authCredentials?: string; // Auth credentials
  syncInterval?: number; // Auto-sync interval in minutes
}
sync_templates

Synchronize templates from all configured webhook sources.

// No parameters required

See for detailed architecture.

Vault Structure Management Tools

import_vault_structure

Import a complete vault structure definition with templates and hooks.

{
  source: string;              // URL or path to structure definition
  applyImmediately?: boolean;  // Apply structure after import
  targetPath?: string;         // Target path (defaults to vault)
}
generate_vault_structure

Generate folder hierarchy from a loaded structure template.

{
  structureId?: string;        // Structure name/ID
  targetPath: string;          // Where to generate
  options?: {
    skipExisting?: boolean;    // Skip existing folders
    dryRun?: boolean;          // Preview without changes
    applyTemplates?: boolean;  // Apply folder templates
  }
}
apply_folder_hooks

Apply hooks to existing folders for automated actions.

{
  folderPath: string;          // Folder to apply hooks to
  hookIds?: string[];          // Specific hooks (or all)
}

See for complete documentation.

Hierarchical Memory System

The platform now features a sophisticated three-tier memory architecture that automatically manages memory lifecycle:

Memory Tiers
  1. Working Memory (48 hours)

    • Stores immediate context and active tasks
    • Fastest retrieval speed
    • Automatically migrates older memories to Session tier
  2. Session Memory (14 days)

    • Contains recent development sessions
    • Balanced performance and retention
    • Migrates important memories to Long-term tier
  3. Long-term Memory (Permanent)

    • Preserves critical knowledge and patterns
    • Optimized for important information
    • Never expires
Tier Management Tools
  • get_tier_stats - View memory distribution across tiers
  • analyze_access_patterns - Get recommendations for tier optimization
  • get_memories_for_migration - Preview pending tier migrations
Configuration

Configure tier behavior in your .env:

# Tier Configuration
TIER_ENABLED=true
TIER_WORKING_RETENTION=48      # Hours
TIER_SESSION_RETENTION=336     # Hours (14 days)
TIER_LONGTERM_RETENTION=8760   # Hours (1 year)
TIER_MIGRATION_INTERVAL=3600000 # Milliseconds (1 hour)

The migration service runs automatically in the background, moving memories between tiers based on age and access patterns.

Code Intelligence System

The platform includes advanced code intelligence capabilities optimized for Claude Code and development workflows:

Code Intelligence Tools
  • index_codebase - Fast symbol extraction and storage with streaming support
  • find_symbol - Stream-based symbol search across your codebase
  • get_symbol_context - Rich context retrieval including imports, usage, and relationships
  • analyze_code_patterns - Detect patterns, anti-patterns, and improvement opportunities
Code Memory Features
  1. Automatic Symbol Indexing

    • Functions, classes, methods, and variables
    • Import relationships and dependencies
    • File structure and organization
    • Automatic updates on file changes
  2. Streaming Architecture

    • Results stream as they're found (<50ms first result)
    • Prioritized results (exact matches first)
    • Background semantic search
    • Optimized for large codebases
  3. Code-Aware Search

    • Natural language to code queries
    • Symbol type filtering
    • Relationship navigation
    • Pattern-based search
Configuration
# Code Intelligence Configuration
CODE_INDEXING_ENABLED=true
CODE_INDEXING_PATTERNS="**/*.{js,ts,py,java,go,rs,cpp}"
CODE_INDEXING_EXCLUDE="**/node_modules/**,**/dist/**,**/.git/**"
CODE_PATTERN_DETECTION=true
CODE_STREAMING_ENABLED=true
CODE_CACHE_SIZE=1000

See for detailed usage and examples.

🎯 Smart Tool Optimization

Hook Scripts for Efficient Tool Usage

The project includes intelligent hook scripts that intercept inefficient tool usage and suggest optimized alternatives, resulting in 94% token reduction and 96% faster searches.

How It Works

When you use Grep or Glob for code searches, the hooks detect patterns and suggest better tools:

# Before: Inefficient grep search
Grep pattern="class UserManager" include="*.ts"
# Hook intercepts and suggests:
β†’ Use: find_symbol query='UserManager' type=['class']

# Result: 98% faster, 98% fewer tokens
Performance Improvements
ScenarioTraditional ApproachOptimized ApproachImprovement
Finding a classGrep: 2,500ms, 15K tokensfind_symbol: 50ms, 200 tokens98% faster
Code searchGrep: 3,000ms, 45K tokensfind_symbol: 100ms, 2.4K tokens94% fewer tokens
File listingGlob: 1,000ms, 8K tokensexplore_folder: 200ms, 1K tokens87% reduction
Benefits
  • Token Efficiency: 10-100x reduction in token usage
  • Speed: O(1) indexed lookups vs O(n) file scanning
  • Accuracy: 100% relevant results vs 30% with grep
  • Cost Savings: ~$2,820/month saved on API costs (based on 100 searches/day)

The hooks work automatically in the background, requiring no configuration or user intervention.

See for complete implementation details.

πŸ—οΈ Architecture

Hybrid Storage Architecture (v2.1+)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   MCP Client    │────▢│    MCP Server    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚                         β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  PostgreSQL    β”‚      β”‚    ChromaDB     β”‚
            β”‚  + pgvector    β”‚      β”‚  (Embeddings)  β”‚
            β”‚ (Structure)    β”‚      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Performance Improvements (Tested & Verified)

OperationChromaDB OnlyHybrid (PostgreSQL + ChromaDB)Improvement
Bulk Insert (10k symbols)60+ seconds (throttled)<1 second60x faster
Exact Search200ms<10ms20x faster
Code Symbol IndexingConnection errors1700+ symbols/secondReliable
Complex QueriesLimitedFull SQL supportNew capability

Project Structure

mcp-chromadb-memory/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # MCP server entry point
β”‚   β”œβ”€β”€ config.ts             # Configuration management
β”‚   β”œβ”€β”€ memory-manager.ts     # Legacy ChromaDB manager
β”‚   β”œβ”€β”€ memory-manager-enhanced.ts # Enhanced with tier support
β”‚   β”œβ”€β”€ hybrid-memory-manager.ts # NEW: PostgreSQL + ChromaDB hybrid
β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”œβ”€β”€ postgres-client.ts # PostgreSQL connection management
β”‚   β”‚   β”œβ”€β”€ memory-repository.ts # Memory data access layer
β”‚   β”‚   └── symbol-repository.ts # Code symbol operations
β”‚   β”œβ”€β”€ obsidian-manager.ts   # Obsidian vault integration
β”‚   β”œβ”€β”€ session-logger.ts     # Session capture and logging
β”‚   β”œβ”€β”€ template-manager.ts   # Template system with webhook support
β”‚   β”œβ”€β”€ vault-manager.ts      # Vault management wrapper
β”‚   └── services/
β”‚       β”œβ”€β”€ code-indexer.ts   # Symbol extraction & bulk indexing
β”‚       β”œβ”€β”€ code-pattern-detector.ts # Pattern recognition
β”‚       β”œβ”€β”€ streaming-manager.ts # Streaming response handler
β”‚       β”œβ”€β”€ migration-service.ts # Tier migration service
β”‚       └── hybrid-search-service.ts # NEW: Unified search layer
β”œβ”€β”€ vault/
β”‚   β”œβ”€β”€ vault/               # Project-specific Obsidian vault
β”‚   β”‚   └── Templates/       # Documentation templates
β”‚   └── *.md                 # Platform documentation
β”œβ”€β”€ init.sql                 # PostgreSQL schema initialization
β”œβ”€β”€ dist/                    # Compiled JavaScript
β”œβ”€β”€ docker-compose.yml       # Container orchestration
└── Dockerfile              # Container definition

Platform Architecture (v2.0)

The platform uses a hybrid storage approach where PostgreSQL handles structured data and metadata for high-performance queries, while ChromaDB manages vector embeddings for semantic search capabilities.

graph TD
    subgraph "Application Layer"
        A1[Claude Desktop]
        A2[CLI Tools]
        A3[Web Dashboard]
    end
    
    subgraph "Integration Layer"
        B1[MCP Protocol]
        B2[REST API]
        B3[WebSocket Events]
    end
    
    subgraph "Intelligence Layer"
        C1[Pattern Recognition]
        C2[Session Processor]
        C3[State Manager]
        C4[Vault Manager]
        C5[Code Intelligence]
    end
    
    subgraph "Memory Layer"
        D1[Working Memory]
        D2[Session Memory]
        D3[Long-term Memory]
    end
    
    subgraph "Storage Layer"
        E1[PostgreSQL + pgvector]
        E2[ChromaDB]
        E3[Obsidian Vault]
        E4[Git Repository]
    end
    
    A1 --> B1
    A2 --> B2
    A3 --> B3
    B1 --> C1
    B2 --> C2
    B3 --> C3
    C1 --> D1
    C2 --> D2
    C3 --> D3
    D1 --> E1
    D1 --> E2
    D2 --> E1
    D2 --> E2
    D3 --> E1
    D3 --> E2
    C2 --> E3
    C4 --> E3
    C3 --> E4

See for transformation details.

Memory Scoring Algorithm

The retrieval system uses a sophisticated multi-factor scoring approach:

  • Semantic Similarity (40%): Cosine similarity between query and memory embeddings
  • Recency Score (30%): Exponential decay based on time since last access
  • Importance Score (20%): AI-assessed importance during storage
  • Frequency Score (10%): Logarithmic scaling of access count

πŸ› οΈ Development

Dual-Instance Development

For safe testing of new features, use the isolated development environment:

# Start development environment
./scripts/env-manager.sh start-dev

# Check status
./scripts/env-manager.sh status

# Run in development mode
./scripts/test-hierarchical.sh

This creates a completely separate ChromaDB instance on port 8001 with its own data and configuration.

Available Scripts

npm run build         # Compile TypeScript
npm run dev          # Run with hot reload
npm run test         # Run test suite
npm run inspect      # Test with MCP Inspector
npm run docker:build # Build Docker image
npm run docker:run   # Run in Docker

Testing with MCP Inspector

npm run inspect

Then in the inspector:

  1. Call health_check to verify connection
  2. Use store_memory to save test memories
  3. Use recall_memories to test retrieval

πŸ”§ Troubleshooting

Quick Diagnostics

Run the configuration validator to check for common issues:

./scripts/validate-config.sh

MCP Server Not Loading

Claude Desktop Issues
  1. Verify configuration file location:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Common configuration errors:

    • JSON syntax errors (use python -m json.tool < config.json to validate)
    • Wrong container names (should be coachntt-chromadb and coachntt-postgres)
    • Hardcoded API keys (security risk but required for Claude Desktop)
    • Windows path issues (use forward slashes: C:/Users/...)
  3. Quick setup script:

    ./scripts/setup-claude-desktop.sh
    
Claude Code CLI Issues
  1. Environment variables not set:

    export OPENAI_API_KEY="your-api-key-here"
    # Add to ~/.bashrc for persistence
    
  2. Configuration issues:

    • .mcp.json must be in project root
    • Check for empty environment variables in config
    • Ensure .env.PRODUCTION has correct settings
  3. Test the server directly:

    OPENAI_API_KEY="your-key" node dist/index.js
    

Database Connection Errors

  1. Check service names match:

    # docker-compose.yml should have:
    coachntt-postgres:
      container_name: coachntt-postgres
    coachntt-chromadb:
      container_name: coachntt-chromadb
    
  2. Verify credentials match:

    • PostgreSQL: coachntt_user / coachntt_pass / coachntt_cognitive_db
    • These must be consistent across all config files
  3. Check if services are healthy:

    docker ps
    # Look for (healthy) or (unhealthy) status
    

Path and Environment Issues

  1. Vault path not found:

    • Check .env.PRODUCTION has OBSIDIAN_VAULT_PATH=./vault
    • Ensure vault directory exists
    • For dual vault: ensure both paths exist and are accessible
  2. Environment file loading:

    • System loads .env.PRODUCTION by default
    • Settings in .env are ignored unless ENVIRONMENT_NAME is set
    • Missing settings don't fall back to other files

Common Issues and Solutions

IssueCauseSolution
"Container exits immediately"Normal MCP behaviorMCP servers run on-demand
"Cannot connect to ChromaDB"Container unhealthydocker-compose restart chromadb
"Missing OpenAI API key"Not in environmentSet OPENAI_API_KEY env var
"Vault not found at ./vault"Path misconfigurationEnsure vault directory exists and is accessible
"Bad escaped character in JSON"Windows path issueUse forward slashes in paths
"postgres role does not exist"Wrong credentialsCheck docker-compose.yml matches config

Configuration Reference

See the comprehensive for:

  • Detailed Claude Desktop vs Claude Code CLI differences
  • Platform-specific setup instructions
  • Environment variable reference
  • Security best practices

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸš€ Platform v2.0 Development

We're actively developing the next major version that transforms this into a Cognitive State Management Platform. To contribute:

# Platform development branch
git checkout feature/platform-transformation
git pull origin feature/platform-transformation

Contributing Process

  1. Fork the repository
  2. Switch to platform branch (git checkout feature/platform-transformation)
  3. Create your feature branch (git checkout -b feature/AmazingFeature)
  4. Commit your changes (git commit -m 'Add some AmazingFeature')
  5. Push to the branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the file for details.

πŸ™ Acknowledgments

πŸ“ž Support

πŸ“š Additional Documentation

The project uses a dual documentation structure:

Technical Documentation (docs/):

  • API references
  • Getting started guides
  • Architecture notes
  • Roadmap and status

Knowledge Base (vault/):

  • Obsidian vault for AI context
  • Session logs and development history
  • Architecture decisions
  • Knowledge and setup guides
  • Templates and planning documents

Key locations:

  • Setup Guides: vault/Knowledge/Setup/
  • Architecture: vault/Architecture/
  • Session Logs: vault/Sessions/
  • Templates: vault/Templates/

Made with ❀️ for the MCP ecosystem