Frontmatter
| id | 7869 |
| title | Refactor Memory Core MCP Server to use Neo.core.Base class architecture |
| state | Closed |
| labels | enhancementai |
| assignees | tobiu |
| createdAt | Nov 23, 2025, 10:32 AM |
| updatedAt | Nov 23, 2025, 11:14 AM |
| githubUrl | https://github.com/neomjs/neo/issues/7869 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Nov 23, 2025, 11:14 AM |
Refactor Memory Core MCP Server to use Neo.core.Base class architecture
tobiu assigned to @tobiu on Nov 23, 2025, 10:40 AM

tobiu
Nov 23, 2025, 11:14 AM
Input from Gemini:
✦ The implementation was adjusted during development to better align with the Neo.mjs architecture and Node.js best practices.
Final Implementation Details:
- No Singleton: The
Serverclass is a standardNeo.core.Basesubclass, not a singleton. The single instance is created manually by the runner script.- Runner Pattern:
mcp-stdio.mjsacts as a lightweight runner. It handles CLI parsing, global config setup (aiConfig.debug), and instantiates theServer.- Modern Error Handling: Instead of chained
.catch()blocks, we utilized top-levelawait(Node.js v22+ / ESM) wrapped in a singletry/catchblock to handle both synchronous construction errors and asynchronous initialization failures gracefully.- Simplified Configs:
debugandconfigFilewere removed fromstatic configand treated as class fields or handled directly by the runner to reduce overhead and redundancy.aiConfigis updated directly by the runner before the server starts.- Import Order: Strictly enforced import order in
mcp-stdio.mjs(Neo->core->InstanceManager->Server) to ensure the framework namespace is fully populated before the server class is evaluated.
tobiu closed this issue on Nov 23, 2025, 11:14 AM
Objective: Refactor the Memory Core MCP server entry point to use a dedicated
Neo.core.Baseclass for the server logic, replacing the procedural script approach. This unifies the architecture and leverages Neo.mjs lifecycle management (construct,initAsync,ready).Changes:
Create
ai/mcp/server/memory-core/Server.mjs:class Server extends Neo.core.Base.debug(Boolean) andconfigFile(String).construct(config):super.construct(config).aiConfig.data.debugifthis.debugis true.initAsync():super.initAsync().aiConfig.load()ifthis.configFileis set.McpServerinstance.listToolsandcallToolfromservices/toolService.mjs.SessionService.ready().HealthService.healthcheck()and log status.StdioServerTransport.setupRequestHandlersandlogStartupStatusfor cleaner code.Refactor
ai/mcp/server/memory-core/mcp-stdio.mjs:commanderto parse CLI arguments (-d,-c).const server = Neo.create(Server, { ...options });server.ready().catch(error => { logger.error('Fatal startup error:', error); process.exit(1); });Technical Details:
debugflag from CLI is respected immediately in the server constructor.server.ready()to bridge the gap between synchronous instantiation and asynchronous initialization errors.