MCP-1A: Extract a shared runtime factory and remove global config mutation
Summary
Extract a shared runtime/container module used by both FastAPI and MCP, and remove the current thread-unsafe pattern that mutates config.CHROMA_DB_PATH during runtime construction.
Problem
The runtime composition is currently trapped inside MemoryAPIService in api/app.py, which makes it hard to reuse from MCP. It also mutates module-level config state during initialization, which is unsafe under concurrent runtime creation.
Scope
- extract a shared runtime/container module
- make FastAPI consume that runtime instead of owning the wiring
- inject
chroma_path directly into store/client construction
- inject embedding dimensions through runtime construction
- move
EventRecorder into the shared runtime if it remains common
Acceptance Criteria
- FastAPI and MCP use the same runtime factory
- runtime construction never mutates module-level config to swap Chroma paths
- concurrent runtime creation cannot observe another runtime's database path
- embedding dimensions can be supplied at runtime, enabling future 768→1536 parallel migration into a fresh Chroma path
Dependencies
MCP-1A: Extract a shared runtime factory and remove global config mutation
Summary
Extract a shared runtime/container module used by both FastAPI and MCP, and remove the current thread-unsafe pattern that mutates
config.CHROMA_DB_PATHduring runtime construction.Problem
The runtime composition is currently trapped inside
MemoryAPIServiceinapi/app.py, which makes it hard to reuse from MCP. It also mutates module-level config state during initialization, which is unsafe under concurrent runtime creation.Scope
chroma_pathdirectly into store/client constructionEventRecorderinto the shared runtime if it remains commonAcceptance Criteria
Dependencies