/** * The **engine-adapter contract** (auth-fixes design 02 §T7 / decision D1+D4) — the single typed seam * that carries every per-engine difference so the rest of cli-core (agents-registry, setup-mcp, * install-plugin, enroll, server-download) stays engine-agnostic. There is **zero engine-specific * hard-coding anywhere outside an {@link EngineAdapter} definition**: the three CLIs each pass their * adapter into the shared policy functions. * * What the adapter parameterizes (the §T7 list): * - **serverName** — the MCP server-entry name written into agent configs * (`ai-game-developer` for Unity/Godot, `unreal-mcp` for Unreal). * - **project markers** — how to recognise this engine's project root * (`Packages/manifest.json` / any `*.uproject` / `project.godot`), used by the T5 install-plugin * marker probe. * - **stdio support flag + stdio-args vector** — whether the plugin supports the stdio transport * (Godot is http-only) and the exact server args a stdio config emits. * - **install-dir layout** — where the RID-matched `gamedev-mcp-server` binary is installed * (`Library/mcp-server/` vs `Intermediate/UnrealMCP/server/` vs `.ai-game-dev/server`). * - **login project-sink** — the {@link EngineAdapter.loginServerTarget} that yields the AS-root * `serverTarget` recorded on the credential (b2 security review MED-2 — NEVER a pinned hub URL). * - **OAuth client_id** — the per-product device-flow client id. */ /** The three supported engines. */ export type EngineId = "unity" | "unreal" | "godot"; /** Base name of the shared MCP server binary released from `IvanMurzak/GameDev-MCP-Server`. */ export declare const SERVER_BINARY_BASENAME = "gamedev-mcp-server"; /** * How to recognise an engine's project root. `file` matches an exact relative path; `ext` matches any * file with the given extension inside `dir` (default the project root) — the shape a `*.uproject` * probe needs, since the file's basename is the user's project name. */ export type ProjectMarkerSpec = { kind: "file"; relativePath: string; } | { kind: "ext"; ext: string; dir?: string; }; /** Parameters for building a stdio server-args vector. */ export interface StdioArgsParams { /** The deterministic local port (from ProjectIdentity, or an override). */ port: number; /** The plugin/client timeout in ms. */ timeoutMs: number; /** The `authorization` mode arg value (`none` / `required`). */ authorization: string; /** The token to embed as `token=` — only when an explicit PAT opt-in requires it. */ token?: string; } /** The typed per-engine seam every cli-core policy function consumes. */ export interface EngineAdapter { /** Which engine this adapter is for. */ readonly engine: EngineId; /** OAuth product client id (`unity-mcp-cli` / `unreal-mcp-cli` / `godot-cli`). */ readonly clientId: string; /** The canonical MCP server-entry name written under an agent config's body path. */ readonly serverName: string; /** Ordered project-root marker probes (T5); the first match identifies the project. */ readonly markers: readonly ProjectMarkerSpec[]; /** Whether this engine's plugin supports the stdio transport (Godot is http-only — decision M6). */ readonly stdioSupported: boolean; /** Build the stdio server-args vector for this engine. */ stdioArgs(params: StdioArgsParams): string[]; /** The RID-matched server-binary install directory for a project root (engine-specific layout). */ serverInstallDir(projectRoot: string, platform?: NodeJS.Platform, arch?: string): string; /** The absolute server-binary path for a project root. */ serverBinaryPath(projectRoot: string, platform?: NodeJS.Platform, arch?: string): string; /** * The login/enroll project-sink `serverTarget`: reduce any connection URL to the **AS root** to * record on the credential (b2 MED-2). A pinned `/mcp/p/` hub URL is NEVER recorded — the pin * is a routing segment, not an auth base; recording it would send `{base}/oauth/token` refresh to * the wrong URL and break auth. Composes {@link normalizeServerBase} with a pin-strip so a pinned * URL, a canonical `/mcp` URL, and a bare host all collapse to the same AS root. */ loginServerTarget(connectionUrl: string): string; } /** The RID string (`-`) for a platform/arch — the GameDev-MCP-Server release-asset RID. */ export declare function ridForPlatform(platform?: NodeJS.Platform, arch?: string): string; /** The server executable file name for a platform (`gamedev-mcp-server` / `…​.exe`). */ export declare function serverExecutableName(platform?: NodeJS.Platform): string; /** The MCP-server arg names (mirror C# `Consts.MCP.Server.Args`). */ export declare const SERVER_ARG_NAMES: { readonly port: "port"; readonly pluginTimeout: "plugin-timeout"; readonly clientTransport: "client-transport"; readonly authorization: "authorization"; readonly token: "token"; }; /** * The shared stdio server-args vector (identical across engines — the arg names are the MCP server's, * not the engine's). A `token=` arg is appended only when a token is supplied (an explicit PAT * opt-in; the credential-free default omits it — decision M7). */ export declare function defaultStdioArgs(params: StdioArgsParams): string[]; /** * Reduce a connection URL to the authorization-server root (the {@link EngineAdapter.loginServerTarget} * implementation shared by all adapters). Strips a trailing `/p/<8-hex>` routing-pin segment, then a * trailing `/mcp` (via {@link normalizeServerBase}), then a trailing slash — so * `https://ai-game.dev/mcp/p/34ea75f2`, `https://ai-game.dev/mcp`, and `https://ai-game.dev` all * collapse to `https://ai-game.dev`. Returns the input trimmed of a trailing slash when it cannot be * reduced (never returns empty for a non-empty input). */ export declare function toAuthServerRoot(connectionUrl: string): string; /** * Unity: server-entry `ai-game-developer`; project marker `Packages/manifest.json`; stdio supported; * server installed under `/Library/mcp-server//` (matches the CLI's * `resolveServerBinaryPath`). */ export declare const unityAdapter: EngineAdapter; /** * Unreal: server-entry `unreal-mcp`; project marker any `*.uproject` in the root; stdio supported; * server installed under `/Intermediate/UnrealMCP/server//` (matches the CLI's §6 layout). */ export declare const unrealAdapter: EngineAdapter; /** * Godot: server-entry `ai-game-developer`; project marker `project.godot`; **stdio NOT supported** * (http-only — decision M6); server installed FLAT under `/.ai-game-dev/server/` (matches * the CLI's managed dir — no RID subfolder). */ export declare const godotAdapter: EngineAdapter; /** The built-in adapters, keyed by engine. */ export declare const engineAdapters: Readonly>; /** Look up a built-in adapter by engine id. */ export declare function getEngineAdapter(engine: EngineId): EngineAdapter; //# sourceMappingURL=engine-adapter.d.ts.map