ue-mcp-native-cpp
Skill523 starsChanged 38 days agoMITView on GitHub
Use when writing or modifying native C++ UCLASSes in an Unreal project via ue-mcp. Covers create_cpp_class → write_cpp_file → live_coding_compile loop, when to use build vs Live Coding, and the add_module_dependency workflow. Pulls in any time the user asks to write a new native class, add a UPROPERTY, or implement a UFUNCTION.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ue-mcp-animationSkill
- ue-mcp-blueprintSkill
- ue-mcp-epic-routingSkill
- ue-mcp-niagaraSkill
- ue-mcp-workflowSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
When you need a new module in a project's Build.cs:
- Distinctive: line 30
When you need to know *how* UE does something, reach for engine source lookup:
- Distinctive: line 41
Live Coding ≠ full build: If behavior doesn't reflect your code changes, check whether you added a new UCLASS, UFUNCTION reflection macro, …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ue-mcp native C++ authoring
The project tool wraps GameProjectUtils::AddCodeToProject and ILiveCodingModule so agents can author native C++ end-to-end without Python or the editor UI.
The authoring loop
- Pick a module.
project(action="list_project_modules")enumerates the project's native modules (name, host type, source path). Feed the module name intocreate_cpp_class. - Create the class.
project(action="create_cpp_class", className, parentClass?, moduleName?, classDomain?, subPath?)writes.hand.cppusing the same engine template thatFile → New C++ Classuses. The class-name prefix (A,U,F) is derived fromparentClass- pass the bare name ("BotSpawner", not"ABotSpawner"). - Inspect the generated files.
project(action="read_cpp_header", headerPath=...)andproject(action="read_cpp_source", sourcePath=...). Both paths are relative toSource/or absolute within it. - Append declarations and bodies.
project(action="write_cpp_file", path=..., content=...)writes the full file contents (scoped to theSource/tree for safety). Read first, then write the amended content. - Compile.
- New UCLASS →
project(action="build"). Live Coding doesn't reliably register brand-new UCLASSes; you need a full build and an editor restart.create_cpp_classsurfaces this vianeedsEditorRestartin its response. - Existing UCLASS (editing method bodies, adding UPROPERTYs, etc.) →
project(action="live_coding_compile", wait=true). Hot-patches method bodies without restart - the fast inner loop. Checklive_coding_statusfirst to confirm Live Coding is available and not already compiling.
- New UCLASS →
Adding module dependencies
When you need a new module in a project's Build.cs:
project(action="add_module_dependency", moduleName=<target Build.cs>, dependency=<module to add>, access="public"|"private")- Deduplicates automatically. Creates the
AddRangeblock if missing. - Rebuild afterwards (
project(action="build")).
Reading the engine source
When you need to know how UE does something, reach for engine source lookup:
project(action="read_engine_header", headerPath=...)- parse a.hfromEngine/Source(relative toEngine/Sourceor absolute).project(action="find_engine_symbol", symbol=..., maxResults?)- grep engine runtime headers for a symbol.project(action="search_engine_cpp", query, tree?, subdirectory?, maxResults?)- broader grep across.h/.cpp/.inlinRuntime/Editor/Developer/Plugins(orall).project(action="list_engine_modules")- enumerate modules inEngine/Source/Runtime.
Pitfalls
- UCLASSes need UnrealBuildTool + MSVC/Clang on the host. Same requirement as the editor's own Build menu.
write_cpp_filerefuses writes outsideSource/and rejects extensions other than.h/.cpp/.inl/.cs.- Live Coding ≠ full build. If behavior doesn't reflect your code changes, check whether you added a new UCLASS, UFUNCTION reflection macro, or UPROPERTY annotation - those usually need a full build.
- Don't edit Intermediate/ or Binaries/. These are regenerated.
Testing the new class
Once a class is compiled and registered, you can typically:
asset(action="read_properties", assetPath=...)orreflection(action="reflect_class", className=...)to verify UE sees the UCLASS.blueprint(action="create", parentClass="/Script/<Module>.<Class>")to subclass it from a Blueprint.level(action="place_actor", actorClass=...)to drop an instance into the level.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

