DataForge MCP Server
DataForge is a production-ready MCP (Model Context Protocol) server that enables AI agents, such as Claude and Cursor, to generate realistic test data and seed databases while maintaining referential integrity. It supports PostgreSQL, MySQL, and SQLite databases.
🚀 Quick Start
Installation
- Clone or download this repository:
git clone https://github.com/yourusername/dataforge.git
cd dataforge
- Install the required dependencies:
pip install -r requirements.txt
- For database drivers, install the appropriate packages:
- PostgreSQL:
pip install psycopg2-binary - MySQL:
pip install pymysql - SQLite: Already included with Python
Basic Usage
Using MCP (Claude Desktop, Cursor)
Add the following to your claude_desktop_config.json file:
{
"mcpServers": {
"dataforge": {
"command": "python",
"args": ["server.py"],
"cwd": "/path/to/dataforge"
}
}
}
Replace /path/to/dataforge with the actual path to the directory containing server.py.
Using CLI
# Connect to database
python cli.py connect sqlite:///test.db
# Show database schema
python cli.py schema
# Seed a table with 50 rows
python cli.py seed users 50
# Seed with Russian locale
python cli.py seed users 100 --locale ru_RU
# Seed all tables
python cli.py seed-all 20
# List supported locales
python cli.py locales
# Create example configuration file
python cli.py init
# Apply configuration from YAML file
python cli.py apply dataforge.yml
Using YAML Configuration
Create a dataforge.yml file:
database:
url: "sqlite:///test.db"
tables:
users:
count: 100
locale: "en_US"
custom_values:
role: ["admin", "user", "moderator"]
status: ["active", "inactive"]
products:
count: 500
locale: "en_US"
orders:
count: 1000
locale: "en_US"
depends_on: ["users", "products"]
Then apply the configuration:
python cli.py apply dataforge.yml
✨ Features
- Smart Relations: Automatically detects foreign keys and ensures referential integrity by selecting valid primary keys from parent tables.
- Context-Aware Mapping: Uses intelligent heuristics to generate appropriate fake data based on column names and types (e.g., emails, names, addresses, dates).
- Bulk Inserts: Efficiently inserts large amounts of data using SQLAlchemy's bulk operations.
- Safety Limits: Maximum of 1000 rows per request to prevent timeouts and performance issues.
- Error Handling: Provides clear, understandable error messages instead of stack traces.
- Multi-Locale Support: Generate data in 15+ languages including English, Russian, German, French, Spanish, Japanese, Chinese, and more.
- CLI Interface: Full-featured command-line interface for standalone use.
- YAML Configuration: Define your data generation strategy in reusable YAML files.
- Custom Values: Specify custom value sets for specific columns.
📚 Documentation
MCP Tools
Once configured, the AI agent can use the following tools:
connect_db(db_url: str)
Connects to the database using the provided URL.
Example:
connect_db("sqlite:///test.db")
get_schema_summary()
Returns a list of tables in the database.
Example:
get_schema_summary()
seed_table(table_name: str, count: int = 10, locale: str = 'en_US', custom_values: dict = None)
Seeds the specified table with generated data.
Parameters:
table_name: The name of the table to seedcount: Number of rows to generate (max 1000)locale: Faker locale for data generation (default: 'en_US')custom_values: Dictionary mapping column names to lists of custom values
Example:
seed_table("users", 50, "en_US", {"role": ["admin", "user"]})
CLI Commands
# Connect to database
python cli.py connect <url>
# Show database schema
python cli.py schema [--format table|json]
# Seed a table
python cli.py seed <table> [count] [--locale <locale>] [--custom <json>]
# Seed all tables
python cli.py seed-all [count] [--locale <locale>]
# List supported locales
python cli.py locales
# Create example configuration
python cli.py init [--output <path>]
# Apply configuration
python cli.py apply <config_path>
Supported Locales
DataForge supports 15+ locales for generating realistic localized data:
en_US- English (United States)ru_RU- Russian (Russia)de_DE- German (Germany)fr_FR- French (France)es_ES- Spanish (Spain)uk_UA- Ukrainian (Ukraine)ja_JP- Japanese (Japan)zh_CN- Chinese (China)pt_BR- Portuguese (Brazil)it_IT- Italian (Italy)pl_PL- Polish (Poland)nl_NL- Dutch (Netherlands)ko_KR- Korean (Korea)tr_TR- Turkish (Turkey)ar_SA- Arabic (Saudi Arabia)
🔧 Data Generation Heuristics
DataForge uses context-aware mapping to generate appropriate fake data:
emailcolumns: Random email addressesphone/telcolumns: Phone numbersname/user/authorcolumns: Namesaddresscolumns: Full addressescitycolumns: City namescountrycolumns: Country namescompanycolumns: Company namescreated_at/updated_atcolumns: Recent datesprice/amount/totalcolumns: Decimal valuesis_active/statuscolumns: Booleans or status values- JSON columns: Dummy JSON objects
- Integer columns: Random integers
- Text columns: Random text
Table-Specific Logic
DataForge applies table-specific heuristics for common table patterns:
Users table:
name/usercolumns: Person namesemailcolumns: Email addresses
Orders table:
amount/total/pricecolumns: Decimal values (100.0 - 5000.0)datecolumns: Dates within the current yearstatuscolumns: Order statuses (pending, completed, cancelled, processing, shipped)
🔗 Referential Integrity
For foreign key columns, DataForge:
- Queries the parent table for existing primary keys (limited to 100)
- Randomly selects a valid key
- Raises an error if the parent table is empty
Important: Ensure parent tables are seeded before child tables, or use the seed-all command which handles dependencies automatically.
⚠️ Error Handling
Common error messages:
- "Not connected to database": Call
connect_dbfirst - "Parent table X is empty. Please seed it first.": Seed referenced tables first
- "Max 1000 rows per request": Reduce the count parameter
- "Unsupported locale": Use one of the supported locales
📖 Use Cases
1. Quick Testing
Generate test data for development:
python cli.py connect sqlite:///test.db
python cli.py seed-all 50
2. Localization Testing
Test your application with different locales:
python cli.py seed users 100 --locale ru_RU
python cli.py seed users 100 --locale ja_JP
3. CI/CD Integration
Use YAML configuration for reproducible test data:
database:
url: "postgresql://test:test@localhost/test_db"
tables:
users:
count: 100
locale: "en_US"
orders:
count: 500
locale: "en_US"
python cli.py apply test_config.yml
4. Custom Business Logic
Define custom values for specific business scenarios:
python cli.py seed users 50 --custom '{"role": ["admin", "moderator"], "status": ["active"]}'
🆚 Comparison with Alternatives
| Feature | DataForge | Factory Boy | Faker | Mockaroo |
|---|---|---|---|---|
| MCP Integration | ✅ | ❌ | ❌ | ❌ |
| Automatic FK Handling | ✅ | ❌ | ❌ | ✅ |
| Multiple Database Support | ✅ | ✅ | ❌ | ✅ |
| CLI Interface | ✅ | ❌ | ✅ | ✅ |
| YAML Configuration | ✅ | ❌ | ❌ | ✅ |
| Multi-Locale Support | 15+ | 1 | 100+ | 200+ |
| Open Source | ✅ | ✅ | ✅ | ❌ |
| AI Agent Integration | ✅ | ❌ | ❌ | ❌ |
DataForge's unique advantage: Seamless integration with AI agents through MCP protocol while maintaining referential integrity and providing a powerful CLI.
🔮 Roadmap
- ✅ Automatic table dependency resolution (Topological Sort)
- ✅ Data templates for common domains (E-commerce, CRM, HR)
- ✅ Support for complex data types (UUID, JSON, Arrays)
- ✅ Multi-locale support (15+ languages)
- Data validation against constraints
- Parallel data generation for large datasets
- Docker support
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This project is open-source and licensed under the MIT License.
📞 Support
If you encounter any issues or have questions, please use the GitHub Issues system:
- 🐛 Report a Bug: GitHub Issues
- 💡 Request a Feature: GitHub Issues
If you find this tool useful, please give it a ⭐️ on GitHub!
Made with ❤️ by the DataForge Team
Metadata
Release files for mcp-server-dataforge 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_server_dataforge-0.1.1.tar.gz | 24.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_server_dataforge-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.4 kB
Release files / mcp_server_dataforge-0.1.1.tar.gz
| Download URL | mcp_server_dataforge-0.1.1.tar.gz |
|---|---|
| Size | 24.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c397f403d4f53201dfe8dcc94a21f579845159dcac125156ee3687e74f42a42b
|
|
BLAKE2b-256 checksum How to use checksums |
ca388e7cbf02e6e9251040810ca1ed7ee09ea87d165b4d48dacfca6e70eac2e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Release files / mcp_server_dataforge-0.1.1-py3-none-any.whl
| Download URL | mcp_server_dataforge-0.1.1-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8435e59deb0ec1b473a81e0bd6e949d064736e5664a7e165fc850fa351243234
|
|
BLAKE2b-256 checksum How to use checksums |
26be45e86999632b24c7458d81a053c109ff35ae50f6b2159bcf0b30b7dd0393
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Security for mcp-server-dataforge 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.