Skip to main content

MCP Server

MCP (Model Context Protocol) Server for the MBC CQRS Serverless framework. This package enables interaction with the framework through tools like Claude Code and Cursor.

What is MCP?

Model Context Protocol (MCP) is a protocol for AI tools to interact with applications and frameworks in a standardized way. It provides three main concepts: Resources, Tools, and Prompts.

Features

Resources

Access framework documentation and project information.

Resource URIDescription
mbc://docs/overviewComplete framework documentation
mbc://docs/llms-shortConcise framework overview
mbc://docs/architectureCQRS architecture guide
mbc://docs/errorsError catalog with solutions
mbc://docs/faqFrequently asked questions
mbc://docs/troubleshootingTroubleshooting guide
mbc://docs/securitySecurity best practices
mbc://project/entitiesList of project entities
mbc://project/modulesList of project modules
mbc://project/structureProject directory structure

Tools

Provides code generation and project analysis tools.

ToolDescription
mbc_generate_moduleGenerate a complete CQRS module
mbc_generate_controllerGenerate a controller
mbc_generate_serviceGenerate a service
mbc_generate_entityGenerate an entity
mbc_generate_dtoGenerate a DTO
mbc_validate_cqrsValidate CQRS pattern implementation
mbc_analyze_projectAnalyze project structure
mbc_lookup_errorLook up error solutions
mbc_check_anti_patternsCheck code for common anti-patterns
mbc_health_checkPerform project health check
mbc_explain_codeExplain code in MBC context

Prompts

Provides guided assistance.

PromptDescription
cqrs_implementation_guideStep-by-step CQRS implementation
debug_command_errorDebug command-related errors
migration_guideVersion migration guidance

Installation

npm install @mbc-cqrs-serverless/mcp-server

Or use directly with npx:

npx @mbc-cqrs-serverless/mcp-server

Configuration

Claude Code

Add the following configuration to ~/.claude/claude_desktop_config.json:

{
"mcpServers": {
"mbc-cqrs-serverless": {
"command": "npx",
"args": ["@mbc-cqrs-serverless/mcp-server"],
"env": {
"MBC_PROJECT_PATH": "/path/to/your/project"
}
}
}
}

Cursor

Add to Cursor MCP configuration:

{
"mbc-cqrs-serverless": {
"command": "npx",
"args": ["@mbc-cqrs-serverless/mcp-server"],
"env": {
"MBC_PROJECT_PATH": "/path/to/your/project"
}
}
}

Environment Variables

VariableDescriptionDefault
MBC_PROJECT_PATHPath to project directoryCurrent working directory

Usage Examples

Module Generation

You can ask Claude Code:

"Generate a new Order module with async command handling"

Project Analysis

Analyze project structure.

"Analyze my project structure"

Debug Assistance

Get help debugging errors.

"I'm getting a version mismatch error, help me debug"

Code Analysis Tools

Version Note

Code analysis tools (mbc_check_anti_patterns, mbc_health_check, mbc_explain_code) were added in version 1.0.22.

Anti-Pattern Detection

Version Note

AP011–AP015 were added in v1.2.x (publishSync null check, deprecated APIs, TaskModule duplication). AP016–AP020 were added in v1.2.5. AP021 (event emit after publishAsync) was added in v1.2.6. AP022–AP025 (eval, shell injection, HTTP timeout, sensitive logging) were added in v1.2.7.

The mbc_check_anti_patterns tool detects common code issues. The detector emits detector AP codes (this table), which use a separate numbering system from the skill-doc AP codes in /mbc-review skill. The detector output annotates each hit with the corresponding skill-doc code, e.g. AP005: Hardcoded Tenant (skill-doc: AP002). Only AP016–AP019 and AP021 share the same code in both systems.

Detector CodeNameSeveritySkill-doc Code
AP001Direct DynamoDB WriteCriticalAP012
AP002Ignored Version MismatchHighAP005
AP003N+1 Query PatternHigh
AP004Full Table ScanHigh
AP005Hardcoded TenantCriticalAP002
AP006Missing Tenant ValidationCriticalAP002
AP007Throwing in Sync HandlerHigh
AP008Hardcoded SecretCritical
AP009Manual JWT ParsingCritical
AP010Heavy Module ImportMedium
AP011Deprecated Method Usage (publish())HighAP010
AP012Uppercase COMMON Tenant Key (pre-v1.1.0)Critical
AP013publishSync Null Return Unchecked (v1.2.0+)HighAP001
AP014Deprecated genNewSequence (v1.2.0)HighAP010
AP015Duplicate TaskModule.register() (v1.2.4)High
AP016Missing Error Logging Before RethrowHighAP016
AP017Incorrect Attribute Merging on Partial UpdateHighAP017
AP018Missing Swagger DocumentationLowAP018
AP019Missing Pagination in List QueriesHighAP019
AP020Missing getCommandSource for TracingLowAP011
AP021Event Emit Directly After publishAsync in CommandServiceHighAP021
AP022Use of eval() or Function() ConstructorCritical
AP023Shell Command Built from String ConcatenationCritical
AP024HTTP Request Without TimeoutMedium
AP025Logging process.env or full request objectHigh

