The Content Intelligence (CI) server architecture is designed to provide high-performance project insights while maintaining strict organizational data isolation. By leveraging a modular architecture
The Content Intelligence (CI) server architecture is designed to provide high-performance project insights while maintaining strict organizational data isolation. By leveraging a modular architecture built on Hono and TypeScript, the server separates its public-facing communication surfaces from its core domain logic.
src/app.ts)src/app.ts serves as the composition root for the entire service. It is responsible for orchestrating the server's lifecycle and dependency injection. By centralizing the creation of the Hono application, it ensures that all endpoints—whether intended for LLM agents or standard web clients—are consistently configured with:
/api/v1/ci/*), health checks (/health/*), and the Streamable HTTP MCP endpoint (/mcp).The server maintains a clear separation of concerns between its two public interfaces, allowing it to satisfy both agentic and programmatic use cases:
/mcp): This layer acts as a protocol-compliant tool provider. It translates human-friendly prompts and resource requests into structured tool calls. This allows large language models and autonomous agents to "triage" project loops, list findings, and pull health confidence signals using the official MCP standard./api/v1/ci/*): This is the authoritative interface for programmatic access. It follows a RESTful pattern, providing granular data access—such as GET /overview or POST /quality/:itemId—without the overhead of the MCP protocol. This API is used by dashboards, CI pipelines, and reporting tools to consume the server's processed intelligence.At the core of the system lies the Nexus Gateway (src/nexus/nexus-gateway.ts). This component bridges the gap between raw, structured data in the Nexus Postgres item-store and the semantic, agentic intelligence layer.
TicketInput or WorkUnit domain object that is easily consumable by LLMs.OrganizationScopeEnforcer. This middleware dynamically validates database queries, ensuring that every SQL operation is scoped to the requesting organization and preventing cross-tenant data leakage.The architecture follows a strict downward dependency flow:
src/app.ts): Handles HTTP and MCP request/response cycles.src/mcp/, src/router/): Translates transport-specific inputs into requests for the Gateway.src/nexus/, src/content-intelligence/): Executes logic to retrieve data from Nexus or the intelligent LLM backend.src/llm/, src/findings/): The "brain" of the server, where LLMs generate assessments and the findings engine monitors thresholds for alerts.src/bootstrap/): Manages the instantiation of the database client and LLM adapter, ensuring the server can switch between "Embedded" (local Postgres) and "Remote" (API-gateway) modes seamlessly based on environment configuration.This design enables developers to swap the underlying persistence or inference backends with minimal impact to the public API surface, ensuring that the system can evolve alongside the team's data maturity.