An enterprise-grade, multi-tenant, RBAC-protected Code Intelligence and Graph Memory microservice built on top of TypeScript and the Model Context Protocol (MCP).
- 🌳 Production AST Parsing: Uses the TypeScript Compiler API (
ts.createSourceFile) to extract real AST nodes (classes, interfaces, methods, functions) while 100% ignoring comments and string literals. - 🔗 Cross-File Import & Call Graph: Resolves relative module specifiers and cross-file dependencies into explicit
importsanddefinesgraph edges. - 🚀 Async Non-Blocking Indexing: Asynchronous batching with
setImmediateevent loop yielding, enabling smooth background indexing on enterprise repos (10,000+ files) without freezing Node.js. - 🏢 Multi-Tenancy: Isolated graph databases and memory tables scoped strictly by
tenant_idandrepo_id. - 🔐 RBAC & Governance: Fine-grained access control (
graph:read,graph:write,graph:admin,repo:index) enforced on every MCP query via JWT token claims. - 🔒 Secrets Scrubbing: Automated redacting of API keys, GitHub tokens, and bearer tokens during indexing.
- 📑 Audit Trail Logging: Structured SOC 2 compliant logging (
winston) for compliance tracing of code graph accesses. - 🤖 MCP Transports: Supports both HTTP/SSE and Stdio transports for IDE, Claude, and AI agent integration.
enterprise-code-intelligence/
├── src/
│ ├── audit/
│ │ └── logger.ts # Structured audit logger for compliance
│ ├── auth/
│ │ └── rbac.ts # RBAC engine, JWT token verification & permissions
│ ├── config/
│ │ └── index.ts # App configuration & environment settings
│ ├── db/
│ │ └── graphStorage.ts # Multi-tenant graph database layer (SQLite WAL)
│ ├── indexing/
│ │ └── indexer.ts # Async repository parser with secret scrubbing
│ ├── mcp/
│ │ └── server.ts # Enterprise MCP server definition & tools
│ └── index.ts # Server entrypoint (HTTP & Stdio)
├── package.json
├── tsconfig.json
└── README.md
npm installnpm run build# HTTP Microservice mode
npm start
# Stdio mode (for MCP Clients)
node dist/index.js --stdioEvery tool requires a valid JWT authToken argument and supports an optional format parameter (compact | json).
| Tool Name | Required Permission | Description |
|---|---|---|
enterprise_query_symbols |
graph:read |
Searches symbol names (classes, functions, files) with token-minimized output (format: compact). |
enterprise_get_neighbors |
graph:read |
Returns connected nodes and edges for a specific graph symbol. |
enterprise_tenant_overview |
graph:read |
Retrieves graph metrics (total symbols, relations by type) for a tenant. |
enterprise_index_repository |
repo:index |
Triggers background parsing & indexing of a codebase path. |
- Default Compact Mode (
format: "compact"): All queries default to compact SCIP-style single-line text output (e.g.[class] OrderController @ src/api.ts (typescript)), saving 70–80% of prompt tokens per tool call compared to verbose JSON formatting. - JSON Mode (
format: "json"): Unindented compact JSON formatting when structured programmatic parsing is required.
| Role | Permissions |
|---|---|
| admin | graph:read, graph:write, graph:admin, audit:read, repo:index |
| developer | graph:read, graph:write, repo:index |
| auditor | graph:read, audit:read |
| readonly | graph:read |