The first formal Model Context Protocol (MCP) extension for semantic layers - standardizing how AI agents discover, validate, and query governed data with built-in quality gates.
Just as MCP Apps extended MCP with UI capabilities, this project extends MCP with semantic layer capabilities - enabling AI agents to:
- π Discover data by business terms (not technical names)
- π‘οΈ Validate quality before querying (trust gates)
- π€ Find relationships automatically (FK + semantic)
- π Access unified data (structured + unstructured)
- π― Get query templates (never execute directly)
# 1. Install
pip install -r requirements.txt
# 2. Configure AWS + DataZone
export AWS_REGION=us-east-1
export GLUE_CATALOG_ID=123456789012
export DATAZONE_DOMAIN_ID=dzd_xxxxxxxxxxxxx
export S3_BUCKET=my-semantic-layer-bucket
export TRUST_THRESHOLD=0.85
# 3. Run MCP Server
python semantic_layer_server.py
# 4. Test
python test_semantic_server.pySee DATAZONE_DEPLOYMENT_GUIDE.md for complete setup.
# 1. Install
pip install -r requirements.txt
# 2. Configure AWS (no DataZone)
export AWS_REGION=us-east-1
export GLUE_CATALOG_ID=123456789012
export S3_BUCKET=my-semantic-layer-bucket
export TRUST_THRESHOLD=0.85
# 3. Run MCP Server
python semantic_layer_server.pySee AWS_DEPLOYMENT_GUIDE.md for testing without DataZone.
This is a protocol extension with a reference implementation:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Protocol Extension β
β β’ Standard tool signatures (semantic/discover, etc.) β
β β’ _meta.semantic response format β
β β’ Trust Gate primitive β
β β’ Capability declaration β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Reference Implementation (AWS) β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Discovery β β Trust Gate β β Relationshipsβ β
β β Engine β β Enforcer β β Engine β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Backend Abstraction Layer β β
β β (IStructuredDataHandler, IUnstructuredDataHandler) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β DataZone β β AWS Glue β β Amazon S3 β β
β β (Business) β β (Technical) β β + Docs β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
β ββββββββββββββββ ββββββββββββββββ β
β β Textract β β Comprehend β β
β β (Optional) β β (Optional) β β
β ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Core AWS Services (Required):
- AWS Glue Data Catalog: Technical metadata, schema, partitions
- Amazon DataZone: Business glossaries, governance, subscriptions (RECOMMENDED)
- Amazon S3: Document storage
Optional AWS Services (Phase 2+):
- Amazon Textract: PDF text extraction (for content-based relationships)
- Amazon Comprehend: Entity extraction (for semantic relationships)
Note: Semantic layer returns query templates only - it does NOT execute queries. Query execution is the AI agent's responsibility.
- Protocol-Level Governance: Trust gates are part of the protocol, not application logic
- Business-First API: Agents search by business terms ("customer revenue"), not technical names
- Backend Agnostic: Clean abstraction layer - AWS is reference, works with any backend
- Never Execute: Semantic layer returns templates/plans, never executes queries
- Unified Data Model: Structured (tables) + Unstructured (documents) in one API
NEW: Inspired by Google Dataplex, Databricks, and Snowflake innovations:
- π€ AI-Generated Metadata: Auto-generate column descriptions, glossary terms, and LLM instructions using Amazon Bedrock
- π Auto-Generate Semantics: Infer metrics and dimensions from data automatically
- π― Verified Queries: Example queries that AI agents can trust
- π·οΈ Discovery Tags: Enhanced search with AI-suggested tags
See V0.2.0_ENHANCEMENTS.md for complete details.
The extension defines 8 standard tools that all semantic layer implementations should provide:
Discover assets by business terms, not technical names.
{
"search_query": "customer revenue",
"glossary_terms": ["customer", "revenue"],
"min_quality_score": 0.85
}Trust gate validation before querying.
{
"asset_id": "sales_db.customer_orders",
"operation": "read"
}Complete business metadata for an asset.
{
"asset_id": "sales_db.customer_orders",
"include_lineage": true
}Get query template with business context (never executes).
{
"asset_id": "sales_db.customer_orders",
"columns": ["customer_id", "total_amount"],
"include_related": true
}Find relationships between assets (FK + semantic).
{
"asset_id": "sales_db.customer_orders",
"relationship_types": ["foreign_key", "related_to"],
"max_depth": 2
}Search across structured and unstructured data.
{
"query": "customer complaints",
"asset_types": ["table", "document"],
"include_relationships": true
}Generate metadata automatically using AI.
{
"asset_id": "sales_db.customer_orders",
"use_data_profile": true,
"generate_llm_instructions": true
}Auto-generate semantic definitions for entire database.
{
"database": "sales_db",
"include_metrics": true,
"include_dimensions": true
}- Standard tool signatures
_meta.semanticresponse format- Capability declaration
- Trust Gate primitive
- Standard error codes
Business context is first-class:
- Business glossaries with definitions
- Business names (not just technical)
- Subscription-based access control
- Quality scores tracked over time
- Data lineage and impact analysis
Clean abstraction layer means:
- Easy to add Snowflake, Databricks, dbt
- Swap implementations without changing core
- Test with mock backends
- Comprehensive error handling
- Configuration management
- Type hints everywhere
- Full documentation
- Test suite included
- Trust gate is protocol-level
- Quality scores with every response
- Corrective actions when blocked
- Audit trail ready
Agent: "Show me customer revenue"
Semantic Layer: "Found 2 assets, but 'old_customers' has 72% quality - BLOCKED"
Agent: "Using 'customers_v2' instead (95% quality)"
Agent: "Find data about customer complaints"
Semantic Layer: Returns both:
- complaints_table (structured)
- complaint_docs/ (unstructured)
Agent: "Get customer orders with product details"
Semantic Layer: "Found FK relationship, here's the JOIN template"
Agent: "What is txn_amt column?"
Semantic Layer: "Transaction amount in USD, derived from daily sales feed"
Agent: "Show me example queries"
Semantic Layer: "1. Show total revenue by region, 2. What was revenue last quarter?"
- V0.2.0_ENHANCEMENTS.md - NEW: AI-powered metadata features
- DATAZONE_DEPLOYMENT_GUIDE.md - Production deployment with DataZone (RECOMMENDED)
- AWS_DEPLOYMENT_GUIDE.md - Testing without DataZone
- QUICKSTART.md - 5-minute setup guide
- MCP_SEMANTIC_LAYER_EXTENSION.md - Protocol specification
- semantic_layer/README.md - Implementation docs
- IMPLEMENTATION_COMPLETE.md - What we built
- CLOUD_PLATFORMS_SEMANTIC_LAYER_COMPARISON.md - Cloud platform analysis
governed-truth-mcp/
βββ semantic_layer/ # Core implementation
β βββ models/ # Data models
β β βββ asset.py # SemanticAsset, StructuredAsset, UnstructuredAsset
β β βββ governance.py # GovernanceMetadata, QualityRuleResult
β β βββ relationship.py # AssetRelationship, RelationshipGraph
β β βββ config.py # SemanticLayerConfig
β βββ backend/ # Abstraction layer
β β βββ interfaces.py # IStructuredDataHandler, IUnstructuredDataHandler
β βββ aws/ # AWS implementation
β β βββ glue_handler.py # Glue Data Catalog
β β βββ datazone_handler.py # DataZone business context
β β βββ s3_handler.py # S3 + Textract + Comprehend
β β βββ relationship_handler.py # Relationship discovery
β βββ core/ # Business logic
β βββ discovery.py # AssetDiscoveryEngine
β βββ quality.py # QualityAssessmentFramework
β βββ trust_gate.py # TrustGateEnforcer
β βββ relationships.py # RelationshipDiscoveryEngine
β βββ search.py # UnifiedSearchCoordinator
β βββ metadata_generator.py # AI-powered metadata (v0.2.0)
βββ semantic_layer_server.py # MCP server
βββ test_semantic_server.py # Test suite
βββ .kiro/specs/ # Specifications
βββ mcp-semantic-extension/
βββ requirements.md # Requirements
βββ design.md # Design document
βββ tasks.md # Implementation tasks
Environment variables:
# AWS Configuration
AWS_REGION=us-east-1
GLUE_CATALOG_ID=123456789012
S3_BUCKET=my-semantic-layer-bucket
# Amazon DataZone (RECOMMENDED for production)
DATAZONE_DOMAIN_ID=dzd_xxxxxxxxxxxxx
# Semantic Layer Configuration
TRUST_THRESHOLD=0.85
ENABLE_VECTOR_SEARCH=false
LOG_LEVEL=INFONote: If DATAZONE_DOMAIN_ID is set, the semantic layer will use DataZone for business context, glossaries, and governance. Otherwise, it falls back to Glue-only mode.
# Run all tests
python test_semantic_server.py
# Test specific tool
python -c "from test_semantic_server import *; test_semantic_discover()"
# Test with mock backend (no AWS required)
MOCK_BACKEND=true python test_semantic_server.pypython semantic_layer_server.pydocker build -t semantic-layer-mcp .
docker run -e AWS_REGION=us-east-1 semantic-layer-mcpDeploy as Lambda function for serverless operation.
This is a reference implementation of the MCP Semantic Layer Extension. Contributions welcome:
- Additional backend implementations (Snowflake, Databricks, dbt)
- Enhanced relationship discovery algorithms
- Vector embedding support
- Performance optimizations
- Additional quality metrics
MIT License - see LICENSE file
- AWS Tel Aviv Summit 2026: "Governed AI: MCP Semantic Layer Extension for Trusted Data Access"
- See AWS_SUMMIT_ABSTRACT.md for details
- Model Context Protocol - The foundation
- MCP Apps - Inspiration for protocol extensions
- AWS Glue, DataZone, S3, Textract, Comprehend - Reference implementation
- GitHub Issues: For bugs and feature requests
- Discussions: For questions and community support
Built with β€οΈ for the AI + Data Governance community