LearnNewsExamplesServices
Frontmatter
id7536
titleEpic: Integrate Neo.mjs Core into MCP Servers
stateClosed
labels
epicai
assigneestobiu
createdAtOct 18, 2025, 12:08 PM
updatedAtOct 20, 2025, 1:25 AM
githubUrlhttps://github.com/neomjs/neo/issues/7536
authortobiu
commentsCount1
parentIssuenull
subIssues
7537 PoC: Refactor ChromaManager to a Neo.mjs Class
7538 Convert DatabaseLifecycleService to a Neo.mjs Class
7539 Improve isDbRunning() in DatabaseLifecycleService
7540 Convert dbService to DatabaseService Neo.mjs Class
7542 Convert healthService to HealthService Neo.mjs Class
7543 Convert memoryService to MemoryService Neo.mjs Class
7544 Convert sessionService to SessionService Neo.mjs Class
7545 Convert summaryService to SummaryService Neo.mjs Class
7546 Convert textEmbeddingService to TextEmbeddingService Neo.mjs Class
7547 Enhance DatabaseLifecycleService with Eventing
7549 Create ChromaManager and Adjust KB Server Entry Point
7550 Convert databaseLifecycleService to DatabaseLifecycleService Neo.mjs Class
7551 Convert databaseService to DatabaseService Neo.mjs Class
7552 Convert documentService to DocumentService Neo.mjs Class
7553 Refactor HealthService to Match Superior Memory Core Pattern
7554 Convert queryService to QueryService Neo.mjs Class
7555 Centralize ChromaDB Client Warning Suppression in ChromaManager
7556 Convert GitHub Workflow healthService to HealthService Neo.mjs Class
7557 Convert issueService to IssueService Neo.mjs Class
7558 Convert labelService to LabelService Neo.mjs Class
7559 Convert pullRequestService to PullRequestService Neo.mjs Class
7560 Centralize GitHub Workflow Configuration
7561 Refactor AI Config for Server-Specific Namespacing
7562 Refactor MCP Service ClassNames to Use Full Server Names
7563 Standardize ChromaDB Collection Naming Convention
subIssuesCompleted25
subIssuesTotal25
blockedBy[]
blocking[]
closedAtOct 20, 2025, 1:25 AM

Epic: Integrate Neo.mjs Core into MCP Servers

Closed v11.0.0 epicai
tobiu
tobiu commented on Oct 18, 2025, 12:08 PM

Overview

The current MCP (Model Context Protocol) servers are built with plain JavaScript modules, exporting functions that act as service handlers. While functional, this approach misses an opportunity to leverage the power and structure of the Neo.mjs core itself.

This epic outlines the plan to refactor the MCP server architecture to use the Neo.mjs class system (Neo.core.Base). By converting our services into singleton classes, we can take advantage of the framework's config system, lifecycle methods, mixins, and overall consistency. This will not only improve the maintainability and scalability of our servers but also serve as a powerful demonstration of Neo's capabilities on the backend.

Key Requirements

  • Refactor all MCP server services (e.g., healthService, databaseLifecycleService, chromaManager) into singleton classes extending Neo.core.Base.
  • Utilize the Neo config system for service configurations.
  • Update the toolService.mjs to seamlessly integrate with class-based services.
  • Ensure the new architecture is robust, maintainable, and well-documented.

Design Rationale & Strategy

  • Architectural Approach: The core strategy is to adopt a class-based architecture for all services. This provides a consistent and scalable foundation. Instead of exporting individual functions, each service will be a self-contained, instantiable class.
  • Proof of Concept (PoC): We will start with a PoC to validate the approach before a full-scale refactoring. The ChromaManager is selected as the ideal candidate for the PoC because it has state (e.g., client, connected), a clear lifecycle (connect/disconnect), and could benefit from reactive configs.
  • Incremental Migration: After a successful PoC, the remaining services will be migrated incrementally. The toolService.mjs will be enhanced to support both the old function-based and the new class-based services during the transition period, if necessary.

Phase 1: Proof of Concept with ChromaManager

Status: To Do

