Token导航 LogoToken导航TokenDH.com
Unreal Analyzer logo
开发工具未说明官方级别未说明来源级核验

Unreal Analyzer

MCP Server

一个为Unreal Engine代码库提供强大源代码分析能力的MCP服务器,支持类分析、层次结构映射、代码搜索等功能,适用于游戏开发和C++项目分析。

工具数

0

提示词数

0

GitHub Stars

153

资源数

0
代码分析游戏开发TypeScriptClaudeClaudeCline

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ayeletstudioindia

提供方

ayeletstudioindia

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

](https://mseep.ai/app/ayeletstudioindia-unreal-analyzer-mcp)

虚幻引擎代码分析器MCP服务器

一个模型上下文协议(MCP)服务器,为虚幻引擎代码库提供强大的源代码分析能力。该工具使Claude和Cline等AI助手能够深入理解和分析虚幻引擎的源代码。

功能

  • 类分析获取有关C++类的详细信息,包括方法、属性和继承
  • 层级映射可视化并理解类继承层次结构
  • 代码搜索通过上下文感知结果搜索代码
  • 参考查找定位所有对类、函数或变量的引用
  • 子系统分析分析Unreal Engine的主要子系统,如渲染、物理等。
  • 游戏类型知识内置的游戏类型、特性和实现模式的知识库
  • 模式检测与学习识别虚幻引擎中的常见模式并提供学习资源
  • 自定义代码库支持分析你自己的Unreal Engine项目代码库

快速入门

安装

  1. 克隆此存储库:
git clone https://github.com/ayeletstudioindia/unreal-analyzer-mcp
cd unreal-analyzer-mcp
  1. 安装依赖项:
npm install
  1. 构建项目:
npm run build

配置

为Claude桌面应用程序

在你的Claude桌面配置文件中添加以下内容(%APPDATA%\Claude\claude_desktop_config.json 在Windows上):

{
  "mcpServers": {
    "unreal-analyzer": {
      "command": "node",
      "args": ["path/to/unreal-analyzer/build/index.js"],
      "env": {}
    }
  }
}

致克莱恩

将以下内容添加到您的Cline MCP设置文件中(%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json 在Windows上:

{
  "mcpServers": {
    "unreal-analyzer": {
      "command": "node",
      "args": ["path/to/unreal-analyzer/build/index.js"],
      "env": {}
    }
  }
}

技术细节

分析器是使用以下内容构建的:

  • TypeScript 用于类型安全的代码
  • 用于稳健C++解析的Tree-sitter
  • 模型上下文协议SDK,用于AI助手集成
  • 用于文件模式匹配的glob

关键依赖项:

  • @modelcontextprotocol/创建服务器: ^0.1.0
  • tree-sitter: ^0.20.1
  • tree-sitter-cpp: ^0.20.0
  • glob: ^8.1.0

用法

在使用任何分析工具之前,您必须首先设置Unreal Engine源代码路径或自定义代码库路径:

设置分析

对于虚幻引擎源代码

{
  "name": "set_unreal_path",
  "arguments": {
    "path": "/path/to/UnrealEngine/Source"
  }
}

针对自定义C++代码库

{
  "name": "set_custom_codebase",
  "arguments": {
    "path": "/path/to/your/codebase"
  }
}

自定义代码库功能允许您分析任何C++项目。例如:

  • 游戏引擎(Unity、Godot、自定义引擎)
  • 图形库(OpenGL、Vulkan、DirectX)
  • 框架(Qt,Boost,SFML)
  • 任何C++应用程序或库

示例:分析自定义游戏引擎:

// 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
  }
}

分析Qt应用程序的示例:

// 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"
  }
}

可用工具

1. 类分析

// Get detailed information about the AActor class
{
  "name": "analyze_class",
  "arguments": {
    "className": "AActor"
  }
}

示例输出:

{
  "name": "AActor",
  "properties": [
    {
      "name": "RootComponent",
      "type": "USceneComponent*",
      "access": "protected"
    }
    // ... other properties
  ],
  "methods": [
    {
      "name": "BeginPlay",
      "returnType": "void",
      "access": "protected",
      "virtual": true
    }
    // ... other methods
  ]
}