Health Check

The mbc_health_check tool verifies project configuration:

  • MBC framework packages installation
  • NestJS dependencies
  • TypeScript configuration
  • Environment file setup
  • Source directory structure
  • Serverless configuration

Code Explanation

The mbc_explain_code tool analyzes code and explains:

  • NestJS module structure and imports
  • REST controller endpoints
  • Service patterns and dependencies
  • Entity definitions and DynamoDB keys
  • CQRS command publishing patterns
  • Data sync handler behavior

Claude Code Skills

Version Note

Claude Code Skills were added in version 1.0.24.

Claude Code Skills provide guided assistance for MBC CQRS Serverless development. Skills are specialized prompts that help developers with common tasks.

Available Skills

SkillDescription
/mbc-generateGenerate boilerplate code (modules, services, controllers, DTOs, handlers)
/mbc-reviewReview code for best practices and anti-patterns (21 patterns)
/mbc-migrateGuide version migrations and breaking changes
/mbc-debugDebug and troubleshoot common issues

Installing Skills

The easiest way to install skills is using the MBC CLI:

# Install to personal skills directory (available in all projects)
mbc install-skills

# Install to project directory (shared with team via git)
mbc install-skills --project

# List available skills
mbc install-skills --list

# Force overwrite existing skills
mbc install-skills --force

Manual Installation

Alternatively, copy them manually to your Claude Code skills directory:

# Copy to personal skills (available in all projects)
cp -r node_modules/@mbc-cqrs-serverless/mcp-server/skills/* ~/.claude/skills/

# Or copy to project skills (shared with team)
cp -r node_modules/@mbc-cqrs-serverless/mcp-server/skills/* .claude/skills/

/mbc-generate Skill

Generates boilerplate code following MBC CQRS Serverless best practices.

Core Templates:

  • Module, Controller, Service, DTOs, DataSyncHandler

Additional Templates:

  • Event Handler for custom event processing
  • Query Handler for complex searches
  • Elasticsearch Sync Handler
  • GraphQL Resolver

Example Usage:

/mbc-generate
Create an Order module with RDS synchronization

/mbc-review Skill

Reviews code for MBC CQRS Serverless best practices and identifies anti-patterns.

Anti-Patterns Detected (21 patterns):

These are the skill-doc AP codes used in /mbc-review reviews and human-facing documentation. They use a separate numbering system from the detector AP codes emitted by the mbc_check_anti_patterns tool. See the Anti-Pattern Detection table above for the detector→skill-doc mapping. AP021 was added in v1.2.6.

CodeDescriptionSeverity
AP001Using publishSync instead of publishAsyncWarning
AP002Missing tenantCode in multi-tenant operationsError
AP003Hardcoded version numbersError
AP004Missing DataSyncHandler registrationError
AP005Not handling ConditionalCheckFailedExceptionWarning
AP006Using wrong PK/SK formatError
AP007Missing invokeContext in service methodsError
AP008Not using generateId for entity IDsWarning
AP009Missing DTO validation decoratorsWarning
AP010Deprecated method usageWarning
AP011Missing getCommandSource for tracingWarning
AP012Direct DynamoDB access instead of DataServiceWarning
AP013Missing type declaration in DataSyncHandlerError
AP014Not using DetailKey typeInfo
AP015Hardcoded table namesWarning
AP016Missing error loggingWarning
AP017Incorrect attribute mergingError
AP018Missing Swagger documentationInfo
AP019Not handling pagination correctlyWarning
AP020Circular module dependenciesError
AP021Emitting events directly in CommandService after publishAsyncError

Example Usage:

/mbc-review
Review the code in src/order/order.service.ts

/mbc-migrate Skill

Guides version migrations for MBC CQRS Serverless framework.

Features:

  • Version migration matrix (v1.0.16 to v1.0.23)
  • Detailed migration guides for each version
  • Deprecated API migration instructions
  • Migration checklist (before, during, after)
  • Version compatibility matrix

Example Usage:

/mbc-migrate
I need to upgrade from v1.0.20 to v1.0.23

/mbc-debug Skill

Helps debug and troubleshoot issues in MBC CQRS Serverless applications.

Features:

  • Error code quick lookup
  • 6 debugging workflows (Command, ConditionalCheckFailedException, DataSyncHandler, Tenant, Import, Performance)
  • CloudWatch log queries
  • Local development debugging (LocalStack, Serverless Offline)
  • Troubleshooting decision tree

Example Usage:

/mbc-debug
I'm getting ConditionalCheckFailedException errors