@uemcp/server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 odinn1984
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # `mcp-server`
2
+
3
+ A TypeScript MCP server built on the official `@modelcontextprotocol/sdk`.
4
+
5
+ ## Overview
6
+
7
+ This project is the MCP-facing side of the monorepo. It uses stdio for MCP transport and is meant to expose MCP tools that call into the Unreal Editor bridge over localhost HTTP.
8
+
9
+ The local registry API currently exposes:
10
+
11
+ - `GET /ping`
12
+ - `PUT /projects/:projectId`
13
+ - `DELETE /projects/:projectId`
14
+
15
+ The MCP tool surface currently exposes:
16
+
17
+ - `get_project_id`
18
+ - `add_module`
19
+ - `ping_project`
20
+ - `build_target`
21
+ - `generate_project_files`
22
+ - `clean_build`
23
+ - `run_clang_tidy`
24
+
25
+ ## Project Identity
26
+
27
+ Engine identity is derived from the Unreal project's `Config/DefaultGame.ini` file, specifically:
28
+
29
+ ```ini
30
+ [/Script/EngineSettings.GeneralProjectSettings]
31
+ ProjectID=E8AD341D43B90136652AFFA4D93F17B4
32
+ ```
33
+
34
+ `PUT /projects/:projectId` no longer trusts a caller-provided ID by shape alone. The server resolves `Config/DefaultGame.ini` from the submitted `projectPath`, extracts `ProjectID`, normalizes it to the canonical 32-character lowercase form, and rejects the registration if the route `projectId` does not match.
35
+
36
+ If `DefaultGame.ini` cannot be read, if the section is missing, or if the `ProjectID` key is missing or invalid, the server logs the resolved file path plus the failure reason and rejects the dependent operation. There is no fallback ID generation.
37
+
38
+ ## MCP Tools
39
+
40
+ ### `get_project_id`
41
+
42
+ - Accepts a project path from the MCP caller
43
+ - Derives `Config/DefaultGame.ini`
44
+ - Reads `[/Script/EngineSettings.GeneralProjectSettings]`
45
+ - Returns the canonical `projectId`
46
+ - Does not consult the in-memory registry
47
+
48
+ This is intended to let an MCP client resolve the canonical Unreal project identity from a known path before calling tools that require that ID.
49
+
50
+ ### `add_module`
51
+
52
+ - Accepts a `descriptorPath` (a `.uproject` or `.uplugin`) and a `moduleName`
53
+ - Scaffolds `Source/<moduleName>/` next to the descriptor: `<moduleName>.Build.cs`, `Public/<moduleName>.h`, and `Private/<moduleName>.cpp` with `IMPLEMENT_MODULE`
54
+ - Registers the module in the descriptor's `Modules` array (`Type` defaults to `Runtime`, `LoadingPhase` to `Default`)
55
+ - Refuses to overwrite an existing module name or `Source/<moduleName>` directory
56
+ - Pure filesystem scaffold; it does not consult the registry or a running editor. Run project-file generation and a build afterward to compile the module.
57
+
58
+ ### `ping_project`
59
+
60
+ - Accepts a canonical `projectId`
61
+ - Looks up the registered Unreal engine bridge in memory
62
+ - Pings the bridge over localhost HTTP
63
+ - Retries with named constants:
64
+ - `maxRetries = 3`
65
+ - `initialDelayMs = 500`
66
+ - `retryMultiplier = 2.0`
67
+ - Uses retry delays of approximately `500ms`, `1s`, and `2s`
68
+ - Removes the stale registration from memory and persists the cleanup if the bridge remains dead after retries
69
+
70
+ ### `build_target` / `generate_project_files` / `clean_build`
71
+
72
+ - Resolve the engine from the `.uproject` `EngineAssociation` (or an explicit `engineVersion`) under `UE_INSTALLS_DIR`
73
+ - Spawn `UnrealBuildTool` as a child process: on macOS/Linux the engine-bundled `dotnet` runs the UBT `.dll` (falling back to `dotnet` on `PATH` if the bundle is absent); on Windows the `.exe` runs directly
74
+ - `build_target` returns pass/fail plus parsed error/warning diagnostics; `clean_build` adds `-Clean`; `generate_project_files` runs `-Mode=GenerateProjectFiles`
75
+ - `build_target`/`clean_build` refuse to run when the project's editor is registered and reachable (link conflicts on Windows, ignored output on macOS/Linux) — pass `force: true` to override
76
+ - Do not require a running editor
77
+
78
+ ### `run_clang_tidy`
79
+
80
+ - Reads the synced `compile_commands.json` from the provided `compileCommandsDir`
81
+ - Spawns `clang-tidy` (server-configured via `CLANG_TIDY_PATH`, else `PATH`) over the translation units and returns structured findings (file, line, column, check, severity, message)
82
+ - Report only — does not apply fixes
83
+
84
+ ## Configuration
85
+
86
+ - Engine toolchain (`build_target`, `generate_project_files`, `clean_build`):
87
+ - `UE_INSTALLS_DIR` — base directory holding installed engines (`UE_<version>`)
88
+ - `run_clang_tidy`:
89
+ - `CLANG_TIDY_PATH` — optional clang-tidy binary override
90
+ - Local HTTP registry API:
91
+ - `MCP_SERVER_HTTP_HOST`
92
+ - `MCP_SERVER_HTTP_PORT`
93
+ - Logging:
94
+ - `MCP_SERVER_LOG_LEVEL`
95
+ - `MCP_SERVER_LOG_FORMAT`
96
+
97
+ ## Install
98
+
99
+ ```bash
100
+ npm install
101
+ ```
102
+
103
+ ## Run
104
+
105
+ ```bash
106
+ npm run dev
107
+ npm run lint:fix
108
+ npm run typecheck
109
+ npm run build
110
+ npm start
111
+ ```
@@ -0,0 +1 @@
1
+ export {}