@remix-gg/mcp 0.4.3

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.
Files changed (139) hide show
  1. package/README.md +81 -0
  2. package/dist/client-helpers/index.d.ts +2 -0
  3. package/dist/client-helpers/index.d.ts.map +1 -0
  4. package/dist/client-helpers/index.js +2 -0
  5. package/dist/client-helpers/index.js.map +1 -0
  6. package/dist/config.d.ts +20 -0
  7. package/dist/config.d.ts.map +1 -0
  8. package/dist/config.js +58 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/core/api-client.d.ts +4 -0
  11. package/dist/core/api-client.d.ts.map +1 -0
  12. package/dist/core/api-client.js +12 -0
  13. package/dist/core/api-client.js.map +1 -0
  14. package/dist/core/config.d.ts +6 -0
  15. package/dist/core/config.d.ts.map +1 -0
  16. package/dist/core/config.js +19 -0
  17. package/dist/core/config.js.map +1 -0
  18. package/dist/core/index.d.ts +5 -0
  19. package/dist/core/index.d.ts.map +1 -0
  20. package/dist/core/index.js +4 -0
  21. package/dist/core/index.js.map +1 -0
  22. package/dist/core/skills.d.ts +22 -0
  23. package/dist/core/skills.d.ts.map +1 -0
  24. package/dist/core/skills.js +49 -0
  25. package/dist/core/skills.js.map +1 -0
  26. package/dist/core/tool-defs.d.ts +12 -0
  27. package/dist/core/tool-defs.d.ts.map +1 -0
  28. package/dist/core/tool-defs.js +356 -0
  29. package/dist/core/tool-defs.js.map +1 -0
  30. package/dist/core/tools/create-game.d.ts +9 -0
  31. package/dist/core/tools/create-game.d.ts.map +1 -0
  32. package/dist/core/tools/create-game.js +21 -0
  33. package/dist/core/tools/create-game.js.map +1 -0
  34. package/dist/core/tools/create-shop-item.d.ts +14 -0
  35. package/dist/core/tools/create-shop-item.d.ts.map +1 -0
  36. package/dist/core/tools/create-shop-item.js +78 -0
  37. package/dist/core/tools/create-shop-item.js.map +1 -0
  38. package/dist/core/tools/delete-shop-item.d.ts +9 -0
  39. package/dist/core/tools/delete-shop-item.d.ts.map +1 -0
  40. package/dist/core/tools/delete-shop-item.js +19 -0
  41. package/dist/core/tools/delete-shop-item.js.map +1 -0
  42. package/dist/core/tools/generate-image.d.ts +8 -0
  43. package/dist/core/tools/generate-image.d.ts.map +1 -0
  44. package/dist/core/tools/generate-image.js +32 -0
  45. package/dist/core/tools/generate-image.js.map +1 -0
  46. package/dist/core/tools/generate-sprite-sheet.d.ts +14 -0
  47. package/dist/core/tools/generate-sprite-sheet.d.ts.map +1 -0
  48. package/dist/core/tools/generate-sprite-sheet.js +29 -0
  49. package/dist/core/tools/generate-sprite-sheet.js.map +1 -0
  50. package/dist/core/tools/helpers.d.ts +60 -0
  51. package/dist/core/tools/helpers.d.ts.map +1 -0
  52. package/dist/core/tools/helpers.js +68 -0
  53. package/dist/core/tools/helpers.js.map +1 -0
  54. package/dist/core/tools/index.d.ts +13 -0
  55. package/dist/core/tools/index.d.ts.map +1 -0
  56. package/dist/core/tools/index.js +13 -0
  57. package/dist/core/tools/index.js.map +1 -0
  58. package/dist/core/tools/list-shop-items.d.ts +8 -0
  59. package/dist/core/tools/list-shop-items.d.ts.map +1 -0
  60. package/dist/core/tools/list-shop-items.js +17 -0
  61. package/dist/core/tools/list-shop-items.js.map +1 -0
  62. package/dist/core/tools/update-game.d.ts +11 -0
  63. package/dist/core/tools/update-game.d.ts.map +1 -0
  64. package/dist/core/tools/update-game.js +22 -0
  65. package/dist/core/tools/update-game.js.map +1 -0
  66. package/dist/core/tools/update-shop-item.d.ts +15 -0
  67. package/dist/core/tools/update-shop-item.d.ts.map +1 -0
  68. package/dist/core/tools/update-shop-item.js +24 -0
  69. package/dist/core/tools/update-shop-item.js.map +1 -0
  70. package/dist/core/tools/upload-game-asset.d.ts +8 -0
  71. package/dist/core/tools/upload-game-asset.d.ts.map +1 -0
  72. package/dist/core/tools/upload-game-asset.js +43 -0
  73. package/dist/core/tools/upload-game-asset.js.map +1 -0
  74. package/dist/core/tools/upload-version.d.ts +8 -0
  75. package/dist/core/tools/upload-version.d.ts.map +1 -0
  76. package/dist/core/tools/upload-version.js +20 -0
  77. package/dist/core/tools/upload-version.js.map +1 -0
  78. package/dist/core/tools/validate-game.d.ts +6 -0
  79. package/dist/core/tools/validate-game.d.ts.map +1 -0
  80. package/dist/core/tools/validate-game.js +41 -0
  81. package/dist/core/tools/validate-game.js.map +1 -0
  82. package/dist/core/tools.test.d.ts +2 -0
  83. package/dist/core/tools.test.d.ts.map +1 -0
  84. package/dist/core/tools.test.js +825 -0
  85. package/dist/core/tools.test.js.map +1 -0
  86. package/dist/generated/server-api.d.ts +3673 -0
  87. package/dist/generated/server-api.d.ts.map +1 -0
  88. package/dist/generated/server-api.js +2 -0
  89. package/dist/generated/server-api.js.map +1 -0
  90. package/dist/index.d.ts +3 -0
  91. package/dist/index.d.ts.map +1 -0
  92. package/dist/index.js +365 -0
  93. package/dist/index.js.map +1 -0
  94. package/dist/server/create-server.d.ts +12 -0
  95. package/dist/server/create-server.d.ts.map +1 -0
  96. package/dist/server/create-server.js +29 -0
  97. package/dist/server/create-server.js.map +1 -0
  98. package/dist/server/create-server.test.d.ts +2 -0
  99. package/dist/server/create-server.test.d.ts.map +1 -0
  100. package/dist/server/create-server.test.js +37 -0
  101. package/dist/server/create-server.test.js.map +1 -0
  102. package/dist/server/index.d.ts +3 -0
  103. package/dist/server/index.d.ts.map +1 -0
  104. package/dist/server/index.js +8 -0
  105. package/dist/server/index.js.map +1 -0
  106. package/dist/server/lib/config.d.ts +2 -0
  107. package/dist/server/lib/config.d.ts.map +1 -0
  108. package/dist/server/lib/config.js +2 -0
  109. package/dist/server/lib/config.js.map +1 -0
  110. package/dist/server/resources/skills.d.ts +3 -0
  111. package/dist/server/resources/skills.d.ts.map +1 -0
  112. package/dist/server/resources/skills.js +60 -0
  113. package/dist/server/resources/skills.js.map +1 -0
  114. package/dist/server/resources/skills.test.d.ts +2 -0
  115. package/dist/server/resources/skills.test.d.ts.map +1 -0
  116. package/dist/server/resources/skills.test.js +44 -0
  117. package/dist/server/resources/skills.test.js.map +1 -0
  118. package/dist/server/tools/register.d.ts +3 -0
  119. package/dist/server/tools/register.d.ts.map +1 -0
  120. package/dist/server/tools/register.js +26 -0
  121. package/dist/server/tools/register.js.map +1 -0
  122. package/dist/server/tools/register.test.d.ts +2 -0
  123. package/dist/server/tools/register.test.d.ts.map +1 -0
  124. package/dist/server/tools/register.test.js +85 -0
  125. package/dist/server/tools/register.test.js.map +1 -0
  126. package/dist/types.d.ts +73 -0
  127. package/dist/types.d.ts.map +1 -0
  128. package/dist/types.js +31 -0
  129. package/dist/types.js.map +1 -0
  130. package/package.json +38 -0
  131. package/skills/SKILL.md +82 -0
  132. package/skills/actions/open-game.md +18 -0
  133. package/skills/workflows/add-image-to-game.md +121 -0
  134. package/skills/workflows/add-sprite-to-game.md +127 -0
  135. package/skills/workflows/game-creation.md +124 -0
  136. package/skills/workflows/implement-multiplayer.md +355 -0
  137. package/skills/workflows/integrate-save-game.md +135 -0
  138. package/skills/workflows/manage-shop-items.md +246 -0
  139. package/skills/workflows/upload-game.md +74 -0
