Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ Demo/*
# Keep only the project file and documentation
!Demo/*.uproject
!Demo/README_CALIBRATION.md
# Include Blueprint test system (part of UEMCP development)
!Demo/Content/
!Demo/Content/TestBlueprints/
!Demo/Content/TestBlueprints/**
# Always ignore Unreal's generated folders
Demo/Saved/
Demo/Intermediate/
Expand Down
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
hooks:
- id: ruff
args: ["--fix"]
additional_dependencies: []
- id: ruff-format
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
args: ["--line-length", "120"]
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
args: ["--max-line-length=120", "--ignore=E203,W503", "--per-file-ignores=test_*.py:C901"]
additional_dependencies: []
- repo: local
hooks:
- id: eslint-server
name: eslint (server)
entry: bash -lc "cd server && npm run lint"
language: system
types: ["ts"]
pass_filenames: false
41 changes: 41 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Repository Guidelines

## Project Structure & Modules
- `server/`: TypeScript MCP server (src, tests, dist). Build, lint, typecheck live here.
- `plugin/`: Unreal Engine plugin (Python ops, C++ stub, uplugin). Python lives under `plugin/Content/Python`.
- `tests/`: Integration/E2E helpers and scenarios; Python test example under `tests/python`.
- `scripts/`: Local diagnostics and utilities (e.g., `mcp-diagnostic.js`, `bump-version.js`).
- `docs/`, `README.md`, `CLAUDE.md`: Architecture, workflows, contributor info.

## Build, Test, Run
- Install/setup: `./setup.sh` (detects Node, builds server, configures MCP clients).
- Dev server: `npm run dev` (from repo root; runs `server` in watch mode).
- Build: `npm run build` (invokes `tsc` in `server`).
- Tests (root):
- `npm test` or `npm run test:e2e` — E2E suite.
- `npm run test:unit` — Jest unit tests in `server`.
- `npm run test:integration` — Integration checks.
- `cd server && npm run test:python` — Python plugin tests via pytest.
- CI-like run: `./test-ci-locally.sh`.

## Coding Style & Naming
- Indentation: JS/TS/JSON 2 spaces; Python 4 spaces (`.editorconfig`).
- TypeScript: ESLint + strict rules (`server/.eslintrc.js`): no `any`, explicit returns, no unused vars, no floating promises. Run `npm run lint` and `npm run lint:fix`.
- Filenames: kebab- or lowerCamel for TS files; Python modules snake_case under `plugin/Content/Python`.
- Public tool exports live in `server/src/tools` and are registered via `server/src/index.ts`.
- Error handling: Avoid `try/catch` (TS) and `try/except` (Py) whenever possible. Prefer validation + specific errors and the UEMCP framework decorators/utilities. See `docs/development/error-handling-philosophy.md`, `docs/improved-error-handling.md`, and `docs/development/code-standards.md`.
- Linting standard: Zero warnings and zero errors. TS: `cd server && npm run lint`. Python: `flake8` in `plugin/Content/Python` with `--max-line-length=120`. Do not merge code with any lint output.

## Testing Guidelines
- Frameworks: Jest (TS), Pytest (plugin). Aim to keep unit tests in `server/tests` and Python tests in `server/tests/python`.
- Naming: `*.test.ts` for Jest; `test_*.py` for Pytest.
- Coverage: use `npm run test:e2e:coverage` or `cd server && npm run test:coverage`.

## Commits & PRs
- Commit style: Conventional Commits (e.g., `feat:`, `fix:`, `style:`) with clear scope; reference PRs/issues when applicable.
- PRs should include: concise description, linked issues, testing evidence (logs/screenshots), and updated docs if behavior changes. Ensure `./test-ci-locally.sh` passes.

## Security & Config Tips
- Set `UE_PROJECT_PATH` to your `.uproject` location for local runs.
- Claude Desktop config is auto-managed by `setup.sh`; regenerate if paths change.
- Prefer symlink install for plugin development when supported (`./setup.sh --symlink`).
25 changes: 22 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,36 @@ npm test
# Run Python tests
python -m pytest tests/

# Run Python linting and formatting
./scripts/lint-python.sh

# Run linting and CI checks before committing
./test-ci-locally.sh
```

**IMPORTANT**: Always run `./test-ci-locally.sh` before committing and pushing changes to ensure:
- TypeScript linting passes (ESLint)
- TypeScript linting passes (ESLint) with **zero warnings**
- TypeScript type checking passes
- Python linting passes (ruff, mypy, flake8)
- Python linting passes (ruff, black, flake8) with **zero warnings**
- All tests pass

This prevents CI failures and ensures code quality.
**CRITICAL**: We maintain a **zero warnings** policy for all linting tools. This ensures consistently high code quality and prevents technical debt accumulation. Pre-commit hooks automatically enforce this standard.

### Pre-commit Hooks
Pre-commit hooks are automatically installed and will run before each commit:
```bash
# Install pre-commit hooks (already done for this project)
pre-commit install

# Run pre-commit hooks on all files
pre-commit run --all-files
```

The hooks include:
- **ruff**: Fast Python linter and formatter with auto-fix capabilities
- **black**: Python code formatter (120 character line length)
- **flake8**: Python style guide enforcement (ignores E203, W503 for Black compatibility)
- **eslint**: TypeScript/JavaScript linting for server code

## Project Structure

Expand Down
Binary file modified Demo/Content/Calibration.umap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Demo/Content/TestBlueprints/UI/BP_MainMenu.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
127 changes: 106 additions & 21 deletions PLAN.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,61 @@
# UEMCP Work Plan (Next Steps)
# UEMCP Development Roadmap

**Purpose**: Focused, executable plan to improve testing, reliability, and CI safety. Optimized for step-by-step execution by an AI agent.
**Purpose**: Comprehensive development roadmap for UEMCP (Unreal Engine Model Context Protocol). Prioritized feature development, testing improvements, and infrastructure enhancements.

## Scope
## Current Focus: Blueprint System Support

- Increase meaningful coverage and align thresholds with CI/Codecov
- Make integration/E2E tests opt-in and CI-safe
- Exercise real Python plugin logic without Unreal Engine
- Harden error/resiliency paths and validators
- Clarify test configuration and developer workflow
The next major development milestone focuses on comprehensive Blueprint editing, creation, and documentation capabilities to enable AI-assisted Blueprint workflows.

## Prerequisites

- Node >= 18, npm
- Python 3.11 available in CI (local ok with 3.10+ but prefer 3.11)
- Python 3.11+ (local ok with 3.10+ but prefer 3.11) for MCP server and tools
- Unreal Engine 5.4+ for full Blueprint functionality
- No network access required beyond CI artifact uploads

## Milestone 1: Coverage Gates & CI Alignment
## Milestone 1: Blueprint System Support (Priority #1)

### Task: Create complex Blueprint test system in Demo project

- **Edit**: Create test Blueprint hierarchy in `/Game/TestBlueprints/`
- **Do**:
- Interactive door Blueprint with proximity detection and animation
- Inventory system with item pickup/drop mechanics
- Character controller with custom input handling
- UI system with dynamic menu generation
- Game state manager with save/load functionality
- Interconnected Blueprint communication system
- **Validate**: All Blueprints compile, function correctly, and demonstrate complex interactions
- **Done when**: Rich Blueprint ecosystem exists for testing documentation tools

### Task: Add comprehensive Blueprint MCP tools

- **Edit**: Add new tools in `server/src/tools/blueprint/` directory
- **Do**:
- `blueprint_create` - Create new Blueprint classes with components/variables/functions
- `blueprint_modify` - Edit Blueprint properties, components, and event graphs
- `blueprint_list` - List Blueprints with filtering and metadata
- `blueprint_info` - Get detailed Blueprint structure (components, variables, functions, events)
- `blueprint_compile` - Compile Blueprint and report compilation status/errors
- `blueprint_component_add` - Add components to existing Blueprints
- `blueprint_variable_set` - Set Blueprint variable values and properties
- `blueprint_event_create` - Create custom events and bind functions
- **Validate**: All tools work with test Blueprints in Demo project; compilation succeeds
- **Done when**: Full Blueprint creation/editing workflow supported via MCP tools

### Task: Add Blueprint documentation generation

- **Edit**: Add `blueprint_document` tool and documentation utilities
- **Do**:
- Generate markdown documentation for Blueprint structure
- Include component hierarchy, variable descriptions, function signatures
- Export event graph flow diagrams as text/ASCII art
- Support batch documentation of multiple Blueprints
- Include Blueprint dependencies and references
- **Validate**: Generated docs accurately reflect Blueprint structure and are human-readable
- **Done when**: Complex Blueprint systems can be fully documented automatically

## Milestone 2: Testing & CI Infrastructure

### Task: Raise Jest global threshold and add per-path gates

Expand All @@ -40,7 +79,7 @@
- **Validate**: Codecov PR comment shows both flags; project status uses both
- **Done when**: Codecov displays unified coverage with two flags

## Milestone 2: CI-Safe Integration/E2E
## Milestone 3: CI-Safe Integration/E2E

### Task: Gate tests that write local config or require UE

Expand All @@ -52,7 +91,7 @@
- **Validate**: In CI (without env vars) these tests are skipped and return success; locally they run when env vars set
- **Done when**: CI does not modify developer environments and still runs unit/contract tests

## Milestone 3: Python Tests Against Real Modules (No UE)
## Milestone 4: Python Tests Against Real Modules (No UE)

### Task: Import real plugin logic with an Unreal shim

Expand All @@ -71,7 +110,7 @@
- **Validate**: Pytest imports fixtures successfully
- **Done when**: No syntax/import errors from conftest

## Milestone 4: Resiliency & Property Testing
## Milestone 5: Resiliency & Property Testing

### Task: Expand PythonBridge resiliency tests

Expand All @@ -91,7 +130,7 @@
- **Validate**: Tests run quickly and catch malformed shapes; no flakes
- **Done when**: Validator robustness demonstrably increases

## Milestone 5: Test Config & Docs Cleanup
## Milestone 6: Test Config & Docs Cleanup

### Task: Normalize Jest configs and folder taxonomy

Expand All @@ -109,7 +148,7 @@
- **Validate**: Docs match code + CI behavior
- **Done when**: New contributors can follow the doc to run the full stack

## Milestone 6: MCP Interop & Server Simplification
## Milestone 7: MCP Interop & Server Simplification

### Task: Add optional alternate transports (HTTP/WebSocket) behind env flags

Expand Down Expand Up @@ -157,6 +196,30 @@
- **Validate**: Docs match actual behavior; examples work
- **Done when**: Users can choose transport and call tools confidently

## Future Roadmap (Post-Blueprint)

### Milestone 8: Advanced UE Features
- Animation Blueprint support
- Material graph editing and node manipulation
- Niagara particle system integration
- Audio system tools (Wwise/MetaSounds)
- Landscape and terrain manipulation
- Physics constraint and simulation tools

### Milestone 9: AI/ML Integration
- Training data generation from UE scenes
- Procedural content generation using AI
- Behavior tree learning and optimization
- Asset classification and tagging
- Performance profiling and optimization suggestions

### Milestone 10: Collaboration & Workflow
- Multi-user editing support
- Version control integration (Perforce/Git)
- Asset dependency tracking and visualization
- Automated testing of gameplay mechanics
- Build pipeline integration and automation

## Validation Checklist (Run Locally)

- `cd server && npm ci && npm run lint && npm run typecheck && npm run test:coverage` passes
Expand All @@ -165,6 +228,20 @@

## Success Stories

### Command Registration System Recovery (2025-09-10)

Successfully diagnosed and completely resolved fundamental MCP command registration system failure:

- **Problem Identification**: Discovered 56+ "Unknown command" errors during comprehensive testing
- **Root Cause Analysis**: Incomplete command_map in uemcp_listener.py missing critical MCP tool mappings
- **Systematic Resolution**:
- `asset_get_info`, `material_create`, `blueprint_create`, `batch_spawn` - Added missing command mappings
- `actor_snap_to_socket` - Fixed parameter validation to accept both dict `{x,y,z}` and array `[x,y,z]` formats
- `StaticMeshComponent` API calls - Fixed deprecated UE Python API usage for 5.4+ compatibility
- Test infrastructure - Enhanced error detection and baseline clearing procedures

**Result**: Complete system reliability transformation from 0/9 → 9/9 tests passing consistently. All 22 MCP tools now function correctly with zero UE log errors. Established foundation for v1.1.0 production release.

### Level Debugging with MCP Tools (2025-09-06)

Successfully diagnosed and fixed skydome/sky material error in Calibration level using only MCP tools:
Expand All @@ -177,11 +254,19 @@ Successfully diagnosed and fixed skydome/sky material error in Calibration level

**Result**: Complete level debugging workflow achieved with existing MCP tool coverage. No additional tooling needed.

## Definition of Done
## Definition of Done (Current Milestone)

### Blueprint System Support:
- Complex Blueprint test system created and functional in Demo project
- All 8+ Blueprint MCP tools implemented and tested
- Blueprint documentation generation produces comprehensive, readable docs
- AI can create, modify, and document Blueprint systems end-to-end
- Integration with existing level editing and asset management tools

- Jest and Codecov thresholds are aligned and enforced; CI is green
- Integration/E2E tests are opt-in with clear env guards; CI safe by default
### Testing & Infrastructure (Ongoing):
- Jest and Codecov thresholds aligned and enforced; CI green
- Integration/E2E tests opt-in with clear env guards; CI safe by default
- Python tests measure real plugin logic (with shim) and pass coverage gates
- Resiliency and property-based tests increase robustness of error paths and validators
- Test configuration and documentation are clear and consistent
- Optional transports and richer content outputs improve interoperability without breaking stdio defaults
- Resiliency and property-based tests increase robustness of error paths
- Test configuration and documentation clear and consistent
- Optional transports and richer content outputs improve interoperability
45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![MCP](https://img.shields.io/badge/MCP-Compatible-green)
![Python](https://img.shields.io/badge/Python-3.11+-blue?logo=python)

UEMCP bridges AI assistants with Unreal Engine. This particular implementation splits the MCP server (Node.js) and Python Editor Plugin into two parts so the Unreal Engine editor can be deployed remotely from the AI caller. Additionally, this implementation provides helpful wrappers around common or complex python API methods that would otherwise require heavy python code to be generated. Finally, this repo has automated setup and installation for AI clients and contains rich context for working with UE and for enriching the MCP server and plugin to add more helpful features during development. Unlike other MCP servers that run via a package manager, it is recommended that you clone (and maybe even fork) this repo to get the most out of the experience.
UEMCP bridges AI assistants with Unreal Engine through a two-tier architecture that separates the MCP server (Node.js) from the Python Editor Plugin, enabling remote deployment of Unreal Engine editors. This implementation provides optimized wrappers around common UE Python API operations, reducing code generation by up to 85%. The repository includes automated setup for AI clients, comprehensive development context, and three specialized Claude agents for enhanced UE workflows. Unlike package-managed MCP servers, this repo is designed to be cloned and potentially forked for maximum customization and development flexibility.

<img src="https://github.com/atomantic/UEMCP/releases/download/v1.0.0/uemcp-demo.gif" alt="UEMCP Demo" width="100%">

Expand Down Expand Up @@ -152,7 +152,7 @@ Think of it like this: `python_proxy` is the powerful command line, while other

## 🛠 Available Tools

UEMCP provides 31 tools to Claude for controlling Unreal Engine:
UEMCP provides 39 tools to Claude for controlling Unreal Engine:

### Project & Assets
- **project_info** - Get current project information
Expand Down Expand Up @@ -189,6 +189,13 @@ UEMCP provides 31 tools to Claude for controlling Unreal Engine:
- **material_create** - Create new materials or material instances with customizable parameters
- **material_apply** - Apply materials to actors' static mesh components

### Blueprint Development
- **blueprint_create** - Create new Blueprint classes from C++ or Blueprint parents with components and variables
- **blueprint_list** - List and filter Blueprints in the project with metadata
- **blueprint_info** - Get detailed Blueprint structure including components, variables, functions, and events
- **blueprint_compile** - Compile Blueprints and report compilation status, errors, and warnings
- **blueprint_document** - Generate comprehensive markdown documentation for Blueprint systems

### 🔍 Validation Feature

All actor manipulation tools (`actor_spawn`, `actor_modify`, `actor_delete`, `actor_duplicate`) now support automatic validation to ensure operations succeeded as expected:
Expand Down Expand Up @@ -268,6 +275,38 @@ batch_operations({
- `help({ tool: "actor_spawn" })` - Detailed examples for specific tools
- `help({ category: "viewport" })` - List all tools in a category

### Blueprint Development Workflow
```javascript
// 1. List existing Blueprints in your project
blueprint_list({ path: "/Game/Blueprints" })

// 2. Create a new interactive door Blueprint
blueprint_create({
className: "BP_InteractiveDoor",
parentClass: "Actor",
components: [
{ name: "DoorMesh", type: "StaticMeshComponent" },
{ name: "ProximityTrigger", type: "BoxComponent" }
],
variables: [
{ name: "IsOpen", type: "bool", defaultValue: false },
{ name: "OpenRotation", type: "rotator", defaultValue: [0, 0, 90] }
]
})

// 3. Analyze Blueprint structure
blueprint_info({ blueprintPath: "/Game/Blueprints/BP_InteractiveDoor" })

// 4. Compile and check for errors
blueprint_compile({ blueprintPath: "/Game/Blueprints/BP_InteractiveDoor" })

// 5. Generate documentation
blueprint_document({
blueprintPath: "/Game/Blueprints/BP_InteractiveDoor",
outputPath: "/Game/Documentation/BP_InteractiveDoor.md"
})
```


### Example: Using python_proxy for Complex Operations

Expand Down Expand Up @@ -456,7 +495,7 @@ The diagnostic tests validate all MCP functionality including:
## ⚠️ Known Limitations

### Current MCP Tool Limitations
- **Blueprint Graph Editing**: Cannot programmatically edit Blueprint node graphs (visual scripting logic)
- **Blueprint Graph Editing**: Cannot programmatically edit Blueprint node graphs (visual scripting logic) - but can create, analyze, compile, and document Blueprints
- **Animation Blueprints**: No direct animation state machine or blend tree manipulation
- **Level Streaming**: No dynamic level loading/unloading control

Expand Down
Loading