mcp-react-frontend
Allows AI agents to interact with Next.js projects, enforcing FSD architectural boundaries, validating naming conventions, and generating boilerplate for entities with API, types, schema, and converters.
Provides tools to analyze, validate, and scaffold React applications following Feature-Sliced Design conventions, enabling AI agents to enforce architectural rules and generate standardized entity structures.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
React MCP (Model Context Protocol) Frontend Server
A powerful Orchestration Core that enables AI agents to interact with React applications, enforcing Feature-Sliced Design (FSD) conventions through the Model Context Protocol.
Overview
The MCP React Frontend Server is a Model Context Protocol (MCP) implementation designed to act as an Orchestration Core and Architectural Hub for React/Next.js applications. It enforces Feature-Sliced Design (FSD) boundaries, semantic naming conventions, and project-specific constraints. The server interacts with MCP clients (like IDEs or agents) to validate code architecture, prevent structural entropy, and scaffold standardized FSD entities through deterministic rules rather than ephemeral prompts.
Related MCP server: Salt MCP
MCP Capabilities
Tools
analyze_projectDescription: Analyze project files for FSD violations and naming conventions.
Input:
files(array): File paths (relative to project root) as strings or{ path, imports }objects. FSD layer / private-import checks run only when imports are known.codeSnippets(array of objects, optional): Objects containingfileNameandcontentfor deep linter analysis; imports are extracted from the content automatically.
Output: JSON containing
status(SUCCESS/ERROR),summary(total errors/warnings),violationsarray,recommendationsarray and optionalnotes(e.g. when FSD import checks were skipped).Behavior: Delegates import analysis to
FsdAgentand code snippet analysis toLinterAgent. The combined violations are processed byRecommenderAgentto generate actionable fixes.
get_rulesDescription: Get project rules (fsd, naming, linter, structure, styles, patterns).
Input:
domain(optional),pattern(optional),includeDocs(boolean, optional) — inline referenced markdown docs.Output: JSON object detailing the project rules.
template/relatedDocsfields are rule doc ids.Behavior: Fetches configurations from
RulesProvider.
get_pattern_docDescription: Get a rule/pattern markdown doc (examples, prohibitions, anti-patterns) by id.
Input:
id(optional) — without it returns the list of available docs.Output: Markdown text of the doc.
scaffold_entityDescription: Generate a standardized FSD entity structure with API, types, schema, and converters.
Input:
name(string): The name of the entity.path(string): The target directory path (relative tosrc/entities).
Output: Text message confirming the creation of the architecture.
Behavior: Generates folders (
api/,types/,schema/,converters/,ui/) and boilerplate files including RTK Query services, Zod schemas, data converters, and a public API index.
Resources
rules://docs/{id}(text/markdown): every rule/pattern doc fromsrc/entities/rules/config/**/*.md. Docs are embedded at build time intorule-docs.generated.ts— runnpm run rules:docsafter editing any rules*.md(also runs automatically indev/build).
Architecture
The application is built on top of the Next.js App Router and the @modelcontextprotocol/sdk.
Main Modules
mcp-server.ts: The factory that creates theMcpServerinstance, registers tools, and bridges MCP SDK with internal logic.Agents:FsdAgent: Responsible for cross-import checking and FSD semantic layer isolation constraints.LinterAgent: Checks AST or string content against naming and structural rules.RecommenderAgent: Generates mitigation steps for detected violations.
Transport:
src/app/api/mcp/route.ts— stateless Streamable HTTP (WebStandardStreamableHTTPServerTransport, JSON responses). OnlyPOST(and CORSOPTIONS) is served;GET/DELETEanswer405because there are no sessions or server-sent streams. The legacy SSE transport (protocol 2024-11-05) was removed: MCP Inspector andmcp-remotespeak Streamable HTTP.
Data Flow
Request: MCP Client connects via
/api/mcp. Next.js routes the request.Processing: The HTTP transport translates the request into the
McpServer. For tool calls, the specific agent (FsdAgent,LinterAgent) is invoked.Response: Analysis results are aggregated, serialized to JSON and wrapped in an MCP content block.
External Dependencies
@modelcontextprotocol/sdk: Core MCP logic.next/react: Driving the API routes and web interface.zod: Schema validation.
Usage
Clients connect over stdio (local script) or Streamable HTTP (/api/mcp).
Connecting to MCP Clients (e.g., Antigravity)
Add the following to your mcp_config.json manually:
1. Local Stdio (Recommended)
Fastest and most stable for development. Uses the local script directly.
{
"mcpServers": {
"mcp-react-frontend-local": {
"command": "npx",
"args": ["-y", "tsx", "scripts/mcp-stdio.ts"],
"cwd": "D://<path_to_project_root>"
}
}
}2. Local HTTP
Connects over HTTP to a running server on localhost:3000. Requires mcp-remote.
{
"mcpServers": {
"mcp-react-frontend-http": {
"command": "npx",
"args": ["-y", "mcp-remote", "http://localhost:3000/api/mcp"]
}
}
}3. Remote
Production (Vercel):
{
"mcpServers": {
"mcp-react-frontend-remote": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://orchestrator.damir-karimov.com/api/mcp"]
}
}
}Fallback (Render):
Initial connection can takeup to 60 seconds due to server "warm-up" (cold start).
{
"mcpServers": {
"mcp-react-frontend-remote-fallback": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp-react-frontend.onrender.com/api/mcp"]
}
}
}Supported Rules & Patterns Scope
The MCP server enforces a highly deterministic, strict architectural contract defined in src/entities/rules/config/domains/*.json and src/entities/rules/config/patterns/*.json (aggregated by RulesProvider). The validation scope guarantees structural integrity across the following domains:
1. Feature-Sliced Design (FSD) Topology
Unidirectional Dependency Flow: Strictly validates import boundaries across
app→pages→widgets→features→entities→shared.Cross-Layer Isolation: Detects and prohibits private cross-imports, enforcing mandatory barrel-export (
index.ts) usage.
2. Semantic Naming & Typing Contracts
Pattern Enforcement: Mandates
kebab-casefor file systems.Type Prefixing/Suffixing: Validates strict prefixes (
Ifor interfaces,Tfor types,ENUM_for enums) and DTO backend suffixes (*Backend,-backend.interface.ts).Framework Awareness: Intelligently excludes Next.js App Router reserved files (
page,layout, etc.) and React hooks (use*) from generic naming constraints.
3. Structural Integrity & Boilerplate Constraints
Entity Anatomy: Rejects FSD entities missing mandatory internal sub-modules (
api,types,schema,converters,ui).File Fingerprinting: Validates extension semantics (
*.schema.ts,*.converters.ts,*.service.ts).
4. Code Quality & Safety (Linter)
Runtime Safety: Hard bans on
console.*usage andanytypes.TypeScript Strictness: Prohibits native TypeScript
enumusage (forcing object/const maps) and mandates strict typing.
5. UI & Design Token Constraints
Atomic Styling: Documents the recommended Tailwind utility families (
allowedUtilityPrefixes: colors via tokens, spacing/sizing via the scale, no arbitrary values). This is guidance for generated code, not a linter check.Color Palette Isolation: Strictly forbids raw Tailwind color primitives (e.g.,
slate,red,blue,emerald) and staticwhite/blackutilities, forcing the application to use semantic CSS variables and design tokens.Tailwind v4: Tokens live in
src/shared/styles/{globals,variables,theme}.css(@theme,@theme inline,@custom-variant dark); notailwind.config.ts.Class Merging: Mandates the
cnutility wrapper for dynamic class composition.
6. Implementation Protocol Validation
RTK Query: Validates API code-splitting via
injectEndpoints, centralized tags, and base queries.DTO Converters: Requires symmetric data transformation with operation-specific names (
mapOrdersToFrontend,mapCreateEntityToBackend, patternmap*ToFrontend|ToBackend) between network boundaries and domain models. Shared list contract:IPaginationRequest/IPaginationResponse.Zod Schemas: Validates payload schema definitions against strongly typed
i18nlocalization keys.Mocking (MSW): Ensures mock handlers are properly registered and isolated.
Error Boundaries: Validates the presence of
ErrorBoundarywrappers andwithErrorBoundaryHOCs on dynamic or volatile UI components.Theme Segregation: Controls the usage of
ThemeProvideranduseThemehooks for stable DOM synchronization.
Configuration
Environment Variables (read only in
src/shared/config/env/env.config.ts; copy.env.exampleto.env.local). Required ones fail the build with a clear message when missing — set them on Vercel and Render too:NEXT_PUBLIC_APP_URL(required) — canonical site URL for canonical/hreflang, sitemap, Open Graph and JSON-LD. Any other host (vercel.app, onrender.com, previews, localhost) getsX-Robots-Tag: noindex.NEXT_PUBLIC_CONTACT_EMAIL,NEXT_PUBLIC_CONTACT_TELEGRAM,NEXT_PUBLIC_CONTACT_LINKEDIN,NEXT_PUBLIC_CONTACT_GITHUB(required) — author contacts on the Creator page; the GitHub username also builds the repository link.NEXT_PUBLIC_GTM_ID— Google Tag Manager container; empty disables it. Fires on the canonical host only.GOOGLE_SITE_VERIFICATION,YANDEX_VERIFICATION— verification meta tags; empty — no tag.
Configs: Handled internally by
RulesProvider(FSD constraints).Secrets: Not defined in code.
Local Development
# 1. Install dependencies (.npmrc sets legacy-peer-deps: @vercel/analytics has an
# optional @sveltejs/kit peer that needs Vite 8, while vitest 3 pins Vite 7)
npm install
# 2. Build the project (TypeScript, Prettier check and Next.js build — does not modify files)
npm run build
# Tests: unit (vitest) and e2e against a production build (Playwright, JS disabled + axe)
npm test
npx playwright install chromium # once
npm run test:e2e
# 3. Start the application
npm run dev
# Server will be available at http://localhost:3000Requirements: Node.js 18+ (inferred from Next 14+), npm.
Limitations
Hardcoding: The scaffold tool implicitly hardcodes the
src/entities/prefix for generating files.Validation Constraints: There is no authentication (CORS
*); anyone with network access can call the tools. Inputs are bounded instead: request bodies are capped at 1 MB (413) andanalyze_projectlimits files, snippets and snippet length (src/features/mcp/lib/analyze-project.ts).Rate limiting: In-memory limits are meaningless on serverless instances. Configure a Vercel Firewall rate-limit rule for
/api/*in the project dashboard.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Research-backed lint + generation for agent context files (CLAUDE.md, AGENTS.md) + prompt enhancer.
Live React design-system APIs, patterns, and code validation so AI agents build real UI, not slop.
Enforces architectural invariants and code quality rules inside your AI agent's edit loop.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to automate Next.js development including project scaffolding, React component generation, API route creation, and full-stack application workflows with TypeScript and Tailwind CSS support.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to build React applications using JP Morgan Chase's Salt Design System by providing real-time access to component APIs, documentation, and accessibility guidelines. It supports tasks such as scaffolding new projects, building UI patterns, and converting Figma designs into Salt code via the Model Context Protocol.61ISC
- AlicenseNot gradedqualityDmaintenanceEnables scaffolding and managing Clean Architecture in Next.js projects, providing tools to initialize structure, create features with all layers, and validate architecture compliance.MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP-compatible clients to inspect Next.js codebases, analyze App Router and Pages Router structure, discover API routes, and audit build performance through controlled tools.MIT