2. 类层次结构分析

// Get the inheritance hierarchy for ACharacter
{
  "name": "find_class_hierarchy",
  "arguments": {
    "className": "ACharacter",
    "includeImplementedInterfaces": true
  }
}

示例输出:

{
  "class": "ACharacter",
  "inheritsFrom": "APawn",
  "interfaces": ["IMovementModeInterface"],
  "hierarchy": [
    "ACharacter",
    "APawn",
    "AActor",
    "UObject"
  ]
}

3. 参考文献查找

// Find all references to the BeginPlay function
{
  "name": "find_references",
  "arguments": {
    "identifier": "BeginPlay",
    "type": "function"
  }
}

示例输出:

{
  "references": [
    {
      "file": "Actor.cpp",
      "line": 245,
      "context": "void AActor::BeginPlay() { ... }"
    },
    {
      "file": "Character.cpp",
      "line": 178,
      "context": "Super::BeginPlay();"
    }
  ]
}

4. 代码搜索

// Search for physics-related code
{
  "name": "search_code",
  "arguments": {
    "query": "PhysicsHandle",
    "filePattern": "*.h",
    "includeComments": true
  }
}

示例输出:

{
  "matches": [
    {
      "file": "PhysicsEngine/PhysicsHandleComponent.h",
      "line": 15,
      "context": "class UPhysicsHandleComponent : public UActorComponent",
      "snippet": "// Component used for grabbing and moving physics objects"
    }
  ]
}

5. 模式检测与最佳实践

分析器提供了两种强大的工具,用于理解和遵循虚幻引擎的最佳实践:

模式检测

// Detect patterns in a file
{
  "name": "detect_patterns",
  "arguments": {
    "filePath": "Source/MyGame/MyActor.h"
  }
}

示例输出:

{
  "patterns": [
    {
      "pattern": "UPROPERTY Macro",
      "description": "Property declaration for Unreal reflection system",
      "location": "Source/MyGame/MyActor.h:15",
      "context": "UPROPERTY(EditAnywhere, BlueprintReadWrite)\nfloat Health;",
      "improvements": "Consider adding a Category specifier for better organization\nConsider 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)\nConsider replication needs (Replicated, ReplicatedUsing)\nGroup related properties with categories",
      "examples": "UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = \"Combat\")\nfloat Health;\nUPROPERTY(Replicated, Meta = (ClampMin = \"0.0\"))\nfloat Speed;"
    }
  ]
}

最佳实践指南

// Get best practices for specific Unreal concepts
{
  "name": "get_best_practices",
  "arguments": {
    "concept": "UPROPERTY"  // or UFUNCTION, Components, Events, Replication, Blueprints
  }
}

示例输出:

{
  "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\")\nfloat Health;",
    "UPROPERTY(Replicated, Meta = (ClampMin = \"0.0\"))\nfloat Speed;"
  ],
  "documentation": "https://docs.unrealengine.com/5.0/en-US/unreal-engine-uproperty-specifier-reference/"
}

最佳实践指南涵盖了虚幻引擎的关键概念:

  • UPROPERTY:属性反射和暴露
  • UFUNCTION:函数反射和蓝图集成
  • 组件:组件创建与管理
  • 事件:事件处理和委托
  • 复制:网络复制设置
  • 蓝图:蓝图/C++交互模式

6. API文档查询

// Search the API documentation
{
  "name": "query_api",
  "arguments": {
    "query": "Actor",
    "category": "Object",
    "module": "Core",
    "includeExamples": true,
    "maxResults": 10
  }
}

示例输出:

{
  "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\nAActor* 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
    }
  ]
}

API文档查询工具提供:

  • 跨类文档的全文搜索
  • 按类别和模块过滤
  • 代码示例和使用模式
  • 基于相关性的结果排序
  • 官方文档链接

7. 子系统分析

