nparashuram/meta-spatial-samples-mcp
3.3
If you are the rightful owner of meta-spatial-samples-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Model Context Protocol (MCP) server is designed to facilitate advanced code search and analysis for the Meta Spatial SDK, leveraging AST analysis, semantic relationships, and vector embeddings.
Tools
8
Resources
0
Prompts
0
#MetaSpatial SDK Code Samples MCP
A code search system that uses AST analysis, semantic relationships, and vector embeddings to help Claude find and understand code examples from the Meta Spatial SDK samples.
MCP Tools
search_code_snippets
- Find 10-15 line code examplessmart_code_search
- Intelligent search with pattern detectionexplore_ecs_system
- Entity Component System exploration and usage patternsexplore_panels
- Panel entity creation, Android integration, and interactionsexplore_metaspatial_scenes
- MetaSpatial scene files, materials, and entity hierarchiesfind_related_files
- Cross-file relationship discoveryget_codebase_overview
- High-level structure analysisexecute_prebuilt_query
- MetaSpatial development task queries
Quick Start
1. Ingest the Code Samples
cd code
python run_full_ingestion.py /path/to/Meta-Spatial-SDK-Samples
This will:
- Parse all
.kt
,.java
,.xml
,.metaspatial
,.scene
, andbuild.gradle*
files - Extract AST relationships, Android patterns, and ECS components
- Generate semantic embeddings with relationship context
- Store everything in a vector database
2. Start the MCP Server
cd code
python start_mcp_server.py
3. Configure Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"code-search": {
"command": "python",
"args": [
"/path/to/your/codegraph/code/start_mcp_server.py",
"--db-path",
"/path/to/your/codegraph/code/enhanced_chroma_db"
]
}
}
}
AI Generated Section
šļø System Architecture
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā Claude MCP āāāāāā Query Interface āāāāāā Vector Database ā
ā Client ā ā ā ā (ChromaDB) ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāā“āāāāāāāāāā
ā ā
āāāāāāāāāāāā¼āāāāāāāāāāā āāāāāā¼āāāāāāāāāāāāāā
ā Semantic Search ā ā Relationship ā
ā Engine ā ā Graph ā
āāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāā¼āāāāāāāāāāā
ā AST Parser ā
ā (Kotlin/Java/XML) ā
āāāāāāāāāāāāāāāāāāāāāāā
š Project Structure
code/
āāā ingestion/ # Code parsing & embedding
ā āāā code_parser.py # Basic AST parsing
ā āāā enhanced_parser.py # Advanced relationship extraction + ECS
ā āāā metaspatial_parser.py # MetaSpatial/Scene file parser
ā āāā enhanced_embedder.py # Context-aware embedding generation
ā āāā ingest.py # Main ingestion pipeline
āāā storage/ # Vector database interface
ā āāā vector_db.py # ChromaDB wrapper with metadata
āāā inference/ # Query & search logic
ā āāā query_interface.py # Enhanced search API with relationship analysis
āāā mcp_server/ # MCP server implementation
ā āāā code_search_server.py # MCP protocol handler
āāā run_full_ingestion.py # Complete ingestion pipeline
āāā start_mcp_server.py # Launch MCP server
š§© Key Components
AST Parser (ingestion/enhanced_parser.py
)
- Extracts semantic relationships from code structure
- Tracks function calls, inheritance, method overrides
- Maps Android resource usage (R.id., R.layout.)
- Analyzes file hierarchy and module relationships
- ECS pattern detection for MetaSpatial entities, components, and systems
MetaSpatial Parser (ingestion/metaspatial_parser.py
)
- Parses
.metaspatial
and.scene
files (YAML-based entity definitions) - Extracts ECS entity structures with components and properties
- Detects usage patterns for Panel entities, Physics, Draggable components
- Maps entity references between MetaSpatial files and Kotlin code
Enhanced Query Interface (inference/query_interface.py
)
- Unified API for all search capabilities with relationship analysis
- ECS-aware search patterns for MetaSpatial development
- Smart pattern detection (draggable, panels, physics, etc.)
- Cross-file relationship traversal using ingested metadata
- MetaSpatial-specific queries for scene files and entity definitions
- Intelligent suggestions based on detected patterns and results
MCP Server (mcp_server/code_search_server.py
)
- Protocol-compliant MCP server
- Tool definitions for Claude integration
- Async request handling
- Structured result formatting
šÆ Supported Query Types
1. Natural Language Queries
- "How to create a button click handler"
- "Activity lifecycle methods"
- "Network request examples"
- "Permission handling code"
2. Android Component Queries
- Find Activities and their layouts
- Explore Fragment implementations
- Discover resource definitions and usage
- Analyze manifest configurations
3. Relationship Queries
- Files in same folder/module
- Cross-file dependencies
- Resource definition ā usage chains
- Import/export relationships
4. Pattern-Based Queries
- Lifecycle patterns (onCreate, onResume, etc.)
- UI interaction patterns (onClick, touch)
- Navigation patterns (intents, fragments)
- Data binding patterns
- Network/API patterns
5. ECS and MetaSpatial Queries
- Panel entity creation and usage patterns
- Component attachment and manipulation (Physics, Draggable, etc.)
- Entity-Component-System relationships
- Scene file entity definitions
- Cross-reference between MetaSpatial files and Kotlin implementations