unreal-engine-mcp-server 0.4.3 → 0.4.5
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/.env.production +1 -1
- package/.github/workflows/publish-mcp.yml +2 -1
- package/.github/workflows/smithery-build.yml +29 -0
- package/CHANGELOG.md +26 -0
- package/README.md +13 -2
- package/claude_desktop_config_example.json +2 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.js +40 -14
- package/dist/tools/consolidated-tool-definitions.d.ts +43 -0
- package/dist/tools/consolidated-tool-definitions.js +126 -116
- package/dist/tools/landscape.js +77 -15
- package/dist/unreal-bridge.d.ts +8 -3
- package/dist/unreal-bridge.js +25 -35
- package/dist/utils/error-handler.d.ts +40 -0
- package/dist/utils/error-handler.js +75 -0
- package/dist/utils/http.js +80 -3
- package/dist/utils/response-validator.js +6 -1
- package/docs/unreal-tool-test-cases.md +572 -0
- package/eslint.config.mjs +68 -0
- package/package.json +18 -9
- package/server.json +8 -2
- package/smithery.yaml +29 -0
- package/src/index.ts +37 -14
- package/src/tools/consolidated-tool-definitions.ts +126 -116
- package/src/tools/landscape.ts +77 -15
- package/src/unreal-bridge.ts +28 -31
- package/src/utils/error-handler.ts +113 -1
- package/src/utils/http.ts +102 -3
- package/src/utils/response-validator.ts +7 -2
- package/tsconfig.json +36 -13
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tseslintPlugin from '@typescript-eslint/eslint-plugin';
|
|
3
|
+
import tsParser from '@typescript-eslint/parser';
|
|
4
|
+
import { dirname } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
const tsRecommendedConfigs = tseslintPlugin.configs['flat/recommended'].map((config) => ({
|
|
10
|
+
...config,
|
|
11
|
+
languageOptions: {
|
|
12
|
+
...config.languageOptions,
|
|
13
|
+
parser: tsParser,
|
|
14
|
+
parserOptions: {
|
|
15
|
+
...(config.languageOptions?.parserOptions ?? {}),
|
|
16
|
+
ecmaVersion: 2022,
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
tsconfigRootDir: __dirname,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
export default [
|
|
24
|
+
{
|
|
25
|
+
ignores: [
|
|
26
|
+
'dist/**',
|
|
27
|
+
'node_modules/**',
|
|
28
|
+
'**/*.js',
|
|
29
|
+
'**/*.d.ts',
|
|
30
|
+
'**/*.cjs',
|
|
31
|
+
'**/*.mjs',
|
|
32
|
+
'eslint.config.*',
|
|
33
|
+
'vitest.config.ts',
|
|
34
|
+
'test-*.js',
|
|
35
|
+
'tests/**/*.mjs',
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
js.configs.recommended,
|
|
39
|
+
...tsRecommendedConfigs,
|
|
40
|
+
{
|
|
41
|
+
files: ['**/*.ts'],
|
|
42
|
+
rules: {
|
|
43
|
+
'@typescript-eslint/no-unused-vars': [
|
|
44
|
+
'warn',
|
|
45
|
+
{
|
|
46
|
+
args: 'all',
|
|
47
|
+
argsIgnorePattern: '^_',
|
|
48
|
+
caughtErrors: 'all',
|
|
49
|
+
caughtErrorsIgnorePattern: '^_',
|
|
50
|
+
destructuredArrayIgnorePattern: '^_',
|
|
51
|
+
varsIgnorePattern: '^_',
|
|
52
|
+
ignoreRestSiblings: true,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
56
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
57
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
58
|
+
'no-console': 'off',
|
|
59
|
+
semi: ['error', 'always'],
|
|
60
|
+
quotes: ['error', 'single', { avoidEscape: true }],
|
|
61
|
+
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
62
|
+
'no-useless-escape': 'warn',
|
|
63
|
+
'no-case-declarations': 'off',
|
|
64
|
+
'prefer-const': 'warn',
|
|
65
|
+
'no-unused-vars': 'off',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
];
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unreal-engine-mcp-server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"mcpName": "io.github.ChiR24/unreal-engine-mcp",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal Engine via Remote Control API. Built with TypeScript and designed for game development automation.",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"module": "src/index.ts",
|
|
7
8
|
"main": "dist/index.js",
|
|
8
9
|
"types": "dist/index.d.ts",
|
|
9
10
|
"bin": {
|
|
@@ -11,13 +12,19 @@
|
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "tsc -p tsconfig.json",
|
|
14
|
-
"
|
|
15
|
-
|
|
15
|
+
"build:watch": "tsc -p tsconfig.json --watch",
|
|
16
|
+
"start": "node dist/cli.js",
|
|
17
|
+
"smithery:dev": "npx @smithery/cli dev",
|
|
18
|
+
"smithery:build": "npx @smithery/cli build",
|
|
19
|
+
"smithery:ci": "npm run build && npx @smithery/cli build",
|
|
20
|
+
"dev": "ts-node-esm src/cli.ts",
|
|
16
21
|
"lint": "eslint . --ext .ts",
|
|
17
22
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
18
23
|
"clean": "rimraf dist",
|
|
19
24
|
"prepare": "npm run build",
|
|
20
|
-
"test:tools": "node tests/run-unreal-tool-tests.mjs"
|
|
25
|
+
"test:tools": "node tests/run-unreal-tool-tests.mjs",
|
|
26
|
+
"type-check": "tsc --noEmit",
|
|
27
|
+
"prebuild": "npm run clean"
|
|
21
28
|
},
|
|
22
29
|
"engines": {
|
|
23
30
|
"node": ">=18"
|
|
@@ -35,7 +42,8 @@
|
|
|
35
42
|
"author": "Unreal Engine MCP Team",
|
|
36
43
|
"license": "MIT",
|
|
37
44
|
"dependencies": {
|
|
38
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.19.1",
|
|
46
|
+
"zod": "^3.22.2",
|
|
39
47
|
"ajv": "^8.17.1",
|
|
40
48
|
"axios": "^1.12.2",
|
|
41
49
|
"dotenv": "^16.4.5",
|
|
@@ -47,9 +55,10 @@
|
|
|
47
55
|
"@types/json5": "^0.0.30",
|
|
48
56
|
"@types/node": "^20.12.7",
|
|
49
57
|
"@types/ws": "^8.5.10",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"eslint": "^
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.44.1",
|
|
59
|
+
"@typescript-eslint/parser": "^8.44.1",
|
|
60
|
+
"eslint": "^9.36.0",
|
|
61
|
+
"@smithery/cli": "^1.0.0",
|
|
53
62
|
"rimraf": "^6.0.1",
|
|
54
63
|
"ts-node": "^10.9.2",
|
|
55
64
|
"typescript": "^5.4.5"
|
package/server.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-16/server.schema.json",
|
|
3
3
|
"name": "io.github.ChiR24/unreal-engine-mcp",
|
|
4
4
|
"description": "MCP server for Unreal Engine 5 with 13 tools for game development automation.",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.5",
|
|
6
6
|
"packages": [
|
|
7
7
|
{
|
|
8
8
|
"registryType": "npm",
|
|
9
9
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
10
10
|
"identifier": "unreal-engine-mcp-server",
|
|
11
|
-
"version": "0.4.
|
|
11
|
+
"version": "0.4.5",
|
|
12
12
|
"transport": {
|
|
13
13
|
"type": "stdio"
|
|
14
14
|
},
|
|
@@ -36,6 +36,12 @@
|
|
|
36
36
|
"description": "Logging level: debug, info, warn, error (default: info)",
|
|
37
37
|
"isRequired": false,
|
|
38
38
|
"value": "info"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "UE_PROJECT_PATH",
|
|
42
|
+
"description": "Absolute path to your Unreal .uproject file",
|
|
43
|
+
"isRequired": false,
|
|
44
|
+
"value": "C:/Users/YourName/Documents/Unreal Projects/YourProject"
|
|
39
45
|
}
|
|
40
46
|
]
|
|
41
47
|
}
|
package/smithery.yaml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: "Unreal Engine MCP"
|
|
2
|
+
description: "A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal Engine via Remote Control API. Built with TypeScript and designed for game development automation."
|
|
3
|
+
runtime: "typescript"
|
|
4
|
+
env:
|
|
5
|
+
NODE_ENV: "production"
|
|
6
|
+
LOG_LEVEL: "info"
|
|
7
|
+
UE_PROJECT_PATH: "C:/Users/YourName/Documents/Unreal Projects/YourProject"
|
|
8
|
+
# Session configuration hints (served by the exported Zod configSchema in src/index.ts)
|
|
9
|
+
sessionConfig:
|
|
10
|
+
ueHost:
|
|
11
|
+
type: string
|
|
12
|
+
description: "Unreal Engine host (e.g., 127.0.0.1)"
|
|
13
|
+
default: "127.0.0.1"
|
|
14
|
+
ueHttpPort:
|
|
15
|
+
type: number
|
|
16
|
+
description: "Remote Control HTTP port"
|
|
17
|
+
default: 30010
|
|
18
|
+
ueWsPort:
|
|
19
|
+
type: number
|
|
20
|
+
description: "Remote Control WS port"
|
|
21
|
+
default: 30011
|
|
22
|
+
logLevel:
|
|
23
|
+
type: string
|
|
24
|
+
description: "Server log verbosity"
|
|
25
|
+
default: "info"
|
|
26
|
+
projectPath:
|
|
27
|
+
type: string
|
|
28
|
+
description: "Absolute path to your .uproject file"
|
|
29
|
+
default: "C:/Users/YourName/Documents/Unreal Projects/YourProject"
|
package/src/index.ts
CHANGED
|
@@ -40,10 +40,11 @@ import {
|
|
|
40
40
|
GetPromptRequestSchema
|
|
41
41
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
42
42
|
import { responseValidator } from './utils/response-validator.js';
|
|
43
|
-
import {
|
|
43
|
+
import { z } from 'zod';
|
|
44
44
|
import { routeStdoutLogsToStderr } from './utils/stdio-redirect.js';
|
|
45
|
-
import { cleanObject } from './utils/safe-json.js';
|
|
46
45
|
import { createElicitationHelper } from './utils/elicitation.js';
|
|
46
|
+
import { cleanObject } from './utils/safe-json.js';
|
|
47
|
+
import { ErrorHandler } from './utils/error-handler.js';
|
|
47
48
|
|
|
48
49
|
const log = new Logger('UE-MCP');
|
|
49
50
|
|
|
@@ -87,7 +88,7 @@ const CONFIG = {
|
|
|
87
88
|
RETRY_DELAY_MS: 2000,
|
|
88
89
|
// Server info
|
|
89
90
|
SERVER_NAME: 'unreal-engine-mcp',
|
|
90
|
-
SERVER_VERSION: '0.4.
|
|
91
|
+
SERVER_VERSION: '0.4.5',
|
|
91
92
|
// Monitoring
|
|
92
93
|
HEALTH_CHECK_INTERVAL_MS: 30000 // 30 seconds
|
|
93
94
|
};
|
|
@@ -143,7 +144,7 @@ async function performHealthCheck(bridge: UnrealBridge): Promise<boolean> {
|
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
export
|
|
147
|
+
export function createServer() {
|
|
147
148
|
const bridge = new UnrealBridge();
|
|
148
149
|
// Disable auto-reconnect loops; connect only on-demand
|
|
149
150
|
bridge.setAutoReconnectEnabled(false);
|
|
@@ -249,8 +250,7 @@ export async function createServer() {
|
|
|
249
250
|
prompts: {
|
|
250
251
|
listChanged: false
|
|
251
252
|
},
|
|
252
|
-
logging: {}
|
|
253
|
-
elicitation: {}
|
|
253
|
+
logging: {}
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
);
|
|
@@ -677,8 +677,37 @@ export async function createServer() {
|
|
|
677
677
|
return { server, bridge };
|
|
678
678
|
}
|
|
679
679
|
|
|
680
|
+
// Export configuration schema for Smithery session UI and validation
|
|
681
|
+
export const configSchema = z.object({
|
|
682
|
+
ueHost: z.string().optional().default('127.0.0.1').describe('Unreal Engine host (e.g. 127.0.0.1)'),
|
|
683
|
+
ueHttpPort: z.number().int().optional().default(30010).describe('Remote Control HTTP port'),
|
|
684
|
+
ueWsPort: z.number().int().optional().default(30020).describe('Remote Control WebSocket port'),
|
|
685
|
+
logLevel: z.enum(['debug', 'info', 'warn', 'error']).optional().default('info').describe('Runtime log level'),
|
|
686
|
+
projectPath: z.string().optional().default('C:/Users/YourName/Documents/Unreal Projects/YourProject').describe('Absolute path to your Unreal .uproject file')
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
// Default export expected by Smithery TypeScript runtime. Accepts an optional config object
|
|
690
|
+
// and injects values into the environment before creating the server.
|
|
691
|
+
export default function createServerDefault({ config }: { config?: any } = {}) {
|
|
692
|
+
try {
|
|
693
|
+
if (config) {
|
|
694
|
+
if (typeof config.ueHost === 'string' && config.ueHost.trim()) process.env.UE_HOST = config.ueHost;
|
|
695
|
+
if (config.ueHttpPort !== undefined) process.env.UE_RC_HTTP_PORT = String(config.ueHttpPort);
|
|
696
|
+
if (config.ueWsPort !== undefined) process.env.UE_RC_WS_PORT = String(config.ueWsPort);
|
|
697
|
+
if (typeof config.logLevel === 'string') process.env.LOG_LEVEL = config.logLevel;
|
|
698
|
+
if (typeof config.projectPath === 'string' && config.projectPath.trim()) process.env.UE_PROJECT_PATH = config.projectPath;
|
|
699
|
+
}
|
|
700
|
+
} catch (e) {
|
|
701
|
+
// Non-fatal: log and continue (console to avoid circular logger dependencies at top-level)
|
|
702
|
+
console.debug('[createServerDefault] Failed to apply config to environment:', (e as any)?.message || e);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
const { server } = createServer();
|
|
706
|
+
return server;
|
|
707
|
+
}
|
|
708
|
+
|
|
680
709
|
export async function startStdioServer() {
|
|
681
|
-
const { server } =
|
|
710
|
+
const { server } = createServer();
|
|
682
711
|
const transport = new StdioServerTransport();
|
|
683
712
|
|
|
684
713
|
// Add debugging for transport messages
|
|
@@ -695,10 +724,4 @@ export async function startStdioServer() {
|
|
|
695
724
|
log.info('Unreal Engine MCP Server started on stdio');
|
|
696
725
|
}
|
|
697
726
|
|
|
698
|
-
//
|
|
699
|
-
if (import.meta.url === `file://${process.argv[1].replace(/\\/g, '/')}`) {
|
|
700
|
-
startStdioServer().catch(error => {
|
|
701
|
-
console.error('Failed to start server:', error);
|
|
702
|
-
process.exit(1);
|
|
703
|
-
});
|
|
704
|
-
}
|
|
727
|
+
// Direct execution is handled via src/cli.ts to keep this module side-effect free.
|