--- name: xbox-codemode description: "Query Xbox GDK headers/docs, xbox CLI, MicrosoftGame.config, and 763 PlayFab APIs via the xbox-codemode MCP server (search + execute). Use when working on Xbox or PlayFab." category: mcp risk: safe source: self source_type: self license: MIT date_added: "2026-12-04" author: 0xBreadguy tags: [mcp, xbox, gdk, playfab, gamedev, code-mode] --- # Xbox Code Mode ## Overview Use the `xbox-codemode` MCP server (`search` and `execute`) to look up PlayFab REST API schemas, inspect locally installed Xbox GDK headers and public offline docs, validate `MicrosoftGame.config`, decode Xbox/GDK `HRESULT` codes, search `docs.xbox.com` and `Xbox-GDK-Samples`, and run authenticated PlayFab or `xbox` CLI operations inside an isolated QuickJS WASM sandbox. Instead of registering hundreds of individual MCP tools, `xbox-codemode` exposes two tools (`search` for read-only discovery with zero credentials and `execute` for authenticated host-brokered calls). It is an unofficial, MIT-licensed community project and is not affiliated with Microsoft or Xbox. ## When to Use This Skill - The user has `xbox-codemode` connected (or chooses to use it) while developing an Xbox, PC GDK, or PlayFab title. - You need exact PlayFab REST endpoint paths and TypeScript request/response signatures across the 20 PlayFab API groups instead of guessing payloads. - You need to verify pinned GDK C++ header declarations, diff symbols across GDK editions (for example `251000` to `261000`), or check PC (`windows/include`) vs console (`xbox/include`) header parity. - You need to decode a GDK/Xbox `HRESULT` (such as `0x8015DC12` or `0x89240105`), validate `MicrosoftGame.config`, or inspect Partner Center / PlayFab title state via the `xbox` CLI or PlayFab APIs. Do not use this skill for general engine gameplay scripting unrelated to Xbox/GDK/PlayFab (use the dedicated Unity, Unreal, or Godot skills instead), and do not install or modify the user's MCP client configuration without explicit approval. ## Prerequisites The host must have the `xbox-codemode` MCP server configured (for example via stdio using `npx -y xbox-codemode`, requiring Node.js 20+). Installing this skill does not install or register the MCP server. - **Zero-credential mode (`search`):** Catalog search, TypeScript schema inspection, `docs.xbox.com` lookup, public GDK samples, `MicrosoftGame.config` validation, and the built-in HRESULT table work on Linux, macOS, and Windows with no credentials and no GDK installed. - **Authenticated mode (`execute`):** Configure credentials only through the host MCP environment (`PLAYFAB_TITLE_ID`, `PLAYFAB_SECRET_KEY`, or `PLAYFAB_ENTITY_TOKEN`) or an existing `xbox auth login` session. Never place secret values in chat, source files, or shared config files. - **Local GDK inspection:** Requires a local `%GameDK%` installation on Windows or a mounted GDK directory via `XBOX_CODEMODE_GAMEDK_ROOT` / `XBOX_CODEMODE_GDK_EDITION`. Confirm via the host's tool list that `search` and `execute` are exposed (hosts may prefix tool names with the server name). ## How It Works ### 1. Start with read-only discovery (`search`) All helper functions injected into the QuickJS sandbox are async — always `await` them and pass an `async () => { ... }` function. - `find(query, { in, limit })` — BM25 search across `playfab`, `cli`, `docs`, `publishing`, `samples`. - `describe(id)` — Lazy cycle-safe TypeScript request/response signature for a PlayFab operation or `xbox` CLI command. - `gdk.headers.find / diff / parity` — Search declarations, diff two GDK editions, or verify PC vs console parity. - `gdk.hresult(code)` — Decode `0x8...` HRESULTs via `xberror.exe` or the built-in fallback table. - `gdk.gameConfig()` — Parse and validate `MicrosoftGame.config` (`MSAAppId`, `TitleId`, `StoreId`, `SCID`, 4-part version, executable paths). ### 2. Run authenticated calls (`execute`) - `playfab.request(path, body)` or namespace helpers like `playfab.admin.GetTitleData(...)` — Credentials stay host-only; modern Entity, Economy v2, MPS, Lobby, and Matchmaking endpoints automatically exchange `PLAYFAB_SECRET_KEY` for a Title `X-EntityToken` host-side. - `playfab.paginate(path, body, { maxPages, maxItems })` — Bounded pagination returning `{ items, more, truncatedInPage }`. - `xbox.status()`, `xbox.context()`, `xbox.call(argsArray)` — Runs the `xbox` CLI via `execFile` with `shell: false` (pass an argument array, never a shell string). - `results.get(resultId)` — Retrieve and filter large outputs that spilled with `{ truncated: true, resultId }`. ### 3. Verify before finishing GDK edits Before returning GDK C++ or configuration changes, verify `HRESULT` error handling, `XAsync` completion and cancellation paths, handle cleanup (`0x89240105`), `MicrosoftGame.config` validation, and target platform header parity. ## Examples ### Example 1: Look up a PlayFab schema and decode an HRESULT (`search`) ```js async () => { const hits = await find("title data", { in: ["playfab"], limit: 5 }); const sig = await describe("Admin.GetTitleData"); const hr = await gdk.hresult("0x8015DC12"); return { hits, sig, hr }; } ``` ### Example 2: Check GDK header parity and validate `MicrosoftGame.config` (`search`) ```js async () => { const parity = await gdk.headers.parity({ symbols: ["XUserAddAsync", "XStoreQueryGameAndDlcPackageUpdatesAsync"], }); const diff = await gdk.headers.diff({ symbol: "XUserAddAsync", from: "251000", to: "261000", platform: "pc", }); const config = await gdk.gameConfig(); return { parity, diff, config }; } ``` ### Example 3: Read PlayFab title data and paginate segments (`execute`) ```js async () => { const titleData = await playfab.admin.GetTitleData({ Keys: ["Season", "Motd"] }); const segments = await playfab.paginate("/Admin/GetAllSegments", {}, { maxPages: 5, maxItems: 250 }); return { titleData: titleData.data, segmentCount: segments.items.length, more: segments.more, }; } ``` ## Safety and NDA Boundaries - **Read-only by default:** Mutating PlayFab operations and mutating `xbox` CLI commands are blocked unless the user explicitly enables `XBOX_CODEMODE_ALLOW_WRITES=1`. Ask before requesting write access or executing state-changing calls against production titles. - **Host-only credentials:** Guest JS runs in a QuickJS WASM sandbox with no `fs`, `process`, or network access. Credential-minting PlayFab endpoints (such as `/Authentication/GetEntityToken` and `LoginWith*`) are blocked from guest code. - **GDKX NDA filtering:** Offline GDK Markdown documentation enforces `permissioned-type: public` by default and excludes GDKX console headers (`xbox/include`) in `public-only` mode. Never copy `private` or `secret` GDKX material into public repositories or unapproved AI tools. ## Limitations - Local GDK header search, edition diffing, `xberror.exe`, and offline GDK Markdown docs require a locally installed or mounted GDK; on macOS and Linux without a mounted GDK, only the compiled PlayFab/CLI/docs/samples catalog, `MicrosoftGame.config` checks, and built-in HRESULT fallback table are available. - Live `xbox` CLI calls require Microsoft's `xbox` CLI to be installed on `PATH` (or set via `XBOX_CODEMODE_CLI_PATH`) and signed in separately. - The server does not host a shared public remote endpoint; remote HTTP usage requires deploying the repository's optional Cloudflare Worker (`worker/`) to the user's own Cloudflare account. - PlayFab API coverage is compiled from the 20 public `PlayFab/API_Specs` Swagger definitions and may lag newly released undocumented endpoints until the catalog is regenerated.