React Patterns MCP Server
Provides React design and rendering patterns from patterns.dev as MCP tools and resources for Claude Code.
README
React Patterns MCP Server v2
A comprehensive MCP (Model Context Protocol) server that teaches and applies React architecture, design patterns, and best practices ā covering everything from patterns.dev/react.
Built in TypeScript / Node.js for use with Claude Code.
Features
| Category | Tools |
|---|---|
| Pattern Reference | All patterns.dev/react patterns with full details, comparisons, recommendations |
| Code Analyzer | Detect anti-patterns and suggest refactors in existing React code |
| Template Engine | Ready-to-use TypeScript code templates per pattern |
| Scaffold | Generate project skeleton based on architecture + patterns |
| Architecture Doc | ADR generator that recommends patterns for your project |
| Live Docs | Fetch docs.react.dev + React version-aware API guidance |
| Mobile | Tailwind responsive patterns + React Native layouts |
| Memory | Persist project state between sessions |
| Task Planner | Break goals into parallelisable subtasks for Claude subagents |
| Token Optimizer | Compress outputs, manage response cache |
Covered Patterns
šØ Design Patterns
| ID | Pattern |
|---|---|
hoc-pattern |
Higher-Order Component (HOC) |
hooks-pattern |
Hooks Pattern |
compound-pattern |
Compound Pattern |
container-presentational-pattern |
Container / Presentational |
render-props-pattern |
Render Props |
observer-pattern |
Observer / Pub-Sub (Zustand) |
provider-pattern |
Provider (React Context) |
prototype-pattern |
Prototype / Object Pool |
module-pattern |
Module / Feature Slice |
singleton-pattern |
Singleton (API clients, stores) |
āļø Rendering Patterns
| ID | Pattern |
|---|---|
client-side-rendering |
CSR (Vite SPA, dashboards) |
server-side-rendering |
SSR (Next.js per-request) |
static-rendering |
SSG (Next.js build-time) |
incremental-static-rendering |
ISR (stale-while-revalidate) |
progressive-hydration |
Progressive Hydration |
streaming-ssr |
Streaming SSR |
react-server-components |
RSC (Next.js App Router) |
selective-hydration |
Selective Hydration (React 18) |
ā” Performance Patterns
| ID | Pattern |
|---|---|
dynamic-import |
Dynamic Import / Code Splitting |
import-on-visibility |
Import on Visibility (IntersectionObserver) |
import-on-interaction |
Import on Interaction (defer until click/hover) |
route-based-splitting |
Route-Based Code Splitting |
bundle-splitting |
Bundle Splitting / Vendor Chunking |
tree-shaking |
Tree Shaking (dead-code elimination) |
preload |
Preload Critical Resources |
prefetch |
Prefetch Next-Page Resources |
prpl-pattern |
PRPL Pattern (PWA loading strategy) |
Tool Reference
| Tool | Description |
|---|---|
list_all_patterns |
All patterns grouped by category |
list_performance_patterns |
Performance patterns only |
get_pattern |
Full detail + code example for a pattern |
compare_patterns |
Side-by-side comparison of 2ā5 patterns |
find_pattern_for_use_case |
Describe a problem, get pattern recommendations |
ask_architecture_preference |
Call this first ā shows architecture options |
scaffold_project |
Generate project skeleton |
analyze_code |
Detect anti-patterns in React code |
get_code_template |
Ready-to-use TypeScript code template |
generate_architecture_doc |
ADR ā which patterns and why for your project |
fetch_react_docs |
Live fetch from docs.react.dev with version guidance |
save_memory / get_memory |
Persist and recall project context across sessions |
create_task_plan |
Break a goal into parallelisable subtasks |
compress_output |
Compress verbose responses to save tokens |
Installation
Prerequisites
- Node.js 20+
- npm or pnpm
Setup
git clone https://github.com/1beyza/react-patterns-mcp.git
cd react-patterns-mcp
npm install
npm run build
Add to Claude Code
In your project's .claude/mcp.json (or global ~/.claude/mcp.json):
{
"mcpServers": {
"react-patterns": {
"command": "node",
"args": ["/absolute/path/to/react-patterns-mcp/dist/index.js"]
}
}
}
Or run directly for testing:
npm run dev # tsx (no build needed)
Usage Workflows
New Project
1. create_task_plan ā break the goal into subtasks
2. generate_architecture_doc ā get pattern recommendations + ADR
3. scaffold_project ā generate directory structure + setup commands
4. get_code_template ā get starter code for each essential pattern
5. save_memory ā persist architecture choices
Existing Project Improvement
1. analyze_code ā detect issues and pattern opportunities
2. compare_patterns ā compare alternatives
3. suggest_refactor ā get a refactor plan toward a target pattern
4. get_code_template ā get the target pattern's starter code
Quick Pattern Lookup
list_all_patterns ā browse everything
get_pattern <id> ā full details + code example
find_pattern_for_use_case ā describe your problem, get recommendations
Architecture
react-patterns-mcp/
āāā src/
ā āāā index.ts # MCP server entry ā registers all tools
ā āāā tools/ # Tool layer ā MCP tool handlers
ā ā āāā index.ts # Barrel export
ā ā āāā pattern-tools.ts # Pattern query / compare / recommend
ā ā āāā scaffold-tools.ts # Project scaffolding
ā ā āāā analyzer-tools.ts # Code analysis + refactor suggestions
ā ā āāā template-tools.ts # Code template retrieval
ā ā āāā architecture-tools.ts # ADR generation
ā ā āāā docs-tools.ts # Live React docs + version guidance
ā ā āāā mobile-tools.ts # Mobile / responsive patterns
ā ā āāā memory-tools.ts # Project state persistence
ā ā āāā task-planner-tools.ts # Subtask decomposition
ā ā āāā token-optimizer-tools.ts # Output compression + cache
ā āāā data/ # Data layer ā pure data, no MCP logic
ā ā āāā patterns.ts # All design & rendering pattern definitions
ā ā āāā templates.ts # Code templates per pattern
ā ā āāā mobile-patterns.ts # Mobile responsiveness patterns
ā āāā utils/ # Utility layer ā shared functions
ā āāā validator.ts # Zod schemas for all tool inputs
ā āāā formatter.ts # Markdown output formatting
ā āāā cache.ts # TTL response cache
ā āāā file-io.ts # Memory persistence (JSON files)
āāā memory/ # Runtime project memory (gitignored)
āāā dist/ # Compiled JavaScript output
āāā package.json
āāā tsconfig.json
āāā README.md
Layer rules:
data/ā pure data objects, no side effectsutils/ā pure functions and shared helpers, no MCP awarenesstools/ā MCP tool handlers; validate with Zod, call data/utils, return stringsindex.tsā MCP protocol binding only; no business logic
All MCP Tools
| Tool | Description |
|---|---|
list_all_patterns |
List all patterns with summaries |
list_design_patterns |
List design patterns only |
list_rendering_patterns |
List rendering patterns only |
get_pattern |
Full details + code example for a pattern |
compare_patterns |
Side-by-side comparison of 2ā5 patterns |
find_pattern_for_use_case |
Describe your problem ā get recommendations |
get_related_patterns |
Patterns related to a given pattern |
get_pattern_tradeoffs |
Quick pros/cons for a pattern |
scaffold_project |
Generate full project scaffold |
analyze_code |
Detect anti-patterns in React code |
suggest_refactor |
Refactor plan toward a target pattern |
get_code_template |
Get ready TypeScript code for a pattern |
list_templates |
List all available code templates |
generate_architecture_doc |
ADR with pattern recommendations |
fetch_react_docs |
Live docs.react.dev content |
get_react_version_guidance |
Version-specific API guidance |
get_mobile_pattern |
Mobile/responsive pattern details |
get_tailwind_responsive_cheatsheet |
Tailwind responsive design guide |
save_memory |
Persist project state to disk |
get_memory |
Retrieve saved project state |
clear_memory |
Delete project memory |
list_project_memory |
List all projects with saved state |
create_task_plan |
Break a goal into parallelisable subtasks |
compress_output |
Reduce token cost of verbose output |
get_cache_stats |
View response cache statistics |
clear_caches |
Clear all response caches |
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.