outlet-orm-mcp

omgbwa-yasse/outlet-orm-mcp

3.1

If you are the rightful owner of outlet-orm-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Outlet ORM MCP Server is a robust tool designed for generating, verifying, and managing data for Models, Controllers, and Migrations within the Outlet ORM framework.

Tools
5
Resources
0
Prompts
0

Outlet ORM MCP Server

A Model Context Protocol (MCP) server for generating, verifying, and managing data for Models, Controllers, and Migrations in Outlet ORM.

🔒 Version 2.1.0 - Enhanced security and performance optimizations

🚀 Features

🎨 Code Generation

  • Models: Automatic generation with relation support (hasOne, hasMany, belongsTo, belongsToMany, etc.)
  • Controllers: REST controller creation with all CRUD methods
  • Migrations: Migration generation with complete column and relation management

🔍 Verification and Analysis

  • Schema Verification: Compares Models with actual database
  • Relations Validation: Verifies consistency with foreign keys
  • Migration Status: Tracks applied and pending migrations
  • Controller Analysis: Checks code quality and best practices
  • Global Consistency Check: Complete project consistency analysis

💾 CRUD Data Operations

  • Data Query: Query with filters, sorting, and pagination
  • Record Creation: Insert with generated ID return
  • Update: Secure update with mandatory WHERE clause
  • Deletion: Secure delete with mandatory WHERE clause
  • Raw SQL Queries: Execute complex queries (JOINs, aggregations)
  • Schema Inspection: Analyze table structure (columns, indexes)

🔒 Security and Performance (v2.1.0)

  • SQL Injection Protection: Parameterized queries + strict identifier validation
  • Complete Validation: All table and column names validated
  • Schema Caching: 60s TTL for up to 90% performance improvement
  • Query Timeout: Protection against blocking (30s default)
  • Connection Management: Clean closure and leak prevention

📦 Installation

Prerequisites

  • Node.js >= 18.0.0
  • npm or yarn
  • Claude Desktop (for MCP server integration)

Step 1: Clone or Download

# Clone the repository
git clone https://github.com/omgbwa-yasse/outlet-orm-mcp.git
cd outlet-orm-mcp

Or download and extract the ZIP file.

Step 2: Install Dependencies

npm install

Step 3: Install Database Driver

Install the driver for your database:

# For MySQL/MariaDB
npm install mysql2

# For PostgreSQL
npm install pg

# For SQLite
npm install sqlite3

Step 4: Configure Claude Desktop

Locate Configuration File
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
Add MCP Server Configuration

Open the configuration file and add:

{
  "mcpServers": {
    "outlet-orm": {
      "command": "node",
      "args": [
        "/absolute/path/to/outlet-orm-mcp/index.js"
      ]
    }
  }
}

Windows Example:

Replace /absolute/path/to/outlet-orm-mcp/index.js with your actual path, like: C:\\wamp64_New\\www\\packages\\outlet-orm-mcp\\index.js

macOS/Linux Example:

Replace with your actual path, like: /Users/username/projects/outlet-orm-mcp/index.js

Note: No database credentials needed in config! You'll connect dynamically from Claude.

Step 5: Restart Claude Desktop

  1. Completely close Claude Desktop
  2. Reopen the application
  3. Look for the 🔌 icon to confirm the MCP server is connected

Step 6: Test the Connection

In Claude Desktop, try:

Connect to myapp database (MySQL at localhost:3306, user: root, password: secret)
List all tables in the database

Installation complete! See for detailed usage examples.

🛠️ Available Tools

Database Connection Management

ToolDescription
connect_databaseConnect to a database with a custom name
switch_connectionSwitch between active connections
list_connectionsList all active connections
disconnect_databaseDisconnect from a specific database
disconnect_allDisconnect all connections

Code Generation

ToolDescription
generate_model_fileGenerates a Model file with relations
generate_controller_fileGenerates a complete REST Controller
generate_migration_fileGenerates a table migration

