NestJS Drizzle MCP server for AI agents

Run the NestJS Drizzle MCP server with npx so Claude Code, Cursor or Copilot can read the package docs, and add the AGENT.md rules file to your repo.

The NestJS Drizzle MCP server ships inside @avytrix/nestjs-drizzle-crud: run npx -p @avytrix/nestjs-drizzle-crud nestjs-drizzle-crud-mcp and any MCP client (Claude Code, Cursor, Copilot, Codex, Gemini CLI and others) can list, read and search the package docs while it writes code. The package also ships a rules file, AGENT.md, with templates that load it into the file your agent reads. Neither adds a dependency to your app.

Read-only by design

The server only reads the markdown files inside its own installed package. It never connects to your database and never writes anything.

What are the server's stable facts?

FactValue
Package version3.8.3
Command (bin)nestjs-drizzle-crud-mcp
Transportstdio: JSON-RPC 2.0, one message per line
Runtime dependencieszero; the server is plain Node with no MCP SDK
Node.js20 or later, like the package
Toolslist_docs, get_doc, search_docs
Documentsagent-guide (AGENT.md), readme (README.md), changelog (CHANGELOG.md)

The server reports the installed package version in its initialize reply, so it always serves the docs for the version you run.

How do I run the MCP server?

pnpm --package=@avytrix/nestjs-drizzle-crud dlx nestjs-drizzle-crud-mcp

It starts and waits for JSON-RPC messages on stdin. You do not run it by hand day to day: your agent starts it from the config below.

How do I add it to my agent?

Register it once per project. Claude Code, Cursor, Windsurf, Gemini CLI and Cline use the same mcpServers shape:

.mcp.json
{
  "mcpServers": {
    "nestjs-drizzle-crud": {
      "command": "npx",
      "args": ["-y", "-p", "@avytrix/nestjs-drizzle-crud", "nestjs-drizzle-crud-mcp"]
    }
  }
}

Or add it from the CLI:

Terminal
claude mcp add nestjs-drizzle-crud -- npx -y -p @avytrix/nestjs-drizzle-crud nestjs-drizzle-crud-mcp

Windsurf, Gemini CLI and Cline take the same mcpServers block as Claude Code in their own MCP settings file. Zed uses a context_servers entry in its settings.json with the same command and arguments.

Which tools does the server expose?

Three, defined in src/mcp/server.ts:

ToolArgumentsReturns
list_docsnoneEach document with its top-level headings. Start here.
get_docdoc, optional sectionA whole document, or every section whose heading contains section (case-insensitive).
search_docsquery, optional limit (default 5, max 20)The best-matching sections across all three documents, best first, each cut to 1,500 characters.

doc is one of agent-guide, readme or changelog. A typical agent turn is search_docs({ query: "has-many eager loading" }), then get_doc({ doc: "agent-guide", section: "Relations" }).

A tool failure, such as an unknown tool name, comes back as a result with isError: true, so the client shows it to the model instead of dropping the turn.

Which rules file does my agent read?

Copy the template that matches your tool into your project root:

Terminal
cp node_modules/@avytrix/nestjs-drizzle-crud/AGENTS.template.md ./AGENTS.md   # most tools
cp node_modules/@avytrix/nestjs-drizzle-crud/CLAUDE.template.md ./CLAUDE.md   # Claude Code
AgentFile in your project root
OpenAI Codex, Cursor, GitHub Copilot, Zed, Cline, Windsurf, JulesAGENTS.md
Claude CodeCLAUDE.md
Gemini CLIGEMINI.md
AiderCONVENTIONS.md, then aider --read CONVENTIONS.md

Each template is a pointer, not a copy. Besides comments, it holds one line:

AGENTS.md
@node_modules/@avytrix/nestjs-drizzle-crud/AGENT.md

AGENT.md ships inside the package and stays the single source of truth, so an upgrade updates the rules with it. If your agent does not resolve @ imports, paste the contents of AGENT.md in place of that line, or run the MCP server so the agent fetches the guidance itself.

Using several agents on one repo? Copy the template to each filename, or keep AGENTS.md and make the others a one-line pointer to it.

What is in the rules file?

AGENT.md is written for an agent about to add an endpoint. It covers the facts agents most often get wrong:

  • A service is normally an empty subclass of SqlBaseCrudService, and the table goes in forFeature, not in the service.
  • Filters are objects, such as { age: { gte: 18 } }, and findAll returns { data, total, page, limit }.
  • Which exception maps to which HTTP status code, and how allowlists, scope and soft delete work.
  • A definition of done, so the agent stops when the endpoint is complete.

It exists to prevent the two most common mistakes: hand-writing repository code the base service already has, and injecting the database into a service.

Common questions

Next steps

Last updated View change history

On this page