Documentation

fsds/claude-mcp-server-enhancements.md

MCP Server Enhancement Recommendations for Acsis Core

Executive Summary

This document outlines critical enhancements needed for the MCP (Model Context Protocol) server to effectively support AI agents in developing and migrating applications to the Acsis Core platform. The current implementation provides good structural overview but lacks operational details necessary for practical implementation guidance.

Current State Assessment

Working Well ✅

The current MCP server implementation successfully provides:

  1. Component Discovery

    • list_components() - Lists all 19 components with purposes
    • get_component_info() - Detailed component structure and entities
    • search_components() - Find components by functionality
    • get_component_dependencies() - View interdependencies
  2. API Exploration

    • search_endpoints() - Find endpoints across components
    • get_endpoint_details() - Basic endpoint information
    • get_api_models() - Data structure definitions
  3. Database Schema

    • get_database_schema() - Entity definitions
    • search_entities() - Find specific entities
    • get_entity_relationships() - Relationship mapping

Critical Gaps ❌

The following essential information is missing or incomplete:

  1. No Concrete Implementation Details

    • Missing request/response examples
    • No authentication flow documentation
    • Absent validation rules and constraints
  2. Lack of Business Logic Context

    • No workflow documentation
    • Missing state transition rules
    • Absent permission requirements
  3. No Error Handling Information

    • Missing error codes and meanings
    • No troubleshooting guidance
    • Absent recovery strategies
  4. Limited Testing Support

    • No ability to validate requests
    • Missing mock data examples
    • No sandbox environment information

Enhancement Recommendations

Priority 1: Essential Tools (Must Have)

1.1 Full OpenAPI Specification Access

def get_openapi_spec(component_name: str, version: str = "latest") -> dict:
    """
    Returns complete OpenAPI specification including examples
    
    Returns:
    {
        "openapi": "3.0.0",
        "servers": [...],
        "paths": {
            "/items": {
                "post": {
                    "requestBody": {
                        "examples": {...}
                    },
                    "responses": {
                        "200": {
                            "examples": {...}
                        }
                    }
                }
            }
        }
    }
    """

1.2 Authentication Documentation

def get_auth_flow(auth_type: str = "jwt") -> dict:
    """
    Returns complete authentication flow with examples
    
    Returns:
    {
        "flow_type": "jwt",
        "steps": [
            {
                "step": 1,
                "description": "Obtain credentials",
                "endpoint": "GET /token/authenticate",
                "example_request": {
                    "headers": {...},
                    "params": {...}
                },
                "example_response": {...}
            }
        ],
        "token_format": "Bearer {jwt}",
        "expiration": 3600,
        "refresh_process": {...}
    }
    """

1.3 Request/Response Examples

def get_endpoint_examples(
    component_name: str, 
    endpoint_path: str, 
    method: str
) -> dict:
    """
    Returns complete examples for an endpoint
    
    Returns:
    {
        "request": {
            "headers": {
                "Authorization": "Bearer eyJ...",
                "Content-Type": "application/json"
            },
            "body": {
                "assets": [
                    {"assetId": 123},
                    {"serialNumber": "SN456"}
                ],
                "targetLocationId": 789
            }
        },
        "responses": {
            "200": {
                "body": {"success": true, "movementId": 456},
                "headers": {...}
            },
            "400": {
                "body": {
                    "error": "INVALID_LOCATION",
                    "message": "Target location does not exist"
                }
            }
        }
    }
    """

Priority 2: Business Logic Tools (Should Have)

2.1 Workflow Documentation

def get_workflow(workflow_name: str) -> dict:
    """
    Returns complete workflow with API call sequence
    
    Example workflows:
    - asset_movement
    - shipment_creation
    - item_registration
    
    Returns:
    {
        "workflow": "asset_movement",
        "description": "Move assets between locations",
        "prerequisites": [...],
        "steps": [
            {
                "order": 1,
                "description": "Validate source location",
                "api_call": "GET /locations/{locationId}",
                "required_response": {...}
            },
            {
                "order": 2,
                "description": "Check asset availability",
                "api_call": "GET /items/{itemId}/active",
                "validations": [...]
            }
        ],
        "error_handling": {...}
    }
    """

2.2 Business Rules

def get_business_rules(component_name: str, operation: str) -> dict:
    """
    Returns business rules and constraints
    
    Returns:
    {
        "operation": "move_asset",
        "rules": [
            {
                "rule": "location_hierarchy",
                "description": "Assets can only move within same root location",
                "validation": "source.rootId == target.rootId"
            },
            {
                "rule": "status_requirement",
                "description": "Asset must be in 'Available' status",
                "validation": "asset.status in ['Available', 'In Transit']"
            }
        ],
        "permissions": ["ASSET_MOVE", "LOCATION_ACCESS"],
        "state_transitions": {...}
    }
    """

2.3 Validation Rules

def get_validation_rules(
    component_name: str, 
    model_name: str
) -> dict:
    """
    Returns validation rules for a data model
    
    Returns:
    {
        "model": "MoveAssetsRequest",
        "validations": [
            {
                "field": "assets",
                "rules": [
                    "required",
                    "min_items: 1",
                    "max_items: 100"
                ]
            },
            {
                "field": "targetLocationId",
                "rules": [
                    "required",
                    "exists_in: locations",
                    "accessible_by: current_user"
                ]
            }
        ]
    }
    """