Verification and Analysis

ToolDescription
verify_model_schemaVerifies Model ↔ Database consistency
verify_relationsValidates relations and foreign keys
verify_migration_statusChecks migration status
analyze_controllerAnalyzes Controller quality
check_consistencyComplete global verification

CRUD Operations

ToolDescription
query_dataQueries database with filters, sorting, and pagination
create_recordCreates a record (returns ID)
update_recordUpdates records (WHERE required)
delete_recordDeletes records (WHERE required)
execute_raw_sqlExecutes raw SQL queries
get_table_schemaRetrieves table structure

📖 Usage Examples

Connection Management

Connect to Multiple Databases
Connect to my_blog database (MySQL at localhost:3306, user: blog_user, password: blog_pass)
Connect to my_shop database (PostgreSQL at 192.168.1.100:5432, user: shop_user, password: shop_pass)
Connect to analytics database (SQLite at /data/analytics.db)
Switch Between Connections
Switch to my_blog connection
List all active connections
Use Specific Connection in Operations
Query users table from my_blog connection with limit 10
Create a record in products table on my_shop connection with data: {name: "Widget", price: 29.99}
Disconnect Databases
Disconnect from my_blog database
Disconnect all databases

Generating a Model with Relations

Create a Post model with:
- table posts
- fields: title (string), content (text), user_id (integer), published_at (datetime)
- belongsTo relation to User
- hasMany relation to Comment
- timestamps and softDeletes

Generating a Controller

Create a UserController for the User Model with all CRUD methods

Generating a Migration

Create a create_users_table migration with:
- id (primary key)
- name (string 255)
- email (string 255, unique)
- password (string 255)
- is_active (boolean, default true)
- timestamps

Consistency Verification

Verify the User model consistency with the database
Analyze the Post model relations and verify foreign keys
Perform a complete verification of the User model, its Controller, and migrations

CRUD Data Operations

Retrieve the first 10 active users sorted by creation date
Inspect the users table structure before generating the Model
Analyze data distribution to plan a migration

📂 Generated File Structure

your-project/
└── src/
    ├── models/
    │   ├── User.js
    │   └── Post.js
    ├── controllers/
    │   ├── UserController.js
    │   └── PostController.js
    └── database/
        └── migrations/
            ├── 20240315_120000_create_users_table.js
            └── 20240315_120500_create_posts_table.js

Note: All generated files are placed in the src/ directory following modern JavaScript best practices. You can customize the output path using the outputPath parameter.

🔍 Advanced Features

Complete Relation Support

  • hasOne - One-to-one relation
  • hasMany - One-to-many relation
  • belongsTo - Inverse relation
  • belongsToMany - Many-to-many relation
  • hasOneThrough - Relation through intermediate table
  • hasManyThrough - Relation through intermediate table
  • morphOne / morphMany - Polymorphic relations

Column Type Support

All MySQL/PostgreSQL types:

  • Text: string, text, mediumText, longText
  • Numbers: integer, bigInteger, decimal, float, double
  • Dates: date, datetime, timestamp, time, year
  • Booleans: boolean
  • JSON: json, jsonb
  • And more...

Validation and Security

  • ✅ Mass assignment vulnerability detection
  • ✅ Filename validation
  • ✅ Unguarded column verification
  • ✅ Error handling analysis in Controllers
  • ✅ Orphaned foreign key detection

🐛 Troubleshooting

"OUTLET_ORM_ROOT is required"

Make sure you have defined the environment variable in Claude Desktop configuration.

"Failed to connect to database"

Verify your connection credentials in the DB_* environment variables.

Generation Issues

  • Verify that the src/models/, src/controllers/, and src/database/migrations/ directories will be created automatically
  • Check write permissions in the project root directory
  • Consult logs for more details

📚 Documentation

🤝 Contributing

Contributions are welcome! See for more details.

📄 License

MIT

🔗 Useful Links


Developed with ❤️ for Outlet ORM