Drift
A local CLI and read-only MCP server that stop agents from breaking API route layering in Next.js
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.
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.
Security check
- Runs locally, does not modify source code and sends nothing to a server
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.
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.
Related
A skills library that gives coding agents a development process: brainstorming, planning, TDD, subagents and code review
Skills for real engineers by Matt Pocock
Skills For Real Engineers
Small composable skills for engineering with agents: plan grilling, TDD, bug diagnosis, code review and architecture
Reference MCP servers
Model Context Protocol servers
Official reference MCP servers: Filesystem, Fetch, Git, Memory, Sequential Thinking, Time and Everything
Up-to-date, version-specific library docs and code examples in your agent's context, via MCP or a CLI plus skill