Faker MCP Server
A Model Context Protocol (MCP) server that provides fake/mock data generation capabilities using the Faker.js library. Generate realistic test data for database seeding, API testing, demo applications, and development environments.
Read more about why and when to use this MCP server in my blog post.
Features
Basic Data Generation: Generate realistic person and company data with names, emails, addresses, and contact information
Structured Datasets: Create multi-entity datasets with referential integrity for complex testing scenarios
Custom Patterns: Generate data following custom patterns (regex, enum, format, range) for domain-specific requirements
Multi-locale Support: Generate data in English, French, German, Spanish, and Japanese
Reproducible Data: Seed-based generation for consistent test data
High Performance: Generate 1000+ records per second
MCP Protocol Compliant: Seamlessly integrates with MCP-compatible clients
Installation
Prerequisites
Node.js 18+ installed on your system
An MCP-compatible client (e.g., Claude Desktop, Cline, Cursor or any MCP client)
Quick Start
Add the Faker MCP server to the mcpServers section:
See the MCP Client Configurations section for detailed setup instructions for various MCP clients.
Available Tools
The Faker MCP Server provides four powerful tools for generating fake data:
1. generate-person
Generate realistic person data including names, emails, phone numbers, and addresses.
Parameters:
count(number, optional): Number of person records to generate (1-10,000, default: 1)locale(string, optional): Locale for generated data -en,fr,de,es,ja(default:en)seed(number, optional): Seed for reproducible generationincludeAddress(boolean, optional): Whether to include address information (default:true)includePhone(boolean, optional): Whether to include phone number (default:true)includeDateOfBirth(boolean, optional): Whether to include date of birth (default:false)
Example Usage:
Example Request (MCP protocol):
Sample Output:
2. generate-company
Generate realistic company data including names, industries, contact information, and addresses.
Parameters:
count(number, optional): Number of company records to generate (1-10,000, default: 1)locale(string, optional): Locale for generated data -en,fr,de,es,ja(default:en)seed(number, optional): Seed for reproducible generationincludeAddress(boolean, optional): Whether to include address information (default:true)includeWebsite(boolean, optional): Whether to include website URL (default:true)includeFoundedYear(boolean, optional): Whether to include founded year (default:false)includeEmployeeCount(boolean, optional): Whether to include employee count (default:false)
Example Usage:
Example Request (MCP protocol):
Sample Output:
3. generate-dataset
Generate structured datasets with multiple entity types and referential integrity between them.
Parameters:
schema(object, required): Dataset schema defining entities and relationshipsentities(object): Map of entity names to entity definitionscount(number): Number of records to generate for this entity (1-10,000)type(string): Entity type -person,company, orcustomfields(array, optional): List of fields to include (defaults to all)relationships(object, optional): Foreign key relationships to other entitiesreferences(string): Name of the parent entitytype(string): Relationship type -one-to-manyormany-to-manynullable(boolean, optional): Whether the foreign key can be null (default:false)
locale(string, optional): Locale for generated data -en,fr,de,es,ja(default:en)seed(number, optional): Seed for reproducible generation
Example Usage:
Example Request (MCP protocol):
Sample Output:
4. generate-custom
Generate data following custom patterns including regex patterns, enums, formats, and ranges.
Parameters:
count(number, optional): Number of records to generate (1-10,000, default: 1)patterns(object, required): Map of field names to pattern definitionstype(string): Pattern type -regex,enum,format, orrangevalue: Pattern value (depends on pattern type):regex: Regular expression string (e.g.,"PRD-[0-9]{4}-[A-Z]{2}")enum: Array of string values to choose from (e.g.,["pending", "active", "completed"])format: Template string with placeholders (e.g.,"REF-{{year}}-{{random:5}}")range: Object withminandmaxnumeric values (e.g.,{"min": 10, "max": 1000})
locale(string, optional): Locale for generated data - affects format-based patterns (default:en)seed(number, optional): Seed for reproducible generation
Example Usage:
Example Request (MCP protocol):
Sample Output:
Common Use Cases
Database Seeding
Generate realistic test data to populate development databases:
API Integration Testing
Create test payloads with realistic data structures:
UI Demo Data
Build demo environments with locale-specific data:
Performance Testing
Generate large volumes of data for load testing:
Best Practices
1. Use Seeds for Reproducibility
Always specify a seed when you need consistent test data across environments:
2. Choose Appropriate Locales
Match the locale to your target market for realistic data:
3. Batch Large Requests
For very large datasets, consider generating in batches:
4. Define Relationships Carefully
Ensure parent entities are generated before child entities:
Performance Expectations
Operation | Records | Expected Time | Memory Usage |
Generate Person | 100 | <100ms | <5MB |
Generate Person | 1,000 | <1s | <50MB |
Generate Person | 10,000 | <10s | <100MB |
Generate Company | 100 | <100ms | <5MB |
Generate Dataset | 1,000 total | <2s | <50MB |
Generate Custom | 1,000 | <1s | <30MB |
Performance may vary based on system resources and pattern complexity.
Error Handling
The server follows MCP standard error response format. Common errors include:
Invalid Parameters (code: -32602):
Unsupported Locale (code: -32001):
Schema Validation Error (code: -32602):
MCP Client Configurations
Claude Desktop
Claude Desktop is an AI assistant application that supports MCP servers for extended functionality.
Configuration File Locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Configuration:
Alternative (using installed global package):
After configuration: Restart Claude Desktop. You can verify the connection by asking "What MCP tools are available?"
Cline (VS Code Extension)
Cline is a VS Code extension that brings AI assistance directly into your editor with MCP support.
Setup Steps:
Install the Cline extension from VS Code Marketplace
Open VS Code Settings (JSON) - Press
Cmd/Ctrl + Shift + P→ "Preferences: Open User Settings (JSON)"Add the MCP server configuration:
Alternative (workspace-specific configuration):
Create or edit .vscode/settings.json in your project:
After configuration: Reload VS Code window or restart Cline extension.
Continue (VS Code Extension)
Continue is an open-source AI code assistant for VS Code with MCP support.
Configuration File Location: ~/.continue/config.json (or workspace-specific .continue/config.json)
Configuration:
After configuration: Restart the Continue extension or reload VS Code.
Zed Editor
Zed is a high-performance code editor with built-in AI and MCP support.
Configuration File Location: ~/.config/zed/settings.json
Configuration:
After configuration: Restart Zed editor.
MCP Inspector (Development/Testing)
MCP Inspector is an official debugging tool for testing MCP servers during development.
Usage:
This will open a web interface at http://localhost:5173 where you can:
Discover all available tools
Test tool calls with custom parameters
View request/response logs
Validate MCP protocol compliance
Custom MCP Client (Generic Integration)
For any MCP-compatible client not listed above, use these configuration parameters:
Connection Parameters:
Command:
npx faker-mcp-server(orfaker-mcp-serverif installed globally)Transport:
stdio(standard input/output)Protocol: MCP (Model Context Protocol)
Environment: Node.js 18+ required
Generic JSON Configuration:
Using Absolute Path (when npx is not available):
With Custom Node Path:
Docker Container
For containerized environments or CI/CD pipelines:
Dockerfile:
Build and Run:
Docker Compose (for integration with other services):
Programmatic Usage (Node.js)
You can also use the MCP server programmatically in your Node.js applications:
Configuration Troubleshooting
Problem: "Command not found: faker-mcp-server"
Solutions:
Use
npx faker-mcp-serverinstead offaker-mcp-serverInstall globally first:
npm install -g faker-mcp-serverUse absolute path to the binary
Problem: "MCP server connection timeout"
Solutions:
Verify Node.js 18+ is installed:
node --versionCheck if server starts manually:
npx faker-mcp-serverReview client logs for specific error messages
Ensure no firewall/antivirus blocking Node.js processes
Problem: "Invalid JSON response from server"
Solutions:
Ensure transport is set to
stdio(nothttporsse)Check Node.js version compatibility (requires 18+)
Verify no other process is using stdio streams
Platform-Specific Notes
macOS:
Configuration files typically in
~/Library/Application Support/Use Homebrew for Node.js:
brew install node@18
Windows:
Configuration files typically in
%APPDATA%\or%USERPROFILE%\.config\Use Node.js installer from nodejs.org or
nvm-windowsUse forward slashes or escaped backslashes in JSON paths
Linux:
Configuration files typically in
~/.config/Use nvm for Node.js version management
Ensure execute permissions:
chmod +x /path/to/faker-mcp-server
Troubleshooting
"MCP server not found"
Cause: Server not properly installed or configured.
Solution:
Verify installation:
npm list -g faker-mcp-serverCheck MCP client configuration file for correct command
Restart MCP client after configuration changes
"Invalid locale error"
Cause: Requested locale not supported.
Solution: Use one of the supported locales: en, fr, de, es, ja
"Request timeout for large datasets"
Cause: Generating >5000 records may take several seconds.
Solution:
Use smaller batch sizes
Be patient (10,000 records typically takes <10 seconds)
Check memory constraints if timeouts persist
"Referential integrity errors in dataset"
Cause: Schema defines relationships in wrong order or circular dependencies.
Solution:
Define parent entities before child entities
Avoid circular references
Validate schema before generation
Development
Setup
Scripts
npm run build- Build the project for productionnpm run dev- Build in watch mode for developmentnpm test- Run tests oncenpm run test:watch- Run tests in watch modenpm run test:coverage- Run tests with coverage reportnpm run lint- Lint the codenpm run lint:fix- Lint and fix issuesnpm run format- Format code with Prettiernpm run typecheck- Type-check without emitting
License
MIT
Author
Funs Janssen
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.