UNPKG

backend-mcp

Version:

Generador automático de backends con Node.js, Express, Prisma y módulos configurables. Servidor MCP compatible con npx para agentes IA. Soporta PostgreSQL, MySQL, MongoDB y SQLite.

408 lines 12.7 kB
{ "name": "blog-complete", "description": "Configuración completa para API de blog con autenticación, posts, comentarios y categorías", "version": "1.0.0", "steps": [ { "tool": "configure_project", "params": { "projectName": "blog-api", "description": "API completa para blog con autenticación, gestión de posts, comentarios y categorías", "author": "Mi Blog", "version": "1.0.0", "license": "MIT" } }, { "tool": "configure_database", "params": { "provider": "sqlite", "enableMigrations": true, "enableSeeding": true, "poolSize": 5 } }, { "tool": "define_table", "params": { "tableName": "User", "fields": [ {"name": "id", "type": "Int", "required": true, "unique": true}, {"name": "email", "type": "String", "required": true, "unique": true}, {"name": "password", "type": "String", "required": true}, {"name": "username", "type": "String", "required": true, "unique": true}, {"name": "displayName", "type": "String", "required": true}, {"name": "bio", "type": "String"}, {"name": "avatar", "type": "String"}, {"name": "role", "type": "String", "defaultValue": "author"}, {"name": "isActive", "type": "Boolean", "defaultValue": "true"}, {"name": "createdAt", "type": "DateTime", "defaultValue": "now()"}, {"name": "updatedAt", "type": "DateTime", "defaultValue": "now()"} ] } }, { "tool": "define_table", "params": { "tableName": "Category", "fields": [ {"name": "id", "type": "Int", "required": true, "unique": true}, {"name": "name", "type": "String", "required": true, "unique": true}, {"name": "description", "type": "String"}, {"name": "slug", "type": "String", "required": true, "unique": true}, {"name": "color", "type": "String", "defaultValue": "#3B82F6"}, {"name": "isActive", "type": "Boolean", "defaultValue": "true"}, {"name": "createdAt", "type": "DateTime", "defaultValue": "now()"} ] } }, { "tool": "define_table", "params": { "tableName": "Post", "fields": [ {"name": "id", "type": "Int", "required": true, "unique": true}, {"name": "title", "type": "String", "required": true}, {"name": "slug", "type": "String", "required": true, "unique": true}, {"name": "content", "type": "String", "required": true}, {"name": "excerpt", "type": "String"}, {"name": "featuredImage", "type": "String"}, {"name": "authorId", "type": "Int", "required": true}, {"name": "categoryId", "type": "Int", "required": true}, {"name": "status", "type": "String", "defaultValue": "draft"}, {"name": "publishedAt", "type": "DateTime"}, {"name": "viewCount", "type": "Int", "defaultValue": "0"}, {"name": "tags", "type": "Json"}, {"name": "seoTitle", "type": "String"}, {"name": "seoDescription", "type": "String"}, {"name": "createdAt", "type": "DateTime", "defaultValue": "now()"}, {"name": "updatedAt", "type": "DateTime", "defaultValue": "now()"} ], "relations": [ { "type": "oneToMany", "relatedTable": "User", "foreignKey": "authorId" }, { "type": "oneToMany", "relatedTable": "Category", "foreignKey": "categoryId" } ] } }, { "tool": "define_table", "params": { "tableName": "Comment", "fields": [ {"name": "id", "type": "Int", "required": true, "unique": true}, {"name": "content", "type": "String", "required": true}, {"name": "postId", "type": "Int", "required": true}, {"name": "authorId", "type": "Int"}, {"name": "authorName", "type": "String"}, {"name": "authorEmail", "type": "String"}, {"name": "parentId", "type": "Int"}, {"name": "status", "type": "String", "defaultValue": "pending"}, {"name": "createdAt", "type": "DateTime", "defaultValue": "now()"}, {"name": "updatedAt", "type": "DateTime", "defaultValue": "now()"} ], "relations": [ { "type": "oneToMany", "relatedTable": "Post", "foreignKey": "postId" }, { "type": "oneToMany", "relatedTable": "User", "foreignKey": "authorId" }, { "type": "oneToMany", "relatedTable": "Comment", "foreignKey": "parentId" } ] } }, { "tool": "define_table", "params": { "tableName": "Tag", "fields": [ {"name": "id", "type": "Int", "required": true, "unique": true}, {"name": "name", "type": "String", "required": true, "unique": true}, {"name": "slug", "type": "String", "required": true, "unique": true}, {"name": "description", "type": "String"}, {"name": "createdAt", "type": "DateTime", "defaultValue": "now()"} ] } }, { "tool": "setup_auth", "params": { "strategy": "jwt", "providers": ["local"], "jwtConfig": { "secret": "auto-generate", "expiresIn": "7d", "algorithm": "HS256" }, "roles": ["admin", "editor", "author", "subscriber"], "permissions": [ { "resource": "posts", "actions": ["create", "read", "update", "delete"], "roles": ["admin", "editor"] }, { "resource": "posts", "actions": ["create", "read", "update"], "roles": ["author"] }, { "resource": "posts", "actions": ["read"], "roles": ["subscriber"] }, { "resource": "comments", "actions": ["create", "read", "update", "delete"], "roles": ["admin", "editor"] }, { "resource": "comments", "actions": ["create", "read"], "roles": ["author", "subscriber"] }, { "resource": "categories", "actions": ["create", "read", "update", "delete"], "roles": ["admin", "editor"] }, { "resource": "categories", "actions": ["read"], "roles": ["author", "subscriber"] } ] } }, { "tool": "add_module", "params": { "moduleName": "crud", "config": { "entities": ["User", "Post", "Category", "Comment", "Tag"], "enableSoftDelete": true, "enablePagination": true, "enableFiltering": true, "enableSorting": true, "defaultPageSize": 10 } } }, { "tool": "add_module", "params": { "moduleName": "email", "config": { "provider": "smtp", "templates": ["welcome", "comment-notification", "post-published"], "enableQueue": true, "retryAttempts": 3 } } }, { "tool": "add_module", "params": { "moduleName": "validation", "config": { "enableRequestValidation": true, "enableResponseValidation": true, "strictMode": true } } }, { "tool": "setup_email", "params": { "provider": "smtp", "config": { "host": "smtp.gmail.com", "port": 587, "secure": false, "auth": { "user": "${EMAIL_USER}", "pass": "${EMAIL_PASS}" } }, "templates": [ { "name": "welcome", "subject": "¡Bienvenido a nuestro blog!", "htmlTemplate": "<h1>Bienvenido {{displayName}}</h1><p>Gracias por unirte a nuestra comunidad de blog.</p>", "textTemplate": "Bienvenido {{displayName}}. Gracias por unirte a nuestra comunidad de blog." }, { "name": "comment-notification", "subject": "Nuevo comentario en tu post: {{postTitle}}", "htmlTemplate": "<h1>Nuevo comentario</h1><p>{{authorName}} ha comentado en tu post '{{postTitle}}':</p><blockquote>{{content}}</blockquote>", "textTemplate": "Nuevo comentario de {{authorName}} en tu post '{{postTitle}}': {{content}}" }, { "name": "post-published", "subject": "Tu post '{{title}}' ha sido publicado", "htmlTemplate": "<h1>Post publicado</h1><p>Tu post '{{title}}' ha sido publicado exitosamente.</p>", "textTemplate": "Tu post '{{title}}' ha sido publicado exitosamente." } ] } }, { "tool": "setup_cache", "params": { "provider": "memory", "config": { "maxSize": "100mb" }, "defaultTTL": 1800, "strategies": [ { "key": "post-*", "ttl": 3600, "invalidateOn": ["post-update", "post-delete"] }, { "key": "category-*", "ttl": 7200, "invalidateOn": ["category-update", "category-delete"] }, { "key": "popular-posts", "ttl": 1800, "invalidateOn": ["post-update", "post-create"] } ] } }, { "tool": "create_endpoint", "params": { "path": "/api/posts/search", "method": "GET", "controller": "searchPosts", "middleware": ["validation", "cache"], "validation": { "query": { "q": {"type": "string", "required": true}, "category": {"type": "string"}, "tags": {"type": "array"}, "author": {"type": "string"}, "page": {"type": "number", "default": 1}, "limit": {"type": "number", "default": 10} } }, "requiresAuth": false } }, { "tool": "create_endpoint", "params": { "path": "/api/posts/popular", "method": "GET", "controller": "getPopularPosts", "middleware": ["cache"], "validation": { "query": { "period": {"type": "string", "enum": ["week", "month", "year"], "default": "month"}, "limit": {"type": "number", "default": 5} } }, "requiresAuth": false } }, { "tool": "create_endpoint", "params": { "path": "/api/posts/:id/publish", "method": "PATCH", "controller": "publishPost", "middleware": ["auth", "validation"], "validation": { "params": { "id": {"type": "number", "required": true} } }, "requiresAuth": true, "roles": ["admin", "editor", "author"] } }, { "tool": "create_endpoint", "params": { "path": "/api/comments/:id/approve", "method": "PATCH", "controller": "approveComment", "middleware": ["auth"], "validation": { "params": { "id": {"type": "number", "required": true} } }, "requiresAuth": true, "roles": ["admin", "editor"] } }, { "tool": "setup_monitoring", "params": { "enabled": true, "metrics": ["requests", "errors", "performance"], "alerts": [ { "metric": "error-rate", "threshold": 3, "action": "log-warning" }, { "metric": "response-time", "threshold": 1500, "action": "log-warning" } ], "dashboards": false } }, { "tool": "setup_testing", "params": { "framework": "jest", "coverage": true, "testTypes": ["unit", "integration"], "mocking": true, "fixtures": true } }, { "tool": "validate_config", "params": { "strict": true, "checkDependencies": true, "validateSchemas": true } }, { "tool": "generate_project", "params": { "outputPath": "./generated-projects/blog-api", "installDependencies": true, "runMigrations": true, "generateDocs": true } } ] }