Add viz-platform MCP server structure at mcp-servers/viz-platform/: - mcp_server/server.py: Main MCP server entry point with async initialization - mcp_server/config.py: Hybrid config loader with DMC version detection - mcp_server/dmc_tools.py: Placeholder for DMC validation tools - pyproject.toml and requirements.txt for dependencies - tests/ directory structure Server starts without errors with empty tool list. Config detects DMC installation status via importlib.metadata. Closes #170 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
73 lines
2.0 KiB
Python
73 lines
2.0 KiB
Python
"""
|
|
DMC (Dash Mantine Components) validation tools.
|
|
|
|
Provides component constraint layer to prevent Claude from hallucinating invalid props.
|
|
Tools implemented in Issue #172.
|
|
"""
|
|
import logging
|
|
from typing import Dict, List, Optional, Any
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class DMCTools:
|
|
"""
|
|
DMC component validation tools.
|
|
|
|
These tools provide the "constraint layer" that validates component usage
|
|
against a version-locked registry of DMC components.
|
|
"""
|
|
|
|
def __init__(self, registry=None):
|
|
"""
|
|
Initialize DMC tools with component registry.
|
|
|
|
Args:
|
|
registry: ComponentRegistry instance (from Issue #171)
|
|
"""
|
|
self.registry = registry
|
|
|
|
async def list_components(self, category: Optional[str] = None) -> Dict[str, Any]:
|
|
"""
|
|
List available DMC components, optionally filtered by category.
|
|
|
|
Args:
|
|
category: Optional category filter (e.g., "inputs", "buttons", "navigation")
|
|
|
|
Returns:
|
|
Dict with components grouped by category
|
|
"""
|
|
# Implementation in Issue #172
|
|
raise NotImplementedError("Implemented in Issue #172")
|
|
|
|
async def get_component_props(self, component: str) -> Dict[str, Any]:
|
|
"""
|
|
Get props schema for a specific component.
|
|
|
|
Args:
|
|
component: Component name (e.g., "Button", "TextInput")
|
|
|
|
Returns:
|
|
Dict with props, types, defaults, and enum values
|
|
"""
|
|
# Implementation in Issue #172
|
|
raise NotImplementedError("Implemented in Issue #172")
|
|
|
|
async def validate_component(
|
|
self,
|
|
component: str,
|
|
props: Dict[str, Any]
|
|
) -> Dict[str, Any]:
|
|
"""
|
|
Validate component props against registry.
|
|
|
|
Args:
|
|
component: Component name
|
|
props: Props to validate
|
|
|
|
Returns:
|
|
Dict with valid: bool, errors: [], warnings: []
|
|
"""
|
|
# Implementation in Issue #172
|
|
raise NotImplementedError("Implemented in Issue #172")
|