MERN MCP

io.github.IrtezaAsadRizvi由 GitHub 账号 IrtezaAsadRizvi 发布v0.1.0更新于 Oct 24, 2026

Scaffolds MERN CRUD resources into existing Express and React codebases.

已验证STDIO仅桌面数据库开发者工具

概览

AI 生成的概览

本地 MCP 服务器,可向现有 MERN 项目脚手架生成完整 CRUD 资源(Mongoose 模型、Express 路由、React 组件),并支持先预览后应用。

可以做什么
  • 预览并应用某个资源的完整 CRUD 脚手架,生成服务端模型、服务、控制器、路由与校验器,以及客户端类型、API 模块、hooks、表单、列表和详情组件
  • 修补现有文件,挂载 Express 路由、注册 React Router 路由并接入 Redux reducer
  • 列出清单中管理的资源,并可选扫描项目中未被管理的资源
  • 为已生成的资源新增字段,或删除已生成资源及其清单记录
  • 支持显式字段结构,也支持从自然语言描述推断字段
适用场景
适用于维护 MERN(MongoDB、Express、React、Node.js)代码库的团队,希望让 AI 编程助手按现有目录结构和约定批量生成可重复的 CRUD 切片,包括 monorepo 或前后端分离的布局。
运行要求
以本地 Node.js 进程运行(npm 包 mern-mcp,需 npm install 与 npm run build),也可用 Docker 运行。需要环境变量 MERN_MCP_PROJECT_ROOT 或 --project-root 参数指向目标项目,并在该项目根目录提供 mern-mcp.config.json,说明结构、语言、React 数据栈、校验、认证与路径。
安装前请注意
apply 模式会写入并修改项目文件,包括修补已有的入口、路由和 store 文件;应先执行预览并复用返回的 previewHash。冲突策略可能覆盖非受管文件,需审阅计划并谨慎选择 abort、overwrite 或 skip。删除操作会移除已生成文件与清单记录。生成的 JWT 认证中间件只是脚手架,并非安全审计。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MERN MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[MERN MCP logo]
MERN MCP

[License: MIT] [Node.js 20+] [TypeScript] [MCP Server] [Claude Code] [Codex CLI] [Docker]

AI-Powered MERN Stack CRUD Scaffolder and MCP Server

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

Why This Repository Is Useful

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:

  • scaffold a MERN CRUD API and React UI from a resource schema
  • generate Mongoose models, Express controllers, services, routes, and validators
  • generate React forms, list views, detail views, hooks, shared types, and API modules
  • let an MCP-compatible coding assistant create resources inside your own repo
  • preview file changes before applying them
  • manage generated resources over time with add-field and delete workflows
  • support monorepo or separate server and client projects

What mern-mcp Generates

For each resource, mern-mcp can generate:

  • server model file
  • server service file
  • server controller file
  • server routes file
  • server validator file when validation is enabled
  • auth middleware file when JWT auth is enabled
  • client shared types file
  • client API module
  • client data hook
  • client form component
  • client list component
  • client detail component

Typical generated paths look like:

text
server/models/product.model.tsserver/services/product.service.tsserver/controllers/product.controller.tsserver/routes/product.routes.tsserver/validators/product.validator.tsclient/types/product.types.tsclient/api/product.api.tsclient/hooks/useProduct.tsclient/components/ProductForm.tsxclient/components/ProductList.tsxclient/components/ProductDetail.tsx

The planner can also patch existing files when it detects supported patterns:

  • mount new Express routes in a server entry file
  • register new routes in a React Router file
  • register reducers in a Redux store when the detected store shape is supported

Installation

bash
npm installnpm run build

Run the compiled MCP server against a target MERN project:

bash
node dist/index.js --project-root /absolute/path/to/target-project

For local development:

bash
npm run dev -- --project-root /absolute/path/to/target-project

Configuration

Create mern-mcp.config.json in the target project root.

Example for a monorepo TypeScript project using React Query:

