-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Issue Summary
During Phase 2 implementation of direct ChromaDB access (Issue #11), we discovered a fundamental limitation with the JavaScript/Node.js ChromaDB client that prevents embedded local storage.
Problem Description
Expected Behavior
- Direct ChromaDB access for local persistent storage (similar to Python
PersistentClient
) - Eliminate MCP service duplication by accessing ChromaDB files directly
- Improved performance through embedded database access
Actual Behavior
- JavaScript ChromaDB client only supports HTTP connections to ChromaDB server
- No embedded/persistent local storage option available in JS/Node.js version
- Requires running external ChromaDB server (Docker)
Error Encountered
Could not connect to tenant default_tenant. Are you sure it exists?
Underlying error: TypeError: Failed to parse URL from /Users/.../chroma_db/api/v2/tenants/default_tenant
Root Cause Analysis
JavaScript vs Python ChromaDB Clients
Feature | Python ChromaDB | JavaScript ChromaDB |
---|---|---|
Embedded Storage | ✅ PersistentClient(path="./db") |
❌ Not available |
HTTP Client | ✅ ChromaClient(host="localhost") |
✅ ChromaClient({ path: "http://..." }) |
Local File Access | ✅ Direct SQLite/DuckDB | ❌ Must use server |
Available Exports Comparison
Python:
import chromadb
client = chromadb.PersistentClient(path="./chroma_db") # Works!
JavaScript:
const { ChromaClient } = require('chromadb');
// No PersistentClient available in JS exports
// Only: ChromaClient, AdminClient, CloudClient, etc.
Current Workaround
Architecture Decision
- Phase 1: ✅ Configuration redundancy eliminated
- Phase 2:
⚠️ Direct access blocked by client limitation - Fallback: Stable MCP service approach maintained
Implementation Status
// Graceful fallback implemented
if (useDirectAccess) {
try {
// Attempt direct access
} catch (error) {
// Fall back to MCP service approach
}
}
Impact Assessment
Current State
- ✅ No breaking changes: MCP approach continues to work
- ✅ Configuration improved: Single source of truth maintained
⚠️ Performance gains: Deferred until embedded client available⚠️ Service duplication: Still present due to client limitation
User Experience
- Stable: Default behavior unchanged (MCP service)
- Transparent: Automatic fallback when direct access enabled
- Documented: Clear error messages explain the limitation
Potential Solutions
Option 1: Wait for Embedded JS Client (Recommended)
- Pros: Clean solution, no additional complexity
- Cons: Timeline uncertain
- Status: Monitor ChromaDB roadmap for embedded JS support
Option 2: Local ChromaDB Server
- Pros: Uses existing JS client
- Cons: Deployment complexity, Docker dependency
- Implementation:
docker run -p 8000:8000 chromadb/chroma
Option 3: Custom Native Binding
- Pros: True embedded access
- Cons: High complexity, maintenance burden
- Implementation: Node.js native addon to ChromaDB C++ core
Option 4: Alternative Vector Database
- Pros: Embedded options available (e.g., SQLite-VSS, LanceDB)
- Cons: Migration effort, different API
- Consideration: Future architectural decision
Recommendation
Immediate Actions
- Keep current MCP approach as stable default
- Document limitation for users attempting direct access
- Monitor ChromaDB releases for embedded JS client support
- Maintain direct access infrastructure for future implementation
Long-term Strategy
- Phase 3: Implement Option 2 (local server) if performance critical
- Phase 4: Migrate to embedded client when available
- Alternative: Evaluate other embedded vector databases
Documentation Updates
User Guidance
# Stable operation (recommended)
VITE_USE_DIRECT_CHROMA_ACCESS=false
# Experimental direct access (will fall back automatically)
VITE_USE_DIRECT_CHROMA_ACCESS=true
Architecture Notes
- Direct access infrastructure complete and ready
- Graceful fallback ensures system stability
- Configuration improvements independent of client limitations
Labels
architecture
limitation
chromadb
enhancement
external-dependency
Status: Architecture ready, awaiting embedded ChromaDB client for JavaScript
Priority: Medium (performance optimization, not blocking functionality)
Affected: Issue #11 Phase 2 completion
Metadata
Metadata
Assignees
Labels
No labels