Provides deep source code analysis for Unreal Engine codebases, allowing AI assistants to understand C++ class structures, search code, and analyze subsystems.
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.
git clone https://github.com/ayeletstudioindia/unreal-analyzer-mcp cd unreal-analyzer-mcp
npm install
npm run build
Add the following to your Claude desktop configuration file (%APPDATA%\Claude\claude_desktop_config.json
on Windows):
{ "mcpServers": { "unreal-analyzer": { "command": "node", "args": ["path/to/unreal-analyzer/build/index.js"], "env": {} } } }
Add the following to your Cline MCP settings file (%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
on Windows):
{ "mcpServers": { "unreal-analyzer": { "command": "node", "args": ["path/to/unreal-analyzer/build/index.js"], "env": {} } } }
The analyzer is built using:
Key dependencies:
Before using any analysis tools, you must first set either the Unreal Engine source path or a custom codebase path:
{ "name": "set_unreal_path", "arguments": { "path": "/path/to/UnrealEngine/Source" } }
{ "name": "set_custom_codebase", "arguments": { "path": "/path/to/your/codebase" } }
The custom codebase feature allows you to analyze any C++ project. For example:
Example analyzing a custom game engine:
// Initialize with custom codebase { "name": "set_custom_codebase", "arguments": { "path": "/path/to/game-engine" } } // Analyze engine's renderer class { "name": "analyze_class", "arguments": { "className": "Renderer" } } // Find all shader-related code { "name": "search_code", "arguments": { "query": "shader|glsl|hlsl", "filePattern": "*.{h,cpp,hpp}" } } // Get render system class hierarchy { "name": "find_class_hierarchy", "arguments": { "className": "RenderSystem", "includeImplementedInterfaces": true } }
Example analyzing a Qt application:
// Initialize with Qt project { "name": "set_custom_codebase", "arguments": { "path": "/path/to/qt-app" } } // Find widget class definitions { "name": "search_code", "arguments": { "query": "class.*:.*public.*QWidget", "filePattern": "*.h" } } // Analyze main window class { "name": "analyze_class", "arguments": { "className": "MainWindow" } } // Find signal/slot connections { "name": "find_references", "arguments": { "identifier": "connect", "type": "function" } }
// Get detailed information about the AActor class { "name": "analyze_class", "arguments": { "className": "AActor" } }
Example output:
{ "name": "AActor", "properties": [ { "name": "RootComponent", "type": "USceneComponent*", "access": "protected" } // ... other properties ], "methods": [ { "name": "BeginPlay", "returnType": "void", "access": "protected", "virtual": true } // ... other methods ] }
// Get the inheritance hierarchy for ACharacter { "name": "find_class_hierarchy", "arguments": { "className": "ACharacter", "includeImplementedInterfaces": true } }
Example output:
{ "class": "ACharacter", "inheritsFrom": "APawn", "interfaces": ["IMovementModeInterface"], "hierarchy": [ "ACharacter", "APawn", "AActor", "UObject" ] }
// Find all references to the BeginPlay function { "name": "find_references", "arguments": { "identifier": "BeginPlay", "type": "function" } }
Example output:
{ "references": [ { "file": "Actor.cpp", "line": 245, "context": "void AActor::BeginPlay() { ... }" }, { "file": "Character.cpp", "line": 178, "context": "Super::BeginPlay();" } ] }
// Search for physics-related code { "name": "search_code", "arguments": { "query": "PhysicsHandle", "filePattern": "*.h", "includeComments": true } }
Example output:
{ "matches": [ { "file": "PhysicsEngine/PhysicsHandleComponent.h", "line": 15, "context": "class UPhysicsHandleComponent : public UActorComponent", "snippet": "// Component used for grabbing and moving physics objects" } ] }
The analyzer provides two powerful tools for understanding and following Unreal Engine best practices:
// Detect patterns in a file { "name": "detect_patterns", "arguments": { "filePath": "Source/MyGame/MyActor.h" } }
Example output:
{ "patterns": [ { "pattern": "UPROPERTY Macro", "description": "Property declaration for Unreal reflection system", "location": "Source/MyGame/MyActor.h:15", "context": "UPROPERTY(EditAnywhere, BlueprintReadWrite) float Health;", "improvements": "Consider adding a Category specifier for better organization Consider adding Meta tags for validation", "documentation": "https://docs.unrealengine.com/5.0/en-US/unreal-engine-uproperty-specifier-reference/", "bestPractices": "Use appropriate specifiers (EditAnywhere, BlueprintReadWrite) Consider replication needs (Replicated, ReplicatedUsing) Group related properties with categories", "examples": "UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat") float Health; UPROPERTY(Replicated, Meta = (ClampMin = "0.0")) float Speed;" } ] }
// Get best practices for specific Unreal concepts { "name": "get_best_practices", "arguments": { "concept": "UPROPERTY" // or UFUNCTION, Components, Events, Replication, Blueprints } }
Example output:
{ "description": "Property declaration for Unreal reflection system", "bestPractices": [ "Use appropriate specifiers (EditAnywhere, BlueprintReadWrite)", "Consider replication needs (Replicated, ReplicatedUsing)", "Group related properties with categories", "Use Meta tags for validation and UI customization" ], "examples": [ "UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat") float Health;", "UPROPERTY(Replicated, Meta = (ClampMin = "0.0")) float Speed;" ], "documentation": "https://docs.unrealengine.com/5.0/en-US/unreal-engine-uproperty-specifier-reference/" }
The best practices guide covers key Unreal Engine concepts:
// Search the API documentation { "name": "query_api", "arguments": { "query": "Actor", "category": "Object", "module": "Core", "includeExamples": true, "maxResults": 10 } }
Example output:
{ "results": [ { "class": "AActor", "description": "Base class for all actors in the game", "module": "Core", "category": "Object", "syntax": "class AActor : public UObject", "examples": [ "// Create a new actor AActor* MyActor = GetWorld()->SpawnActor();" ], "remarks": [ "Actors are the base building blocks of the game", "Can be placed in levels or spawned dynamically" ], "documentation": "https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Core/AActor", "relevance": 100 } ] }
The API documentation query tool provides:
// Analyze the Physics subsystem { "name": "analyze_subsystem", "arguments": { "subsystem": "Physics" } }
Example output:
{ "name": "Physics", "coreClasses": [ "UPhysicsEngine", "FPhysScene", "UBodySetup" ], "keyFeatures": [ "PhysX integration", "Collision detection", "Physical materials" ], "commonUseCases": [ "Character movement", "Vehicle simulation", "Destructible environments" ] }
The analyzer now includes comprehensive API documentation capabilities:
Automatic Documentation Generation
Smart Search
Documentation Categories
Module Organization
Integration with Existing Tools
search_code
to narrow down resultsThe analyzer will throw clear error messages when:
The project includes comprehensive test coverage for all major components:
Analyzer Tests: Core functionality tests for the UnrealCodeAnalyzer class
Game Genres Tests: Validation of the game genres knowledge base
MCP Server Tests: Testing of the MCP server implementation
Run all tests:
npm test
Run tests in watch mode (useful during development):
npm run test:watch
When contributing new features, please ensure:
src/__tests__
directoryContributions are welcome! Please feel free to submit pull requests with improvements to:
Before submitting a PR:
npm test
)Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!