unreal-analyzer-mcp
by: ayeletstudioindia
MCP server for Unreal Engine 5
📌Overview
Purpose: To provide powerful source code analysis capabilities for Unreal Engine codebases, facilitating deep understanding and manipulation of the code for AI assistants and developers.
Overview: The Unreal Engine Code Analyzer MCP server leverages the Model Context Protocol to offer an extensive suite of tools for analyzing C++ code within Unreal Engine projects. It enables users to extract detailed information about classes, understand hierarchies, and implement best practices specifically tailored to game development.
Key Features:
-
Class Analysis: Delivers in-depth information about C++ classes, including attributes, methods, and inheritance structures, helping users understand the code's architecture.
-
Hierarchy Mapping: Provides a visual representation of class inheritance, enhancing comprehension of relationships between different code components.
-
Code Search: Enables context-aware searching within the code, allowing for efficient identification of relevant snippets and references.
-
Reference Finding: Locates all occurrences of classes, functions, or variables across the project, streamlining code navigation.
-
Subsystem Analysis: Analyzes essential Unreal Engine subsystems (e.g., Rendering, Physics) to give insights into their functionalities and usage patterns.
-
Pattern Detection & Learning: Identifies common coding patterns used in Unreal Engine and supplies resources for learning and applying best practices.
-
Custom Codebase Support: Empowers users to analyze their own Unreal Engine projects or other C++ applications, broadening the tool's applicability beyond Unreal Engine itself.
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 to effectively understand and analyze Unreal Engine source code.
Features
- Class Analysis: Detailed information about C++ classes, including methods, properties, and inheritance.
- Hierarchy Mapping: Visualize class inheritance hierarchies.
- Code Search: Context-aware search results through code.
- Reference Finding: Locate all references to classes, functions, or variables.
- Subsystem Analysis: Analyze major Unreal Engine subsystems like Rendering and Physics.
- Game Genre Knowledge: Built-in knowledge of game genres, features, and implementation patterns.
- Pattern Detection & Learning: Identify common Unreal Engine patterns and provide learning resources.
- Custom Codebase Support: Analyze your own Unreal Engine project codebase.
Quick Start
Installation
-
Clone this repository:
git clone https://github.com/ayeletstudioindia/unreal-analyzer-mcp cd unreal-analyzer-mcp
-
Install dependencies:
npm install
-
Build the project:
npm run build
Configuration
For Claude Desktop App
Add the following to your Claude desktop configuration file:
{
"mcpServers": {
"unreal-analyzer": {
"command": "node",
"args": ["path/to/unreal-analyzer/build/index.js"],
"env": {}
}
}
}
For Cline
Add the following to your Cline MCP settings file:
{
"mcpServers": {
"unreal-analyzer": {
"command": "node",
"args": ["path/to/unreal-analyzer/build/index.js"],
"env": {}
}
}
}
Usage
Before using any analysis tools, set either the Unreal Engine source path or a custom codebase path:
Setting Up Analysis
For Unreal Engine Source Code
{
"name": "set_unreal_path",
"arguments": {
"path": "/path/to/UnrealEngine/Source"
}
}
For Custom C++ Codebases
{
"name": "set_custom_codebase",
"arguments": {
"path": "/path/to/your/codebase"
}
}
Available Tools
-
Class Analysis
{ "name": "analyze_class", "arguments": { "className": "AActor" } }
-
Class Hierarchy Analysis
{ "name": "find_class_hierarchy", "arguments": { "className": "ACharacter", "includeImplementedInterfaces": true } }
-
Reference Finding
{ "name": "find_references", "arguments": { "identifier": "BeginPlay", "type": "function" } }
-
Code Search
{ "name": "search_code", "arguments": { "query": "PhysicsHandle", "filePattern": "*.h", "includeComments": true } }
-
Pattern Detection & Best Practices
{ "name": "detect_patterns", "arguments": { "filePath": "Source/MyGame/MyActor.h" } }
-
Subsystem Analysis
{ "name": "analyze_subsystem", "arguments": { "subsystem": "Physics" } }
Best Practices
- Always set either the Unreal Engine path or custom codebase path before using analysis tools.
- Use specific class names when analyzing.
- Leverage the file pattern parameter in
search_code
to narrow down results. - Include implemented interfaces when analyzing class hierarchies.
- Use the subsystem analysis tool for a high-level overview before diving into specific classes.
Error Handling
The analyzer will throw clear error messages in the following scenarios:
- No codebase path is set.
- Provided path does not exist or is inaccessible.
- Class or symbol cannot be found.
- Invalid file patterns or syntax errors in queries.
Performance Considerations
- Large codebases may take longer to analyze.
- Broad search patterns could result in many matches.
Testing
The project includes comprehensive test coverage for major components. To run all tests:
npm test
To run tests in watch mode:
npm run test:watch
Contributing
Contributions are welcome! Please ensure all new functionality has corresponding test coverage and that you follow the existing test patterns for consistency before submitting a PR.