Drift CLI
A local CLI and read-only MCP server that stop agents from breaking API route layering in Next.js
- 792 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- Builds from Rust sources and runs a local scanner that writes a contract database to SQLite
- The drift-mcp server gives the agent the contract and example files read-only
Install
- Works in
Manual install
git clone https://github.com/dadbodgeoff/drift.git && cd drift
pnpm install --frozen-lockfile
pnpm build && pnpm build:engineRequires Rust. Entry point: node packages/cli/dist/main.js.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Builds from Rust sources and runs a local scanner that writes a contract database to SQLite
- The drift-mcp server gives the agent the contract and example files read-only
This is third-party code. Review the repository files before installing.
What it does
Drift scans a TypeScript or JavaScript repository and infers a convention: Next.js API routes must not import data-access clients such as Prisma directly. Once a human confirms it, the convention becomes a contract and existing violations go into a baseline. drift check inspects a diff and names the file, line and broken rule; in block mode it exits with code 2. The read-only drift-mcp server lets an agent read the contract up front and, via get_task_preflight, get example files that already follow the pattern.
Who it is for. For Next.js teams that let agents write API routes and want to keep a service layer intact.
Good fit when
- Agents add routes that hit the database around services
- You need a CI gate for an architecture convention
- You want to give an agent correct examples before a task
Not a fit when
- The project is not Next.js or not TypeScript and JavaScript
- You need general code review or other rules
Example request
Before adding the endpoint, ask Drift for a preflight and follow the examples it returnsLimitations
Beta: not published to npm, built from source only and requires Rust and pnpm; there is no drift binary yet. Supports one convention family for Next.js. Edit-time hooks are not shipped. The driftdetect npm package is unrelated. A get_task_preflight response is around 20,000 tokens.
How to disable. Remove drift-mcp from the MCP config, the drift check step from CI and the ~/.drift directory.
FAQ
Why do violations only warn?
If most routes break the convention, Drift treats it as a refactor goal and does not block until a human decides.
Can an agent change rules via MCP?
No, the server is read-only; accepting conventions and suppressing findings stay with humans.
Discussion
No questions or reviews yet.
Related
CLI toolsAn MCP server and CLI for code research: search and understand your project and all of GitHub with fewer tokens
A Rust CLI for TypeScript and JavaScript: dead code, duplicates, cycles, complexity and architecture boundaries from one graph, plus MCP and skills
An MCP server for the Node.js debugger: breakpoints, stepping, variable inspection and expression evaluation at a pause
A CLI and TypeScript runtime for calling MCP servers from a terminal, scripts and generated typed clients
An MCP server that turns a large codebase into a semantic feature graph for precise navigation and meaning-based search
rust-analyzer MCP: Rust code navigation for agents
r3bl-rust-analyzer-mcp-server
A Rust MCP server on standard threads: the agent gets hover info, go to definition, references, formatting and compiler diagnostics from rust-analyzer
README in short
The README states the beta status and source build up front and gives install and first-run commands. A scope section limits claims to one language family, one framework and one convention. It reports results on seven open-source Next.js repositories and explains when checks block versus warn. MIT licensed.