Unreal Engine Code Analyzer MCP Server
Unreal Engine Code Analyzer MCP Server
A Model Context Protocol (MCP) server that provides powerful source code analysis capabilities for Unreal Engine codebases. This tool enables AI assistants like Claude and Cline to deeply understand and analyze Unreal Engine source code.
<a href="https://glama.ai/mcp/servers/z36022whws"><img width="380" height="200" src="https://glama.ai/mcp/servers/z36022whws/badge" alt="Unreal Engine Code Analyzer Server MCP server" /></a>
Features
- Class Analysis: Get detailed information about C++ classes including methods, properties, and inheritance
- Hierarchy Mapping: Visualize and understand class inheritance hierarchies
- Code Search: Search through code with context-aware results
- Reference Finding: Locate all references to classes, functions, or variables
- Subsystem Analysis: Analyze major Unreal Engine subsystems like Rendering, Physics, etc.
- Game Genre Knowledge: Built-in knowledge base of game genres, features, and implementation patterns
- Pattern Detection & Learning: Identifies common Unreal Engine patterns and provides learning resources
- Custom Codebase Support: Analyze your own Unreal Engine project codebase
Quick Start
Installation
- Clone this repository:
- Install dependencies:
- Build the project:
Configuration
For Claude Desktop App
Add the following to your Claude desktop configuration file (%APPDATA%\Claude\claude_desktop_config.json
on Windows):
For Cline
Add the following to your Cline MCP settings file (%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
on Windows):
Technical Details
The analyzer is built using:
- TypeScript for type-safe code
- Tree-sitter for robust C++ parsing
- Model Context Protocol SDK for AI assistant integration
- Glob for file pattern matching
Key dependencies:
- @modelcontextprotocol/create-server: ^0.1.0
- tree-sitter: ^0.20.1
- tree-sitter-cpp: ^0.20.0
- glob: ^8.1.0
Usage
Before using any analysis tools, you must first set either the Unreal Engine source path or a custom codebase path:
Setting Up Analysis
For Unreal Engine Source Code
For Custom C++ Codebases
The custom codebase feature allows you to analyze any C++ project. For example:
- Game engines (Unity, Godot, custom engines)
- Graphics libraries (OpenGL, Vulkan, DirectX)
- Frameworks (Qt, Boost, SFML)
- Any C++ application or library
Example analyzing a custom game engine:
Example analyzing a Qt application:
Available Tools
1. Class Analysis
Example output:
2. Class Hierarchy Analysis
Example output:
3. Reference Finding
Example output:
4. Code Search
Example output:
5. Pattern Detection & Best Practices
The analyzer provides two powerful tools for understanding and following Unreal Engine best practices:
Pattern Detection
Example output:
Best Practices Guide
Example output:
The best practices guide covers key Unreal Engine concepts:
- UPROPERTY: Property reflection and exposure
- UFUNCTION: Function reflection and Blueprint integration
- Components: Component creation and management
- Events: Event handling and delegation
- Replication: Network replication setup
- Blueprints: Blueprint/C++ interaction patterns
6. API Documentation Query
Example output:
The API documentation query tool provides:
- Full-text search across class documentation
- Filtering by category and module
- Code examples and usage patterns
- Relevance-based sorting of results
- Links to official documentation
7. Subsystem Analysis
Example output:
API Documentation
The analyzer now includes comprehensive API documentation capabilities:
- Automatic Documentation Generation
- Extracts documentation from source code comments
- Analyzes class structure and relationships
- Categorizes classes by type and module
- Generates syntax examples and usage patterns
- Smart Search
- Full-text search across all documentation
- Relevance-based ranking of results
- Category and module filtering
- Code example inclusion
- Documentation Categories
- Object: Base object classes (UObject derivatives)
- Actor: Actor classes (AActor derivatives)
- Structure: Data structures and types
- Component: Component classes
- Miscellaneous: Other classes and utilities
- Module Organization
- Core: Core engine functionality
- RenderCore: Rendering system
- PhysicsCore: Physics engine
- And other engine modules
- Integration with Existing Tools
- Links with class analysis for detailed information
- Connects to pattern detection for best practices
- References official Unreal Engine documentation
- Provides learning resources and examples
Best Practices
- Always set either the Unreal Engine path or custom codebase path before using analysis tools
- Use specific class names when analyzing (e.g., "MyClass" instead of just "Class")
- Leverage the file pattern parameter in
search_code
to narrow down results - Include implemented interfaces when analyzing class hierarchies for complete understanding
- Use the subsystem analysis tool to get a high-level overview before diving into specific classes (Unreal Engine only)
Error Handling
The analyzer will throw clear error messages when:
- No codebase path is set (Unreal Engine or custom)
- Provided path does not exist or is inaccessible
- Class or symbol cannot be found in the codebase
- Invalid file patterns are provided
- Syntax errors in search queries or C++ code
- Access to source files is restricted
- Tree-sitter parsing fails for C++ files
Performance Considerations
- Large codebases may take longer to analyze
- Complex class hierarchies might require more processing time
- Broad search patterns could result in many matches
- Consider using more specific queries for faster results
Testing
The project includes comprehensive test coverage for all major components:
Test Coverage
- Analyzer Tests: Core functionality tests for the UnrealCodeAnalyzer class
- Initialization and path validation
- Class analysis and parsing
- Reference finding
- Code searching
- Subsystem analysis
- Cache management
- Game Genres Tests: Validation of the game genres knowledge base
- Data structure verification
- Genre-specific feature validation
- Component naming conventions
- Data completeness checks
- MCP Server Tests: Testing of the MCP server implementation
- Server initialization
- Tool registration and handling
- Request/response validation
- Error handling
- Tool-specific functionality tests
Running Tests
Run all tests:
Run tests in watch mode (useful during development):
Writing Tests
When contributing new features, please ensure:
- All new functionality has corresponding test coverage
- Tests are organized in the
src/__tests__
directory - Mock external dependencies appropriately
- Follow the existing test patterns for consistency
Contributing
Contributions are welcome! Please feel free to submit pull requests with improvements to:
- Source code parsing capabilities
- New analysis features
- Performance optimizations
- Documentation improvements
- Test coverage
Before submitting a PR:
- Ensure all tests pass (
npm test
) - Add tests for new functionality
- Update documentation as needed
Provides deep source code analysis for Unreal Engine codebases, allowing AI assistants to understand C++ class structures, search code, and analyze subsystems.