spritecook-mcp 0.2.8 → 0.2.10

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/editors.mjs +14 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spritecook-mcp",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "mcpName": "ai.spritecook/generate",
5
5
  "description": "SpriteCook MCP Server - Connect your AI agent (Cursor, VS Code, Claude) to SpriteCook for pixel art and game asset generation.",
6
6
  "keywords": [
package/src/editors.mjs CHANGED
@@ -247,18 +247,18 @@ export function detectEditors() {
247
247
  });
248
248
 
249
249
  // ── Codex (OpenAI) ──────────────────────────────────────────
250
+ // Always write to global ~/.codex/config.toml regardless of scope choice.
251
+ // Project-level config requires Codex "trusted project" which is unreliable
252
+ // for new projects, and global keeps the API key out of git.
250
253
  const codexGlobalPath = join(home, '.codex', 'config.toml');
251
254
  const codexProjectPath = join(cwd, '.codex', 'config.toml');
252
255
  editors.push({
253
256
  name: 'Codex',
254
257
  detected: existsSync(codexGlobalPath) || existsSync(codexProjectPath),
255
- scopes: ['project', 'global'],
258
+ scopes: ['global'],
256
259
  defaultScope: 'global',
257
- configPath: (scope) => scope === 'project' ? codexProjectPath : codexGlobalPath,
258
- write: (apiKey, scope) => writeCodexConfig(
259
- scope === 'project' ? codexProjectPath : codexGlobalPath,
260
- apiKey,
261
- ),
260
+ configPath: () => codexGlobalPath,
261
+ write: (apiKey) => writeCodexConfig(codexGlobalPath, apiKey),
262
262
  skillDirs: {
263
263
  project: join(cwd, '.agents', 'skills', 'spritecook'),
264
264
  global: join(home, '.agents', 'skills', 'spritecook'),
@@ -437,15 +437,19 @@ function writeCodexConfig(configPath, apiKey) {
437
437
  try { content = readFileSync(configPath, 'utf-8'); } catch { /* start fresh */ }
438
438
  }
439
439
 
440
- // Remove any existing [mcp_servers.spritecook] block
441
- content = content.replace(/\[mcp_servers\.spritecook\][^\[]*/, '');
440
+ // Remove any existing [mcp_servers.spritecook] block (including sub-tables)
441
+ content = content.replace(/\[mcp_servers\.spritecook[^\]]*\][^\[]*/g, '');
442
442
 
443
- // Append the new block
443
+ // Codex uses Streamable HTTP format per https://developers.openai.com/codex/mcp/
444
+ // - url: required, the server address
445
+ // - http_headers: map of header names to static values (for auth)
444
446
  const block = [
445
447
  '',
446
448
  '[mcp_servers.spritecook]',
447
449
  `url = "${mcpUrl}"`,
448
- `bearer_token = "${apiKey}"`,
450
+ '',
451
+ '[mcp_servers.spritecook.http_headers]',
452
+ `Authorization = "Bearer ${apiKey}"`,
449
453
  '',
450
454
  ].join('\n');
451
455