Frontmatter
| id | 9563 |
| title | Modularize MCP Server Architecture and Extract Shared Services |
| state | Closed |
| labels | enhancementairefactoringarchitecture |
| assignees | tobiu |
| createdAt | Mar 26, 2026, 4:04 PM |
| updatedAt | Mar 26, 2026, 4:11 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9563 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 26, 2026, 4:11 PM |
Modularize MCP Server Architecture and Extract Shared Services
tobiu assigned to @tobiu on Mar 26, 2026, 4:11 PM
tobiu closed this issue on Mar 26, 2026, 4:11 PM

tobiu
Mar 26, 2026, 4:11 PM
Refactored Server.mjs by extracting OIDC/OAuth and SSE transport logic into shared AuthService and TransportService. Improved maintainability and reduced root file bloat. Verified with functional tests.
Goal
Refactor the MCP server root files (
Server.mjs) to reduce bloat by extracting optional and complex logic into dedicated services.Context
With the recent addition of OIDC/OAuth 2.1 discovery, token verification, and CORS support, the
Server.mjsfiles for Knowledge Base and Memory Core have become less readable. Since this logic is identical across servers, it should be extracted into shared services.Proposed Changes
ai/mcp/server/shared/services/AuthService.mjsto handle OIDC discovery, token verification, and Protected Resource Metadata.ai/mcp/server/shared/services/TransportService.mjsto manage Express apps, CORS, SSE transport handshakes, and session management.Server.mjsto use dynamic imports for these services, keeping the root file lean and ensuring dependencies are only loaded when needed.This refactoring will improve maintainability and simplify the implementation of future features like the Neural Link authorization.