Code intelligence MCP server for local repositories. It builds a local SQLite-backed AST index, watches supported source files, and exposes MCP tools for outlines, symbol reads, search, references, git context, and lightweight project annotations.
The server runs locally. It does not require an API key and does not send indexed source code to an external service.
- Node.js 20 or newer
- A local git repository to index
- An MCP client that supports stdio servers
Clone the repository and install dependencies:
git clone https://github.com/<owner>/<repo>.git
cd <repo>
npm installFor a global command:
npm install -g git+https://github.com/<owner>/<repo>.git
cortex-engine /absolute/path/to/your/repoFor a local checkout, point your MCP client directly at the server:
{
"mcpServers": {
"cortex-engine": {
"command": "node",
"args": [
"/absolute/path/to/cortex-engine-mcp/src/server.js",
"/absolute/path/to/your/repo"
]
}
}
}If the command was installed globally, the MCP config can use the binary:
{
"mcpServers": {
"cortex-engine": {
"command": "cortex-engine",
"args": ["/absolute/path/to/your/repo"]
}
}
}Create cortex.config.js in the repository you want to index:
module.exports = {
dbPath: '.cortex/index.db',
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.md'],
ignorePaths: ['dist', 'build', 'coverage'],
usePolling: false,
pollInterval: 100,
tagRules: {},
};If no config file exists, Cortex Engine uses sensible defaults and stores its index at .cortex/index.db inside the target repository.
cortex_status: index health and countscortex_reindex: rebuild all or part of the indexcortex_tree: indexed file treecortex_outline: symbols in a filecortex_read_symbol: source for one symbolcortex_read_symbols: source for several symbolscortex_read_range: source by line rangecortex_context: symbol plus imports and outlinecortex_find_symbol: symbol searchcortex_find_text: indexed literal text searchcortex_find_references: identifier referencescortex_find_importers: files that import a pathcortex_find_by_tag: semantic tag searchcortex_git_status: current git statuscortex_git_diff: git diffcortex_git_blame: git blame for a filecortex_git_log: recent commitscortex_git_hotspots: frequently changed filescortex_annotate: store a local annotationcortex_recall: retrieve annotationscortex_patterns: retrieve directory-level patternscortex_lessons: retrieve stored lessonscortex_sync_knowledge: export annotations to an Obsidian-compatible vaultcortex_list_repos: list indexed repositoriescortex_add_repo: add another repository at runtimecortex_diagnostic: run index diagnosticscortex_telemetry: local query telemetry
npm install
npm test
node bin/cortex.js --helpThe generated .cortex/ index, node_modules/, environment files, and coverage output are ignored by git.