SourceIntelligence 1.0.0
dotnet tool install --global SourceIntelligence --version 1.0.0
dotnet new tool-manifest
dotnet tool install --local SourceIntelligence --version 1.0.0
#tool dotnet:?package=SourceIntelligence&version=1.0.0
nuke :add-package SourceIntelligence --version 1.0.0
SourceIntelligence
A Model Context Protocol (MCP) server that rapidly indexes large codebases and provides deep code intelligence to any MCP-compatible AI client β search, symbol lookup, git history, code metrics, dead-code detection, call-chain graphs, and more β built with .NET 10.
Features
- β‘ Fast full-text search across all indexed source files with declaration-first ranking
- π Symbol lookup β find class, interface, method, enum, record, struct, and delegate definitions
- π File outline β structural overview of all declarations in any file
- π Find usages & implementations β all call-sites, references, and interface implementations
- π§Ή Dead-code detection β heuristic unreferenced public types and methods
- π¦ NuGet & project dependency graphs β all
PackageReferenceandProjectReferenceentries - πΏ Git integration β blame, diffs, commit log, branch comparison, contributor stats, recently changed files, commit search
- π Code metrics β lines of code, comment lines, blank lines per file
- πΈοΈ Call-chain graph β end-to-end Mermaid flowchart from any entry-point method
- π Live file watcher β incremental re-index within 5 seconds of any file change
- πΎ Warm cache β
.sourceindex.cache.gzmakes subsequent starts near-instant - π Dual transport β stdio (MCP clients) or HTTP (browser / SSE)
- πͺ Windows Service support β run as an auto-start background service
Requirements
- .NET 10 SDK or later
- Git (optional β required only for git-related tools)
Installation
As a .NET Global Tool (recommended)
dotnet tool install -g SourceIntelligence
To update to the latest version:
dotnet tool update -g SourceIntelligence
From source
git clone https://github.com/BasitNaeem/SourceIntelligence.git
cd SourceIntelligence
dotnet build -c Release
dotnet run --project src/SourceIntelligence.csproj -- --repo /path/to/your/codebase
Getting Started
After installing the global tool, run it pointing at any repository:
sourceintelligence --repo /path/to/your/codebase
The server prints its status to stderr on startup:
Repository root : /path/to/your/codebase
Indexing files ... (full build)
Index ready : 1 234 files loaded | watcher active | git-watcher active
On subsequent runs the cache is loaded and the server is ready in under 1 second:
Repository root : /path/to/your/codebase
Indexing files ... (cache warm)
Index ready : 1 234 files loaded | watcher active | git-watcher active
First run takes 5β15 seconds depending on codebase size. After that the
.sourceindex.cache.gzfile makes restarts near-instant.
Configuration
Command-line (highest priority)
| Flag | Description |
|---|---|
--repo <path> |
Absolute path to the repository to index |
--service |
Run as a Windows Service (HTTP transport) |
Environment variable
# Linux / macOS
export SOURCEINTELLIGENCE_REPO_PATH=/path/to/your/codebase
# Windows (PowerShell)
$env:SOURCEINTELLIGENCE_REPO_PATH = "C:\path\to\your\codebase"
appsettings.json
Place an appsettings.json alongside the executable (or in the working directory) to configure defaults:
{
"Index": {
"RepositoryPath": "/path/to/your/codebase",
"ProjectName": "MyApp",
"Port": 5200,
"MaxFileSizeBytes": 524288,
"FileWatcherDebounceMs": 5000,
"GitWatcherDebounceMs": 2000,
"DefaultContextLines": 2
}
}
| Setting | Default | Description |
|---|---|---|
RepositoryPath |
CWD | Absolute path to the repository root to index |
ProjectName |
Folder name | Friendly name shown in tool output headers |
Port |
5200 |
HTTP port (HTTP / Windows Service mode only) |
MaxFileSizeBytes |
524288 (512 KB) |
Files larger than this are skipped during indexing |
FileWatcherDebounceMs |
5000 |
Debounce window (ms) before flushing file-system changes to the index |
GitWatcherDebounceMs |
2000 |
Debounce window (ms) before triggering a git-aware incremental refresh |
DefaultContextLines |
2 |
Surrounding lines included with each search result (Β±2 lines = 5-line window) |
Priority order: --repo flag β appsettings.json β SOURCEINTELLIGENCE_REPO_PATH env var β current working directory.
Connecting an MCP Client
Visual Studio / VS Code (Copilot)
Add to your .mcp.json (user or workspace level):
Via global tool (after dotnet tool install -g SourceIntelligence):
{
"servers": {
"SourceIntelligence": {
"type": "stdio",
"command": "sourceintelligence",
"args": ["--repo", "/path/to/your/codebase"]
}
}
}
Via built binary (faster startup, no .NET SDK required at runtime):
{
"servers": {
"SourceIntelligence": {
"type": "stdio",
"command": "/path/to/SourceIntelligence/bin/Release/net10.0/SourceIntelligence",
"args": ["--repo", "/path/to/your/codebase"]
}
}
}
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"SourceIntelligence": {
"command": "sourceintelligence",
"args": ["--repo", "/path/to/your/codebase"]
}
}
}
HTTP / SSE mode
When stdin is not redirected (i.e. launched from a terminal rather than by an MCP client), the server starts in HTTP mode instead of stdio:
HTTP port : 5200
Listening on : http://localhost:5200/mcp
Connect any SSE-capable MCP client to that URL. The port is configurable via appsettings.json or the Port setting.
Running as a Windows Service
Use the included install-service.ps1 script to install SourceIntelligence as an auto-start Windows Service. Requires the global tool to be installed first (dotnet tool install -g SourceIntelligence).
# Install on default port 5200
.\install-service.ps1 -RepoPath "C:\path\to\your\repo"
# Install on a custom port
.\install-service.ps1 -RepoPath "C:\path\to\your\repo" -Port 5300
# Uninstall
.\install-service.ps1 -Uninstall
The service:
- Runs HTTP on the configured port (
http://localhost:5200/mcp) - Starts automatically on boot
- Restarts automatically on failure (up to 3 times, with increasing backoff)
- Logs to the Windows Event Log under the source
SourceIntelligence
Connect your MCP client to http://localhost:5200/mcp after installation.
Building a Self-Contained Binary
# Windows
dotnet publish -c Release -r win-x64 --self-contained true -o ./publish
# Linux
dotnet publish -c Release -r linux-x64 --self-contained true -o ./publish
# macOS (Apple Silicon)
dotnet publish -c Release -r osx-arm64 --self-contained true -o ./publish
# macOS (Intel)
dotnet publish -c Release -r osx-x64 --self-contained true -o ./publish
The output is a single self-contained executable with no .NET runtime dependency.
How It Works
- On startup, SourceIntelligence scans the repository, builds an inverted full-text index and a forward index, then saves a compressed cache (
.sourceindex.cache.gz) to disk. - A file-system watcher monitors the repository for changes and incrementally updates the index within 5 seconds of any file change.
- A git watcher monitors the
.gitdirectory for branch switches, pulls, and commits, triggering a git-aware incremental refresh (only changed files are re-indexed). - Tools block via an internal
WaitUntilReadyAsync()call for up to 25 seconds on first launch, then return a "still building" message if the index hasn't warmed yet. - All tool calls are served from in-memory structures β no disk I/O during search.
Available Tools
| Tool | Description |
|---|---|
search_code |
Full-text search with declaration-first ranking; compact mode for token-efficient results |
find_symbol |
Locate class / interface / method / enum / record / struct / delegate definitions |
find_usages |
All call-sites and references to a symbol across the entire codebase |
find_implementations |
Types and methods that implement or inherit from an interface / base class |
get_file_content |
Retrieve file content with optional line range and auto-pagination (300-line pages) |
get_multiple_files |
Read multiple files in a single round-trip |
list_files |
Browse indexed files by extension and/or directory (capped at 200 by default) |
get_file_outline |
Ordered list of type and member declarations in a file |
get_namespace_types |
All types declared within a given namespace across the codebase |
get_project_structure |
Solution files, all .csproj projects, and top-level directories with file counts |
get_repository_summary |
High-level stats (file counts, top dirs, sync status) with optional tool reference table |
get_index_stats |
Diagnostic: unique words, forward-index entries, estimated RAM footprint |
refresh_index |
Smart incremental re-index (git-aware β timestamp β full rebuild); force=true for full rebuild |
regex_search |
Search using a full .NET regular expression pattern |
search_by_attribute |
Find all types / methods decorated with a specific C# attribute |
get_nuget_packages |
List all PackageReference entries from every .csproj; filter by package name |
get_project_dependencies |
All project-to-project ProjectReference edges; filter by project name |
find_dead_code |
Heuristic: public types and methods with no references elsewhere in the codebase |
find_todos |
Find TODO / FIXME / HACK / NOTE / XXX comments; filter by kind |
get_code_metrics |
Per-file stats: total lines, code lines, comment lines, blank lines (sorted by size) |
get_file_diff |
Unified git diff for a file (HEAD vs working tree, or between two refs) |
get_git_log |
Commit history for a specific file |
get_git_blame |
Line-by-line blame: who last modified each line, when, and in which commit |
find_recently_changed |
Files modified in git within the last N days |
search_commits |
Search git commit messages by keyword; filter by author and/or date range |
compare_branches |
Changed files and unique commits between two branches |
get_repo_contributors |
Ranked contributor stats by commit count over a configurable time window |
get_ownership |
File ownership: top contributors, churn risk score, CODEOWNERS assignments |
find_related_tests |
Discover test files for given source files or symbols (High/Medium confidence) |
get_change_impact |
Direct impact analysis: what else references a file or symbol |
get_context_pack |
Bundles relevant files, declarations, diffs, TODOs, and dead-code in one call |
get_call_chain_graph |
End-to-end call chain as a Mermaid flowchart from any entry-point method |
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 40 | 4/8/2026 |