json
{  "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:

json
{  "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.

[Claude] Use With Claude Code

  1. Install dependencies and build this repository:
bash
npm installnpm run build
  1. Create mern-mcp.config.json in the target MERN project you want to scaffold.
  2. Add the MCP server to Claude Code:
bash
claude mcp add mern-mcp -- node /absolute/path/to/mern-mcp/dist/index.js --project-root /absolute/path/to/project
  1. Confirm the server is available in Claude Code.
  2. Start with preview_scaffold before using scaffold_resource in apply mode.

[Codex] Use With Codex CLI

  1. Install dependencies and build this repository:
bash
npm installnpm run build
  1. Create mern-mcp.config.json in the target MERN project you want to scaffold.
  2. Add the MCP server to Codex CLI:
bash
codex mcp add mern-mcp --command node --args /absolute/path/to/mern-mcp/dist/index.js --project-root /absolute/path/to/project
  1. Confirm the MCP server is listed in Codex.
  2. Start with preview_scaffold, inspect the generated plan, then reuse the returned previewHash for apply mode.

Run With Docker

You can run mern-mcp in Docker if you do not want to install Node.js directly on the host.

  1. Build the image from this repository:
bash
docker build -t mern-mcp .
  1. Make sure the target MERN project contains mern-mcp.config.json.
  2. Run the container and mount the target project into it:
bash
docker run --rm -i \  -v /absolute/path/to/target-project:/workspace \  mern-mcp \  --project-root /workspace
  1. If you want to register the Dockerized server in an MCP client, use Docker as the command and pass the same arguments.

Example shape:

bash
docker run --rm -i -v /absolute/path/to/target-project:/workspace mern-mcp --project-root /workspace

MCP Tools

The server currently registers these tools:

  • preview_scaffold
  • scaffold_resource
  • list_resources
  • add_field
  • delete_resource

preview_scaffold

Dry-run a scaffold and inspect the generated write plan before changing files.

scaffold_resource

Preview or apply a full MERN CRUD scaffold for a resource.

list_resources

List manifest-managed resources and optionally scan for unmanaged resources in the project.

add_field

Preview or apply a new field on an existing generated resource.

delete_resource

Preview 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" mode
  • conflictStrategy: "abort", "overwrite", or "skip"

Example Resource Input

Example preview request for a product resource:

json
{  "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.

Supported Project Styles

mern-mcp supports configurable MERN code generation across these dimensions:

  • project structure: monorepo or separate
  • language: typescript or javascript
  • React data stack: plain, react-query, redux, or axios
  • validation: zod, express-validator, both, or none
  • auth: jwt or none

It also supports configurable paths, so you can point generation to custom directories such as src/models, src/routes, src/components, or src/store.ts.

Natural Language or Explicit Fields

You can scaffold a resource in two ways:

  1. Pass an explicit field schema.
  2. Pass a natural-language description and let the planner infer fields.

Example natural-language input:

text
a blog post with title, body, author, tags

That 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:

  • string
  • number
  • boolean
  • date
  • objectId

Supported UI widget hints include:

  • text
  • textarea
  • number
  • checkbox
  • date
  • select
  • multiselect
  • tags

Safer Preview-First Workflow

One of the strongest parts of this repository is the preview/apply contract.

  • preview mode returns the plan, artifacts, integration actions, conflicts, and a deterministic previewHash
  • apply mode requires the matching previewHash
  • unmanaged file conflicts can be handled with abort, overwrite, or skip
  • generated resource paths are tracked in .mern-mcp-manifest.json

This gives AI tools and human operators a more controlled way to scaffold code without silently overwriting unrelated work.

Who This Project Is For

mern-mcp is a good fit for:

  • MERN stack developers who want faster resource scaffolding
  • AI-assisted coding workflows using MCP
  • agencies building repeated admin dashboards and CRUD back offices
  • startup teams shipping internal tools or SaaS control panels
  • TypeScript and JavaScript teams maintaining consistent conventions
  • developers who want generation plus integration, not just loose code templates

Search Intent and Keywords

People often look for projects like this using phrases such as:

  • MCP server for MERN stack
  • MERN stack CRUD generator
  • MongoDB Express React Node scaffolder
  • Mongoose model generator
  • Express API boilerplate generator
  • React Query CRUD generator
  • Redux CRUD scaffolder
  • AI code generator for MERN apps
  • local MCP tooling for full-stack JavaScript
  • full-stack TypeScript CRUD scaffolding

Those phrases are relevant here because this server directly generates those artifacts and integrations.

Geo-Relevant Discovery

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.

Why This Repo Can Rank for Relevant Searches

This repository is not just a template dump. It contains:

  • a runnable MCP server
  • typed input schemas with Zod
  • configurable project-path resolution
  • AST-based integration patchers for server and client registration
  • manifest-backed resource management
  • preview, apply, add-field, list, and delete workflows
  • tests and smoke coverage for the main lifecycle

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.

Development Checks

bash
npm run checknpm testnpm run buildnpm run smoke

License

MIT

来源:README.md,提交 25fb6d0

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。