@@ -0,0 +1,121 @@
1
+ # Add Image to Game Workflow
2
+
3
+ ## Overview
4
+
5
+ This skill guides you through generating an AI image and integrating its hosted
6
+ URL into your game HTML. The `generateImage` tool handles generation **and**
7
+ upload in one step, returning a hosted URL directly.
8
+
9
+ ## Prerequisites
10
+
11
+ - The game HTML file must already exist (follow the **game-creation** workflow
12
+ first if starting from scratch).
13
+ - A game must be created on the Remix platform (you need a game ID for
14
+ `generateImage`).
15
+
16
+ ## Steps
17
+
18
+ ### 1. Check for Existing Game ID
19
+
20
+ **IMPORTANT: Do NOT call `createGame` without checking first.**
21
+
22
+ Read `.remix-settings.json` in the current directory. If it exists and contains
23
+ a `gameId`, use that value — the game is already created and you can skip
24
+ straight to step 2.
25
+
26
+ Only if `.remix-settings.json` does not exist or has no `gameId` should you
27
+ follow the **upload-game** workflow to create one.
28
+
29
+ ### 2. Generate and Upload the Image
30
+
31
+ Call `generateImage` with the game ID and a descriptive prompt. The tool
32
+ generates the image, uploads it as a game asset, and returns a text block
33
+ containing the hosted URL.
34
+
35
+ ```
36
+ generateImage({
37
+ gameId: "<your-game-id>",
38
+ prompt: "a pixel-art treasure chest on a grassy hill",
39
+ fileName: "treasure-chest" // optional — defaults to a slugified prompt
40
+ })
41
+ ```
42
+
43
+ The `fileName` is just a base name without extension — the file extension is
44
+ determined by the image format returned from the server. Prompts do not need to
45
+ specify transparency, background removal, or other formatting details — the
46
+ server augments prompts automatically for game-ready output.
47
+
48
+ The response is a single **text** block with the asset URL, file name, and
49
+ prompt. No base64 image data is returned.
50
+
51
+ ### 3. Integrate the URL into the Game
52
+
53
+ Add the asset URL to the game HTML. **Size the image to match the game entity
54
+ it represents** — do not render it at its native resolution. For example, if a
55
+ treasure chest is a 32x32 tile in your game, draw or display the image at 32x32
56
+ regardless of the source image dimensions.
57
+
58
+ The integration method depends on how the image is used:
59
+
60
+ **As an HTML image element:**
61
+ ```html
62
+ <img src="https://returned-asset-url.png" alt="Treasure chest" width="32" height="32" />
63
+ ```
64
+
65
+ **As a CSS background:**
66
+ ```css
67
+ .game-bg {
68
+ background-image: url("https://returned-asset-url.png");
69
+ }
70
+ ```
71
+
72
+ **As a JavaScript-loaded image (for canvas games):**
73
+ ```js
74
+ const img = new Image();
75
+ img.src = "https://returned-asset-url.png";
76
+ img.onload = () => {
77
+ // draw at the entity's size, not the image's native size
78
+ ctx.drawImage(img, x, y, entityWidth, entityHeight);
79
+ };
80
+ ```
81
+
82
+ ## Examples
83
+
84
+ ### Adding a Background to a Canvas Game
85
+
86
+ ```js
87
+ const bg = new Image();
88
+ bg.src = "https://uploaded-asset-url/background.png";
89
+ bg.onload = () => {
90
+ function draw() {
91
+ ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
92
+ // draw game objects on top...
93
+ requestAnimationFrame(draw);
94
+ }
95
+ draw();
96
+ };
97
+ ```
98
+
99
+ ### Adding a Sprite Sheet
100
+
101
+ ```js
102
+ const spriteSheet = new Image();
103
+ spriteSheet.src = "https://uploaded-asset-url/player-sprites.png";
104
+ spriteSheet.onload = () => {
105
+ // draw a 32x32 frame from the sprite sheet
106
+ ctx.drawImage(spriteSheet, frameX, frameY, 32, 32, player.x, player.y, 32, 32);
107
+ };
108
+ ```
109
+
110
+ ## Tips
111
+
112
+ - **Be specific in prompts.** Include art style, color palette, and context
113
+ (e.g. "pixel-art 16-bit style red dragon"). No need to specify transparency
114
+ or background handling — the server takes care of that.
115
+ - **Use descriptive file names.** Pass `fileName: "player-idle-sprite"`
116
+ instead of relying on the auto-generated slug. Do not include a file
117
+ extension — it is determined by the generated image format.
118
+ - **Preload images before gameplay.** Wait for `onload` before starting the
119
+ game loop to avoid flickering or missing assets.
120
+ - **Repeat for multiple images.** Run through steps 2-3 for each image the
121
+ game needs.
@@ -0,0 +1,127 @@
1
+ # Add Sprite Sheet to Game Workflow
2
+
3
+ ## Overview
4
+
5
+ This skill guides you through generating an animated sprite sheet and
6
+ integrating it into your game. The `generateSpriteSheet` tool generates a
7
+ grid of animation frames using AI, removes the background, and returns
8
+ hosted URLs for both the original and transparent versions.
9
+
10
+ ## When to Use Sprite Sheets vs Single Images
11
+
12
+ | Use case | Tool |
13
+ |---|---|
14
+ | Static object (background, item, UI element) | `generateImage` |
15
+ | Animated character, effect, or object with multiple frames | `generateSpriteSheet` |
16
+
17
+ Use sprite sheets whenever you need animation — walking cycles, attacks,
18
+ explosions, coin spins, etc.
19
+
20
+ ## Prerequisites
21
+
22
+ - The game HTML file must already exist (follow the **game-creation** workflow
23
+ first if starting from scratch).
24
+ - A game must be created on the Remix platform (you need a game ID).
25
+
26
+ ## Steps
27
+
28
+ ### 1. Check for Existing Game ID
29
+
30
+ **IMPORTANT: Do NOT call `createGame` without checking first.**
31
+
32
+ Read `.remix-settings.json` in the current directory. If it exists and contains
33
+ a `gameId`, use that value. Only if it does not exist should you follow the
34
+ **upload-game** workflow to create one.
35
+
36
+ ### 2. Generate the Sprite Sheet
37
+
38
+ Call `generateSpriteSheet` with the game ID, a descriptive prompt, and
39
+ optionally a grid size (default 4 = 4x4 = 16 frames).
40
+
41
+ ```
42
+ generateSpriteSheet({
43
+ gameId: "<your-game-id>",
44
+ prompt: "a pixel-art knight walking, side view, 2D game character",
45
+ gridSize: 4
46
+ })
47
+ ```
48
+
49
+ The response includes:
50
+ - `spriteUrl` — the original sprite sheet image
51
+ - `transparentSpriteUrl` — background-removed version (use this one in games)
52
+ - `metadata.gridSize` — number of rows/columns
53
+ - `metadata.gridDimensions` — e.g. "4x4"
54
+ - `promptRewritten` — the enhanced prompt used by the AI
55
+ - `warnings` — any issues to be aware of
56
+
57
+ ### 3. Integrate the Sprite Sheet into the Game
58
+
59
+ Use the `transparentSpriteUrl` in your game code. Here is a complete
60
+ pattern for loading and animating a sprite sheet on a canvas:
61
+
62
+ ```js
63
+ const GRID_SIZE = 4; // must match the gridSize you requested
64
+ const FRAME_COUNT = GRID_SIZE * GRID_SIZE;
65
+ const FRAME_DURATION = 100; // ms per frame
66
+
67
+ const spriteSheet = new Image();
68
+ spriteSheet.src = "https://returned-transparent-sprite-url.png";
69
+
70
+ let currentFrame = 0;
71
+ let lastFrameTime = 0;
72
+
73
+ spriteSheet.onload = () => {
74
+ const frameWidth = spriteSheet.width / GRID_SIZE;
75
+ const frameHeight = spriteSheet.height / GRID_SIZE;
76
+
77
+ function animate(timestamp) {
78
+ if (timestamp - lastFrameTime >= FRAME_DURATION) {
79
+ currentFrame = (currentFrame + 1) % FRAME_COUNT;
80
+ lastFrameTime = timestamp;
81
+ }
82
+
83
+ const col = currentFrame % GRID_SIZE;
84
+ const row = Math.floor(currentFrame / GRID_SIZE);
85
+
86
+ ctx.clearRect(x, y, entityWidth, entityHeight);
87
+ ctx.drawImage(
88
+ spriteSheet,
89
+ col * frameWidth, row * frameHeight, // source x, y
90
+ frameWidth, frameHeight, // source width, height
91
+ x, y, // destination x, y
92
+ entityWidth, entityHeight // destination width, height
93
+ );
94
+
95
+ requestAnimationFrame(animate);
96
+ }
97
+
98
+ requestAnimationFrame(animate);
99
+ };
100
+ ```
101
+
102
+ ### 4. Choosing Grid Size
103
+
104
+ | Grid size | Frames | Best for |
105
+ |---|---|---|
106
+ | 2 (2x2) | 4 | Simple loops: coin spin, blinking |
107
+ | 3 (3x3) | 9 | Short animations: jump, attack |
108
+ | 4 (4x4) | 16 | Standard walk/run cycles (default) |
109
+ | 5 (5x5) | 25 | Detailed animations: explosions |
110
+ | 6 (6x6) | 36 | Complex sequences: combo attacks |
111
+
112
+ ## Tips
113
+
114
+ - **Be specific in prompts.** Include art style, perspective, and animation
115
+ type. Example: "a pixel-art wizard casting a fireball spell, side view,
116
+ 2D game character". The server enhances prompts automatically, but
117
+ specificity helps.
118
+ - **Use `transparentSpriteUrl`** for in-game rendering — it has the
119
+ background removed so sprites composite cleanly over your game scene.
120
+ - **Match `GRID_SIZE` to your request.** If you pass `gridSize: 3`, set
121
+ `GRID_SIZE = 3` in your animation code.
122
+ - **Preload before gameplay.** Wait for `onload` before starting the game
123
+ loop to avoid missing frames.
124
+ - **Adjust `FRAME_DURATION`** to control animation speed. Lower values
125
+ (50–80ms) feel snappy; higher values (120–200ms) feel relaxed.
126
+ - **Use a reference image** by passing `imageUrl` if you want the sprite
127
+ to match an existing character design.
@@ -0,0 +1,124 @@
1
+ # Game Creation Workflow
2
+
3
+ ## Overview
4
+
5
+ This skill guides you through creating a new HTML game on the Remix platform.
6
+
7
+ ## Prerequisites
8
+
9
+ - The `REMIX_API_KEY` environment variable must be set.
10
+
11
+ ## Constraints
12
+
13
+ - The game must target a **2:3 aspect ratio** (e.g. 720×1080).
14
+ - It must fill the entire viewport at that ratio — use `width: 100vw; height: 100vh`
15
+ on the game container. No scrollbars, no overflow.
16
+ - The game **must support touch controls** as the primary input method (the Remix
17
+ platform is primarily mobile/touch-based). Keyboard and mouse controls are
18
+ welcome but optional.
19
+
20
+ ## Steps
21
+
22
+ ### 1. Check for Existing Game
23
+
24
+ Before doing anything else, check if a `.remix-settings.json` file exists in
25
+ the project root. If it contains `gameId` and `versionId`, you already have a
26
+ registered game — **do NOT call `createGame` again**. Use the existing IDs for
27
+ all subsequent tool calls (uploadVersion, generateImage, etc.).
28
+
29
+ Only proceed to create a new game (via the **upload-game** workflow) if no
30
+ settings file exists or it is missing `gameId`/`versionId`.
31
+
32
+ ### 2. Clarify the Brief (if needed)
33
+
34
+ Assess the user's description before planning. If it gives you enough to build a
35
+ focused, fun first version, **skip this step** and go straight to planning.
36
+
37
+ **Skip clarification if the description covers:**
38
+ - What type of game it is (genre or mechanic)
39
+ - The core loop or win/lose condition
40
+ - A visual style or theme
41
+ - Any special requirements (e.g. specific controls, progression, power-ups)
42
+
43
+ **Ask questions when the description is short, vague, or ambiguous** — for
44
+ example: "make a fun game", "build a platformer", or "I want something relaxing".
45
+
46
+ When you do ask, keep it to **3–5 focused questions** drawn from these areas:
47
+
48
+ - **Game type / mechanic**: "Is this a tap-to-jump endless runner, a side-scrolling
49
+ platformer with levels, or something else?"
50
+ - **Win/lose condition**: "Does the player try to reach a high score, complete a
51
+ level, survive as long as possible, or something else?"
52
+ - **Theme / visuals**: "Any preferred visual style — pixel art, minimal shapes,
53
+ a specific color palette, or a theme like space/jungle/retro?"
54
+ - **Difficulty & progression**: "Should difficulty ramp up over time, or stay
55
+ constant?"
56
+ - **Audio**: "Should the game have sound effects and/or music, or be silent by
57
+ default?"
58
+
59
+ Only ask questions that will meaningfully change the game. Do **not** ask if the
60
+ answer is obvious from context or if it won't affect the first version.
61
+
62
+ ### 3. Plan the Game
63
+
64
+ Decide on the game concept, mechanics, and visual style. Keep scope small —
65
+ a single-file HTML game should be playable in under 30 seconds.
66
+
67
+ ### 4. Write the HTML
68
+
69
+ Create a single HTML file with inline `<style>` and `<script>` tags. Structure:
70
+
71
+ ```html
72
+ <!DOCTYPE html>
73
+ <html lang="en">
74
+ <head>
75
+ <meta charset="UTF-8">
76
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
77
+ <title>Game Title</title>
78
+ <script src="https://cdn.jsdelivr.net/npm/@remix-gg/sdk@latest/dist/index.min.js"></script>
79
+ <style>
80
+ /* Game styles can go here */
81
+ </style>
82
+ </head>
83
+ <body>
84
+ <!-- Game markup can go here -->
85
+ <script>
86
+ // Game logic here
87
+ </script>
88
+ </body>
89
+ </html>
90
+ ```
91
+
92
+ ### Required RemixSDK Functions
93
+
94
+ The `validateGame` tool checks that all three of these are present:
95
+
96
+ 1. **`RemixSDK.singlePlayer.actions.gameOver({ score })`** — Call when the game
97
+ ends, passing the player's final score as `{ score: number }`. This reports
98
+ the score to the platform.
99
+
100
+ 2. **`RemixSDK.onPlayAgain(callback)`** — Register a callback (no arguments)
101
+ that fires when the player requests to play again. The callback should reset
102
+ game state and restart the game.
103
+
104
+ 3. **`RemixSDK.onToggleMute(callback)`** — Register a callback that receives
105
+ `{ isMuted: boolean }`. The game must mute or unmute all audio based on the
106
+ `isMuted` value.
107
+
108
+ ### 5. Validate
109
+
110
+ Use the `validateGame` tool with the game's `filePath` to check for common issues.
111
+ Do NOT read the game file — the tool reads it internally. Fix any issues
112
+ the tool reports before proceeding.
113
+
114
+ ### 6. Upload the Game
115
+
116
+ Follow the **upload-game** workflow to create the game on the Remix platform and
117
+ deploy your HTML code. Remember: if you already have IDs from step 1, the
118
+ upload-game workflow will skip game creation and go straight to uploading.
119
+
120
+ ## Tips
121
+
122
+ - Use `requestAnimationFrame` for game loops, not `setInterval`.
123
+ - Touch controls are required (primary input); keyboard/mouse are optional extras.
124
+ - Keep the total HTML under 100KB for fast loading.