The most comprehensive MCP server for codebase intelligence
Drift scans your codebase, learns YOUR patterns, and gives AI agents deep understanding of your conventions. 35+ CLI commands. 45+ MCP tools. 8 languages. Your AI finally writes code that fits.
AI writes code that works but doesn't fit. It ignores your conventions, misses your patterns, and creates inconsistency. You spend more time fixing AI output than you saved.
Drift fixes this.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β YOUR CODEBASE β
β src/api/users.ts src/auth/login.ts src/db/queries.ts β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. DRIFT SCAN β
β β
β $ drift init && drift scan β
β β
β Drift analyzes your code with Tree-sitter parsing: β
β β’ Discovers patterns (how YOU write controllers, services, etc.) β
β β’ Builds call graph (who calls what, data flow) β
β β’ Maps security boundaries (what touches sensitive data) β
β β’ Tracks test coverage (which code is tested) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 2. PATTERN LEARNING β
β β
β Drift discovers YOUR conventions: β
β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β API Pattern β β Error Pattern β β Auth Pattern β β
β β @Controller β β try/catch with β β @RequireAuth() β β
β β /api/v1 prefix β β AppError class β β middleware β β
β β 47 locations β β 23 locations β β 12 locations β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β
β You approve what matters: $ drift approve api-controller-pattern β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 3. AI GETS CONTEXT β
β β
β When AI asks "Add a user preferences endpoint": β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β drift_context({ intent: "add_feature", focus: "user preferences" })β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Returns: β β
β β β’ Your API pattern: @Controller, /api/v1, response format β β
β β β’ Similar endpoints: getUserProfile, updateUserSettings β β
β β β’ Required middleware: @RequireAuth(), @ValidateBody() β β
β β β’ Error handling: Use AppError, wrap in try/catch β β
β β β’ Files to modify: src/api/users.controller.ts β β
β β β’ Security note: User data requires audit logging β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 4. AI WRITES FITTING CODE β
β β
β // AI generates code that matches YOUR patterns: β
β β
β @Controller('/api/v1/users') // β Your prefix β
β @RequireAuth() // β Your auth pattern β
β export class UserPreferencesController { β
β @Post('/preferences') β
β @ValidateBody(PreferencesSchema) // β Your validation β
β async updatePreferences(req, res) { β
β try { β
β // ... implementation β
β } catch (error) { β
β throw new AppError(error); // β Your error pattern β
β } β
β } β
β } β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Install globally
npm install -g driftdetect
# In your project
cd your-project
drift init
drift scan
# See what Drift learned
drift statusThat's it. Drift now understands your codebase.
Add to your MCP config:
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"drift": {
"command": "npx",
"args": ["-y", "driftdetect-mcp"]
}
}
}Cursor (.cursor/mcp.json):
{
"mcpServers": {
"drift": {
"command": "npx",
"args": ["-y", "driftdetect-mcp"]
}
}
}Windsurf, Kiro, VS Code β same format in their respective config files.
| Question | Drift Tool | What You Get |
|---|---|---|
| "How do I add a new endpoint?" | drift_context |
Patterns, examples, files to modify |
| "What data can this function access?" | drift_reachability |
Full data flow path |
| "What breaks if I change this?" | drift_impact_analysis |
Blast radius, affected callers |
| "Which tests should I run?" | drift_test_topology |
Minimum test set |
| "Who can access user passwords?" | drift_reachability --inverse |
All code paths to sensitive data |
| "Are there dependency cycles?" | drift_coupling |
Cycles, hotspots, metrics |
| "What errors aren't handled?" | drift_error_handling |
Gaps, swallowed exceptions |
| Language | Parsing | Call Graph | Data Access | Frameworks |
|---|---|---|---|---|
| TypeScript/JS | β Tree-sitter | β | β | React, Next.js, Express, Prisma, TypeORM |
| Python | β Tree-sitter | β | β | Django, FastAPI, Flask, SQLAlchemy |
| Java | β Tree-sitter | β | β | Spring Boot, JPA/Hibernate |
| C# | β Tree-sitter | β | β | ASP.NET Core, EF Core, WPF |
| PHP | β Tree-sitter | β | β | Laravel, Eloquent |
| Go | β Tree-sitter | β | β | Gin, Echo, GORM |
| Rust | β Tree-sitter | β | β | Actix, Axum, Diesel |
| C++ | β Tree-sitter | β | β | Qt, Boost, custom frameworks |
Drift's MCP server uses a 7-layer architecture designed for efficient AI interaction:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ORCHESTRATION drift_context β
β "Tell me what you want, I'll give you everything" β
β Token budget: 1000-2000 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DISCOVERY drift_status, drift_capabilities β
β "Quick health check" β
β Token budget: 200-500 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β SURGICAL drift_signature, drift_callers, drift_type β
β "I need exactly this one thing" β
β Token budget: 200-500 (12 tools) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β EXPLORATION drift_patterns_list, drift_security_summary β
β "Let me browse and filter" β
β Token budget: 500-1000 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DETAIL drift_pattern_get, drift_impact_analysis β
β "Deep dive into this specific thing" β
β Token budget: 500-1500 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ANALYSIS drift_coupling, drift_test_topology β
β "Run complex analysis" β
β Token budget: 1000-2000 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β GENERATION drift_validate_change, drift_suggest_changes β
β "Help me write code" β
β Token budget: 500-1500 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Why this matters: Most MCP servers dump 50 flat tools. AI wastes tokens figuring out which to call. Drift's orchestration layer understands intent and returns curated context in one call.
drift scan # Discover patterns
drift status # See what was found
drift approve <pattern-id> # Approve conventionsdrift callgraph reach src/api/users.ts:42 # What data can line 42 access?
drift callgraph inverse users.password_hash # Who can access passwords?drift boundaries # See sensitive data access
drift security-summary # Security posture overviewdrift test-topology build # Build test mappings
drift test-topology affected src/auth/login.ts # Minimum tests to rundrift coupling build # Build dependency graph
drift coupling cycles # Find dependency cycles
drift coupling hotspots # High-coupling modulesdrift error-handling build # Analyze error handling
drift error-handling gaps # Find unhandled errors# Fail on violations
drift check --ci --fail-on warning
# GitHub Actions format
drift check --format github
# GitLab CI format
drift check --format gitlab- Wiki β Complete documentation
- MCP Tools Reference β All 45+ tools documented
- MCP Architecture β The gold standard design
- Getting Started β Detailed setup guide
- FAQ β 50+ questions answered
Open Core model:
- Core packages: Apache 2.0 (fully open source)
- Enterprise features: BSL 1.1 (converts to Apache 2.0 after 4 years)
Individual developers and small teams use Drift completely free.
See licenses/LICENSING.md for details.
Stop fixing AI output. Start shipping.