How latentforce-ai/latentgraph-mcp-server works
Latentgraph is a code-intelligence CLI and MCP server: users initialize or update a project index, then AI coding tools can obtain dependency, implicit-coupling, and change-impact context. The map includes the documented DRG, Wiki, implicit-dependency, file-enrichment, and analysis capabilities, plus daemon-driven tool execution and editor integrations. Several subsystems are represented by their exact enclosing directories because their implementation was not sampled; edges are limited to documented or excerpt-supported wiring.
Main entry points: mcp-server.ts MCP server · commands CLI commands · context.ts Context retrieval · index.ts CLI dispatcher
Components 23
CLI workflows
- CLI dispatcher
src/index.ts - CLI commands
src/cli/commands - Context retrieval
src/cli/commands/context.ts
Indexing and insights
- Project scanning
src/utils/tree-scanner.ts - Git change detection
src/utils/git-changes.ts - Index and analysis workflows
src/cli/commands
Daemon and MCP
- Daemon lifecycle
src/daemon/daemon-manager.ts - Background daemon
src/daemon/daemon.ts - WebSocket client
src/daemon/websocket-client.ts - MCP tool execution
src/daemon/tools-executor.ts - MCP server
src/mcp-server.ts
Coding-tool integrations
- Claude integration
src/integration/claude - Copilot integration
src/integration/copilot - Cursor integration
src/integration/cursor - Kiro integration
src/integration/kiro - Codex integration
src/integration/codex - latent-code integration
src/integration/latent-code - OpenCode integration
src/integration/opencode
Shared utilities
- Backend API client
src/utils/api-client.ts - Context formatting
src/utils/context-formatter.ts
Other components
- Project user
- Latentgraph backend
- AI coding assistant
Connections 22
- Project user → CLI dispatcher: runs commands
- CLI dispatcher → CLI commands: dispatches
- CLI commands → Index and analysis workflows: invokes workflows
- Index and analysis workflows → Project scanning: scans project
- Index and analysis workflows → Git change detection: detects changes
- Index and analysis workflows → Backend API client: sends analysis
- Backend API client → Latentgraph backend: sends requests
- CLI commands → Context retrieval: invokes context
- Context retrieval → Latentgraph backend: requests file insights
- Context retrieval → Context formatting: formats responses
- CLI commands → Daemon lifecycle: starts or stops
- Daemon lifecycle → Background daemon: launches process
- Background daemon → WebSocket client: maintains connection
- WebSocket client → MCP tool execution: dispatches tool requests
- AI coding assistant → MCP server: requests tools
- Claude integration → MCP server: configures access
- Copilot integration → MCP server: configures access
- Cursor integration → MCP server: configures access
- Kiro integration → MCP server: configures access
- Codex integration → MCP server: configures access
- latent-code integration → MCP server: configures access
- OpenCode integration → MCP server: configures access