Priority 3: Development Support Tools (Nice to Have)

3.1 Request Validator

def validate_request(
    component_name: str,
    endpoint_path: str,
    method: str,
    payload: dict
) -> dict:
    """
    Validates a request without executing it
    
    Returns:
    {
        "valid": false,
        "errors": [
            {
                "field": "assets[0].assetId",
                "error": "Asset ID 999 does not exist"
            },
            {
                "field": "targetLocationId",
                "error": "User lacks permission for location 456"
            }
        ],
        "warnings": [
            {
                "message": "Large batch size may impact performance"
            }
        ]
    }
    """

3.2 Error Catalog

def get_error_codes(component_name: str = None) -> dict:
    """
    Returns comprehensive error code documentation
    
    Returns:
    {
        "errors": [
            {
                "code": "ASSET_NOT_FOUND",
                "http_status": 404,
                "message_template": "Asset with ID {id} not found",
                "resolution": "Verify asset ID exists using GET /items/{id}",
                "component": "catalog"
            },
            {
                "code": "INVALID_MOVEMENT",
                "http_status": 400,
                "message_template": "Cannot move asset: {reason}",
                "common_reasons": [
                    "Asset is inactive",
                    "Source and target location are the same",
                    "User lacks permission"
                ],
                "resolution": "Check asset status and location permissions"
            }
        ]
    }
    """

3.3 Integration Test Helper

def get_test_scenario(scenario_name: str) -> dict:
    """
    Returns test data and expected outcomes
    
    Returns:
    {
        "scenario": "move_single_asset",
        "setup": {
            "create_test_asset": {
                "endpoint": "POST /items",
                "payload": {...}
            },
            "create_locations": [...]
        },
        "test_steps": [
            {
                "description": "Move asset to new location",
                "endpoint": "POST /movements",
                "payload": {...},
                "expected_response": {...}
            }
        ],
        "cleanup": [...]
    }
    """

Priority 4: Advanced Features (Future Enhancement)

4.1 Service Configuration

def get_service_config(environment: str = "development") -> dict:
    """
    Returns service URLs and configuration
    
    Returns:
    {
        "environment": "development",
        "services": {
            "catalog": {
                "base_url": "https://localhost:43443",
                "health_check": "/health",
                "api_docs": "/scalar"
            }
        },
        "auth_config": {...},
        "rate_limits": {...}
    }
    """

4.2 Code Generation

def generate_client_code(
    component_name: str,
    language: str,
    operations: list
) -> str:
    """
    Generates client code for specific operations
    
    Returns: Generated code as string
    """

4.3 Migration Assistant

def get_migration_mapping(
    old_system: str,
    operation: str
) -> dict:
    """
    Maps old system operations to new API calls
    
    Returns:
    {
        "old_operation": "moveAsset",
        "new_endpoints": [
            {
                "endpoint": "POST /movements",
                "field_mapping": {
                    "old_field": "new_field"
                }
            }
        ],
        "notes": [...]
    }
    """

Implementation Priority Matrix

Priority Enhancement Impact Effort Timeline
P1 OpenAPI Spec Access Critical Low Week 1
P1 Authentication Docs Critical Low Week 1
P1 Request Examples Critical Medium Week 1-2
P2 Workflow Docs High Medium Week 2-3
P2 Business Rules High Medium Week 2-3
P2 Validation Rules High Low Week 3
P3 Request Validator Medium High Week 4-5
P3 Error Catalog Medium Low Week 4
P3 Test Scenarios Medium Medium Week 5
P4 Service Config Low Low Future
P4 Code Generation Low High Future
P4 Migration Mapping Low High Future

Success Metrics

  1. Completeness: Agent can implement any API integration without external documentation
  2. Accuracy: 95%+ of generated code works on first attempt
  3. Efficiency: 50% reduction in development time for migrations
  4. Self-sufficiency: Zero need for human clarification on API usage

Example Usage Scenarios

Scenario 1: Mobile App Asset Movement

# Agent retrieves workflow
workflow = mcp.get_workflow("asset_movement")

# Gets authentication details
auth = mcp.get_auth_flow("jwt")

# Retrieves examples
examples = mcp.get_endpoint_examples("transport", "/movements", "POST")

# Validates request before sending
validation = mcp.validate_request("transport", "/movements", "POST", {
    "assets": [{"assetId": 123}],
    "targetLocationId": 456
})

Scenario 2: Error Handling Implementation

# Get all possible errors for movement operation
errors = mcp.get_error_codes("transport")

# Get business rules to prevent errors
rules = mcp.get_business_rules("transport", "move_asset")

# Generate error handling code
error_handling = mcp.generate_client_code(
    "transport", 
    "typescript", 
    ["error_handling"]
)

Conclusion

These enhancements will transform the MCP server from a structural reference tool into a comprehensive development assistant capable of guiding complete implementation of Acsis Core integrations. The prioritized approach ensures critical gaps are addressed first while building toward a fully self-sufficient development support system.

Next Steps

  1. Review and approve enhancement priorities
  2. Begin implementation with Priority 1 items
  3. Establish feedback loop with development teams
  4. Iterate based on real-world usage patterns
  5. Document lessons learned for future MCP implementations