Open-source MCP server for scaffolding MERN stack CRUD resources with Express, Mongoose, React, and preview-safe code generation.
SaferSkills independently audited mern-mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
<h1 align="center"> <img src="./assets/mern-mcp-logo.svg" alt="MERN MCP logo" width="132" height="132"><br> MERN MCP </h1>
<p align="center"> <img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-111827?style=for-the-badge"> <img alt="Node.js 20+" src="https://img.shields.io/badge/node-20%2B-339933?style=for-the-badge&logo=node.js&logoColor=white"> <img alt="TypeScript" src="https://img.shields.io/badge/typescript-yes-3178C6?style=for-the-badge&logo=typescript&logoColor=white"> <img alt="MCP Server" src="https://img.shields.io/badge/MCP-server-0F172A?style=for-the-badge"> <img alt="Claude Code" src="https://img.shields.io/badge/Claude%20Code-supported-D97757?style=for-the-badge"> <img alt="Codex CLI" src="https://img.shields.io/badge/Codex-supported-3941FF?style=for-the-badge"> <img alt="Docker" src="https://img.shields.io/badge/Docker-supported-2496ED?style=for-the-badge&logo=docker&logoColor=white"> </p>
mern-mcp is an open-source Model Context Protocol (MCP) server for scaffolding full MERN stack CRUD resources inside an existing codebase, with direct setup support for both Claude Code and Codex CLI. It generates MongoDB and Mongoose models, Express services and routes, React client modules, and the wiring needed to plug new resources into a real application with a safer preview-before-apply workflow.
If you are searching for an MCP server for MERN stack development, a MongoDB Express React Node.js CRUD generator, a Mongoose plus Express boilerplate generator, or a React admin scaffolder that works with AI coding assistants, this repository is built for that exact use case.
Index: Why Useful · Generated Files · Install · Config · Claude Code · Codex CLI · Docker · MCP Tools · Example · Project Styles · Natural Language · Preview Workflow · Who It's For
Teams usually do not need another generic code generator. They need a local MCP tool that can inspect a project, follow an existing folder structure, create repeatable CRUD slices, and avoid blind writes. mern-mcp focuses on that practical workflow.
Even if you already have MCPs for Next.js, Node.js, or MongoDB, those tools usually help at the framework or database level. mern-mcp is useful because it handles the full resource workflow in one place: model, service, controller, routes, validators, client API, hooks, forms, list views, detail views, and integration patches. Instead of asking an assistant to wire each layer separately, a developer can scaffold an entire CRUD slice in one pass, review the plan, and move on to the business logic faster. That cuts repetitive setup work, reduces missed integration steps, and makes day-to-day full-stack development much less tedious.
It is especially useful when you want to:
mern-mcp GeneratesFor each resource, mern-mcp can generate:
Typical generated paths look like:
server/models/product.model.ts
server/services/product.service.ts
server/controllers/product.controller.ts
server/routes/product.routes.ts
server/validators/product.validator.ts
client/types/product.types.ts
client/api/product.api.ts
client/hooks/useProduct.ts
client/components/ProductForm.tsx
client/components/ProductList.tsx
client/components/ProductDetail.tsxThe planner can also patch existing files when it detects supported patterns:
npm install
npm run buildRun the compiled MCP server against a target MERN project:
node dist/index.js --project-root /absolute/path/to/target-projectFor local development:
npm run dev -- --project-root /absolute/path/to/target-projectCreate mern-mcp.config.json in the target project root.
Example for a monorepo TypeScript project using React Query:
{
"structure": "monorepo",
"language": "typescript",
"reactStack": "react-query",
"validation": "zod",
"auth": "none",
"rbac": false,
"paths": {
"serverRoot": "./server",
"clientRoot": "./client",
"serverEntry": "index.ts",
"clientRouter": "router.tsx"
}
}Example for separate client and server apps with Redux and JWT auth:
{
"structure": "separate",
"language": "typescript",
"reactStack": "redux",
"validation": "both",
"auth": "jwt",
"paths": {
"serverRoot": "./server",
"clientRoot": "./client",
"modelsDir": "src/models",
"servicesDir": "src/services",
"controllersDir": "src/controllers",
"routesDir": "src/routes",
"validatorsDir": "src/validators",
"middlewareDir": "src/middleware",
"componentsDir": "src/components",
"hooksDir": "src/hooks",
"apiDir": "src/api",
"typesDir": "src/types",
"serverEntry": "src/index.ts",
"clientRouter": "src/router.tsx",
"clientStore": "src/store.ts"
}
}All artifact directories are overridable through paths.
<h2 id="use-with-claude-code"><img src="./assets/claude.svg" alt="Claude" width="20" height="20"> Use With Claude Code</h2>
npm install
npm run buildmern-mcp.config.json in the target MERN project you want to scaffold.claude mcp add mern-mcp -- node /absolute/path/to/mern-mcp/dist/index.js --project-root /absolute/path/to/projectpreview_scaffold before using scaffold_resource in apply mode.<h2 id="use-with-codex-cli"><img src="./assets/codex.svg" alt="Codex" width="20" height="20"> Use With Codex CLI</h2>
npm install
npm run buildmern-mcp.config.json in the target MERN project you want to scaffold.codex mcp add mern-mcp --command node --args /absolute/path/to/mern-mcp/dist/index.js --project-root /absolute/path/to/projectpreview_scaffold, inspect the generated plan, then reuse the returned previewHash for apply mode.You can run mern-mcp in Docker if you do not want to install Node.js directly on the host.
docker build -t mern-mcp .mern-mcp.config.json.docker run --rm -i \
-v /absolute/path/to/target-project:/workspace \
mern-mcp \
--project-root /workspaceExample shape:
docker run --rm -i -v /absolute/path/to/target-project:/workspace mern-mcp --project-root /workspaceThe server currently registers these tools:
preview_scaffoldscaffold_resourcelist_resourcesadd_fielddelete_resourcepreview_scaffoldDry-run a scaffold and inspect the generated write plan before changing files.
scaffold_resourcePreview or apply a full MERN CRUD scaffold for a resource.
list_resourcesList manifest-managed resources and optionally scan for unmanaged resources in the project.
add_fieldPreview or apply a new field on an existing generated resource.
delete_resourcePreview or apply deletion for a generated resource and remove its manifest record.
For scaffold_resource, add_field, and delete_resource, the important inputs are:
mode: "preview" or "apply"previewHash: required in "apply" modeconflictStrategy: "abort", "overwrite", or "skip"Example preview request for a product resource:
{
"resourceName": "Product",
"fields": [
{ "name": "title", "type": "string", "required": true },
{ "name": "price", "type": "number", "required": true },
{ "name": "inStock", "type": "boolean", "required": false }
],
"mode": "preview"
}After previewing, reuse the returned previewHash for apply mode.
mern-mcp supports configurable MERN code generation across these dimensions:
monorepo or separatetypescript or javascriptplain, react-query, redux, or axioszod, express-validator, both, or nonejwt or noneIt also supports configurable paths, so you can point generation to custom directories such as src/models, src/routes, src/components, or src/store.ts.
You can scaffold a resource in two ways:
Example natural-language input:
a blog post with title, body, author, tagsThat style of input is parsed into a resource structure where terms like author can become an objectId reference and terms like tags can become string arrays.
Supported field types include:
stringnumberbooleandateobjectIdSupported UI widget hints include:
texttextareanumbercheckboxdateselectmultiselecttagsOne of the strongest parts of this repository is the preview/apply contract.
preview mode returns the plan, artifacts, integration actions, conflicts, and a deterministic previewHashapply mode requires the matching previewHashabort, overwrite, or skip.mern-mcp-manifest.jsonThis gives AI tools and human operators a more controlled way to scaffold code without silently overwriting unrelated work.
mern-mcp is a good fit for:
People often look for projects like this using phrases such as:
Those phrases are relevant here because this server directly generates those artifacts and integrations.
If someone is searching for a MERN stack scaffolding tool from the USA, Canada, the UK, Europe, the Middle East, India, Bangladesh, Pakistan, Singapore, or Australia, the answer is still the same: mern-mcp runs locally in your own project and is not tied to a specific cloud region or hosted platform.
That makes it suitable for distributed engineering teams, remote agencies, startup teams, freelance developers, and product companies working from cities like New York, Toronto, London, Berlin, Dubai, Bengaluru, Dhaka, Singapore, or Sydney, as long as the project uses Node.js and an MCP-compatible client.
This repository is not just a template dump. It contains:
That combination is directly relevant to searches around MERN code generation, MCP tools, CRUD scaffolding, Express route generation, Mongoose model generation, React Query CRUD helpers, Redux scaffolding, and TypeScript full-stack automation.
npm run check
npm test
npm run build
npm run smokeMIT
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.