The goal of this phase is to refactor ai/mcp/server/memory-core/services/chromaManager.mjs to use the Neo class system and prove the viability of this architecture.

  1. Refactor ChromaManager:

    • Convert chromaManager.mjs from an object literal exporting functions into a ChromaManager class extending Neo.core.Base.
    • Configure it as a singleton.
    • Move state variables (like client) into the config system (e.g., client_).
    • Convert functions (getMemoryCollection, getSummaryCollection) into class methods.
    • Use lifecycle hooks like onConstructed for initialization logic (e.g., creating the ChromaDB client).
  2. Integration:

    • Initialize the Neo core in the memory-core server's entry point (mcp-stdio.mjs).
    • Update the service handlers that depend on chromaManager to get the singleton instance and call its methods.
  3. Evaluation:

    • Assess the refactored ChromaManager. Does the class-based approach feel natural and beneficial? Or does it feel like unnecessary overhead?
    • If the PoC is successful, it provides a strong signal to proceed with the full migration.

Phase 2: Migrate All Services

Status: To Do

This phase involves refactoring all remaining services in all three MCP servers (knowledge-base, memory-core, github-workflow).

  1. Refactor Services:

    • Convert all service modules to Neo singleton classes.
    • Apply the patterns established in the ChromaManager PoC.
  2. Documentation:

    • Update the project's documentation to reflect the new class-based architecture for MCP servers.
tobiu assigned to @tobiu on Oct 18, 2025, 12:08 PM
tobiu added the epic label on Oct 18, 2025, 12:08 PM
tobiu added the ai label on Oct 18, 2025, 12:08 PM
tobiu added sub-issue #7537 on Oct 18, 2025, 12:14 PM
tobiu referenced in commit 6028d86 - "#7536 ticket as md files" on Oct 18, 2025, 12:14 PM
tobiu referenced in commit c9da77e - "#7536 epic md file update" on Oct 18, 2025, 1:23 PM
tobiu added sub-issue #7538 on Oct 18, 2025, 1:28 PM
tobiu added sub-issue #7539 on Oct 18, 2025, 1:51 PM
tobiu added sub-issue #7540 on Oct 18, 2025, 2:03 PM
tobiu added sub-issue #7542 on Oct 18, 2025, 2:49 PM
tobiu added sub-issue #7543 on Oct 18, 2025, 3:06 PM
tobiu added sub-issue #7544 on Oct 18, 2025, 3:23 PM
tobiu referenced in commit 32f858d - "#7536 healthService.mjs => HealthService.mjs" on Oct 18, 2025, 3:39 PM
tobiu added sub-issue #7545 on Oct 18, 2025, 3:44 PM
tobiu added sub-issue #7546 on Oct 18, 2025, 3:53 PM
tobiu referenced in commit 3c28197 - "#7536 replacing onConstructed() with construct() in services where needed" on Oct 18, 2025, 4:02 PM
tobiu added sub-issue #7547 on Oct 18, 2025, 4:42 PM
tobiu added sub-issue #7549 on Oct 19, 2025, 11:07 PM
tobiu added sub-issue #7550 on Oct 19, 2025, 11:17 PM
tobiu added sub-issue #7551 on Oct 19, 2025, 11:19 PM
tobiu added sub-issue #7552 on Oct 19, 2025, 11:48 PM
tobiu added sub-issue #7553 on Oct 19, 2025, 11:54 PM
tobiu added sub-issue #7554 on Oct 20, 2025, 12:08 AM
tobiu added sub-issue #7555 on Oct 20, 2025, 12:17 AM
tobiu referenced in commit 33ee24b - "#7536 knowledge base => toolService.mjs formatting" on Oct 20, 2025, 12:19 AM
tobiu added sub-issue #7556 on Oct 20, 2025, 12:23 AM
tobiu added sub-issue #7557 on Oct 20, 2025, 12:35 AM
tobiu added sub-issue #7558 on Oct 20, 2025, 12:43 AM
tobiu added sub-issue #7559 on Oct 20, 2025, 12:57 AM
tobiu referenced in commit 2df1067 - "#7536 github-workflow/mcp-stdio.mjs: neo imports" on Oct 20, 2025, 12:59 AM
tobiu referenced in commit c2311f9 - "#7536 github-workflow/services/toolService.mjs: formatting" on Oct 20, 2025, 1:00 AM
tobiu added sub-issue #7560 on Oct 20, 2025, 1:04 AM
tobiu added sub-issue #7561 on Oct 20, 2025, 1:09 AM
tobiu added sub-issue #7562 on Oct 20, 2025, 1:18 AM
tobiu added sub-issue #7563 on Oct 20, 2025, 1:24 AM
tobiu
tobiu Oct 20, 2025, 1:25 AM

resolved.

tobiu closed this issue on Oct 20, 2025, 1:25 AM