Context
This is a Tier-1 sub-ticket of epic #10982 (M6: Migrate per-server MCP services to flatter SDK structure), targeting the knowledge-base server.
The Problem
ai/services.mjs currently imports KB_* services directly from ai/mcp/server/knowledge-base/services/*. This couples the SDK to the MCP server hosting layout. Per the v13 M6 exit criteria, services must flatten into the SDK boundary and the Server.mjs must shrink to a thin endpoint wrapper (<50 LOC).
The Architectural Reality
- Source:
ai/mcp/server/knowledge-base/services/
- Contents: ~10 services +
ChromaManager + toolService
- Target: A flatter SDK-owned location (to be determined during implementation), exported via
ai/services.mjs while keeping the KB_ prefix.
- Constraint: The Factory pattern (
RequestContextService) uniform application must be preserved.
The Fix
- Relocate
knowledge-base services out of the MCP server directory to the new SDK structure.
- Update
ai/services.mjs to export these from their new location, strictly preserving KB_ namespace prefixes to avoid breaking consumers.
- Update
ai/mcp/server/knowledge-base/Server.mjs to import services from the SDK instead of local files, reducing its LOC footprint to <50.
- Verify the
RequestContextService dispatch remains unchanged.
Acceptance Criteria
Out of Scope
- Service-internal refactors or logic changes.
- Adding new tools or changing tool semantics.
Related
- Parent epic: #10982
- Strategic anchor:
learn/agentos/v13-path.md §4 M6
Retrieval Hint: query_raw_memories(query="M6 SDK migration knowledge-base services Server.mjs thin wrapper")
Context
This is a Tier-1 sub-ticket of epic #10982 (M6: Migrate per-server MCP services to flatter SDK structure), targeting the
knowledge-baseserver.The Problem
ai/services.mjscurrently importsKB_*services directly fromai/mcp/server/knowledge-base/services/*. This couples the SDK to the MCP server hosting layout. Per the v13 M6 exit criteria, services must flatten into the SDK boundary and theServer.mjsmust shrink to a thin endpoint wrapper (<50 LOC).The Architectural Reality
ai/mcp/server/knowledge-base/services/ChromaManager+toolServiceai/services.mjswhile keeping theKB_prefix.RequestContextService) uniform application must be preserved.The Fix
knowledge-baseservices out of the MCP server directory to the new SDK structure.ai/services.mjsto export these from their new location, strictly preservingKB_namespace prefixes to avoid breaking consumers.ai/mcp/server/knowledge-base/Server.mjsto import services from the SDK instead of local files, reducing its LOC footprint to <50.RequestContextServicedispatch remains unchanged.Acceptance Criteria
knowledge-baseservices are relocated to an SDK-owned location.ai/services.mjsupdated to import from the new locations while preservingKB_namespace prefixes.ai/mcp/server/knowledge-base/Server.mjsis updated to consume from the SDK and is reduced to <50 LOC.RequestContextService) is uniformly preserved across server tools.KB_*services (tests, daemon scripts) continue to function without signature changes.Out of Scope
Related
learn/agentos/v13-path.md§4 M6Retrieval Hint:
query_raw_memories(query="M6 SDK migration knowledge-base services Server.mjs thin wrapper")