// Analyze the Physics subsystem
{
  "name": "analyze_subsystem",
  "arguments": {
    "subsystem": "Physics"
  }
}

示例输出:

{
  "name": "Physics",
  "coreClasses": [
    "UPhysicsEngine",
    "FPhysScene",
    "UBodySetup"
  ],
  "keyFeatures": [
    "PhysX integration",
    "Collision detection",
    "Physical materials"
  ],
  "commonUseCases": [
    "Character movement",
    "Vehicle simulation",
    "Destructible environments"
  ]
}

API文档

分析器现在包含了全面的API文档生成功能:

  1. 自动生成文档

- 从源代码注释中提取文档 - 分析类结构和关系 - 按类型和模块对类进行分类 - 生成语法示例和用法模式

  1. 智能搜索

- 在所有文档中进行全文搜索 - 基于相关性的结果排序 - 类别和模块过滤 - 包含代码示例

  1. 文档分类

- 对象:基础对象类(UObject派生类) - 演员:演员类(AActor派生类) - 结构:数据结构和类型 - 组件:组件类 - 杂项:其他类和实用程序

  1. 模块组织

- 核心:核心引擎功能 - RenderCore:渲染系统 - 物理核心:物理引擎 - 和其他引擎模块

  1. 与现有工具的集成

- 链接包含用于详细信息的班级分析 - 连接到模式检测以获取最佳实践 - 参考官方的Unreal Engine文档 - 提供学习资源和示例

最佳实践

  1. 在使用分析工具之前,请始终设置虚幻引擎路径或自定义代码库路径
  2. 在分析时使用具体的类名(例如,用“MyClass”而不是仅仅用“Class”)
  3. 利用文件模式参数 search_code 缩小结果范围
  4. 在分析类层次结构以获得完整理解时,请包含已实现的接口
  5. 在深入具体类之前,使用子系统分析工具获取高级别概览(仅限虚幻引擎)

错误处理

分析器将在以下情况下抛出清晰的错误信息:

  • 未设置代码库路径(虚幻引擎或自定义)
  • 提供的路径不存在或无法访问
  • 在代码库中找不到类或符号
  • 提供了无效的文件模式
  • 搜索查询或C++代码中的语法错误
  • 访问源文件受到限制
  • Tree-sitter 解析 C++ 文件失败

性能考量

  • 大型代码库的分析可能需要更长时间
  • 复杂的类层次结构可能需要更多的处理时间
  • 广泛的搜索模式可能会导致大量匹配结果
  • 考虑使用更具体的查询以获得更快的结果

测试

该项目涵盖了所有主要组件的全面测试覆盖:

测试覆盖率

  • 分析器测试UnrealCodeAnalyzer类的核心功能测试

- 初始化和路径验证 - 类分析和解析 - 参考查找 - 代码搜索 - 子系统分析 - 缓存管理

  • 游戏类型测试游戏类型知识库的验证

- 数据结构验证 - 针对特定类型的特征验证 - 组件命名规范 - 数据完整性检查

  • MCP服务器测试MCP服务器实现的测试

- 服务器初始化 - 工具注册和处理 - 请求/响应验证 - 错误处理 - 工具特定功能测试

运行测试

运行所有测试:

npm test

在监视模式下运行测试(开发期间很有用):

npm run test:watch

编写测试

在贡献新功能时,请确保:

  1. 所有新功能都有相应的测试覆盖率
  2. 测试在以下内容中进行了组织 src/__tests__ 目录
  3. 适当模拟外部依赖
  4. 遵循现有的测试模式以保持一致性

贡献

欢迎贡献!请随时提交包含改进的拉取请求至:

  • 源代码解析功能
  • 新分析功能
  • 性能优化
  • 文档改进
  • 测试覆盖率

在提交PR之前:

  1. 确保所有测试通过(npm test根据上面的信息,执行如下指令:
  2. 为新功能添加测试
  3. 根据需要更新文档

目录标签

目录标签

代码分析游戏开发TypeScriptClaude本地部署UnrealEngineC++解析AI辅助

支持客户端

ClaudeCline

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP