Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enterprise Code Intelligence Microservice

An enterprise-grade, multi-tenant, RBAC-protected Code Intelligence and Graph Memory microservice built on top of TypeScript and the Model Context Protocol (MCP).

Key Features

  • 🌳 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 imports and defines graph edges.
  • 🚀 Async Non-Blocking Indexing: Asynchronous batching with setImmediate event 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_id and repo_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.

Directory & Architecture Overview

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

Getting Started

1. Install Dependencies

npm install

2. Build TypeScript Code

npm run build

3. Start Microservice

# HTTP Microservice mode
npm start

# Stdio mode (for MCP Clients)
node dist/index.js --stdio

MCP Tools Reference

Every 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.

⚡ Token Minimization & Performance

  • 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-Based Access Control (RBAC) Matrix

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

About

Multi-tenant, RBAC-protected Enterprise Code Intelligence microservice with TypeScript Compiler API AST parsing & WebAssembly SQLite Graph Memory.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages