spritecook-mcp 0.2.9 → 0.2.11

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 +16 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spritecook-mcp",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
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
@@ -199,17 +199,18 @@ export function detectEditors() {
199
199
  });
200
200
 
201
201
  // ── Claude Code ─────────────────────────────────────────────
202
- const claudeCodePath2 = join(home, '.claude', 'settings.json');
203
- const claudeCodePath1 = join(home, '.claude.json');
204
- const claudeCodeDetected = existsSync(claudeCodePath1) || existsSync(claudeCodePath2);
205
- const claudeCodeConfigPath = existsSync(claudeCodePath2) ? claudeCodePath2 : claudeCodePath1;
202
+ // MCP servers are always stored in ~/.claude.json (not ~/.claude/settings.json).
203
+ // Detection: check both files, but always write MCP config to ~/.claude.json.
204
+ const claudeCodeMcpPath = join(home, '.claude.json');
205
+ const claudeCodeSettingsPath = join(home, '.claude', 'settings.json');
206
+ const claudeCodeDetected = existsSync(claudeCodeMcpPath) || existsSync(claudeCodeSettingsPath);
206
207
  editors.push({
207
208
  name: 'Claude Code',
208
209
  detected: claudeCodeDetected,
209
210
  scopes: ['global'],
210
211
  defaultScope: 'global',
211
- configPath: () => claudeCodeConfigPath,
212
- write: (apiKey) => writeClaudeCodeConfig(claudeCodeConfigPath, apiKey),
212
+ configPath: () => claudeCodeMcpPath,
213
+ write: (apiKey) => writeClaudeCodeConfig(claudeCodeMcpPath, apiKey),
213
214
  skillDirs: {
214
215
  project: join(cwd, '.claude', 'skills', 'spritecook'),
215
216
  global: join(home, '.claude', 'skills', 'spritecook'),
@@ -247,18 +248,18 @@ export function detectEditors() {
247
248
  });
248
249
 
249
250
  // ── Codex (OpenAI) ──────────────────────────────────────────
251
+ // Always write to global ~/.codex/config.toml regardless of scope choice.
252
+ // Project-level config requires Codex "trusted project" which is unreliable
253
+ // for new projects, and global keeps the API key out of git.
250
254
  const codexGlobalPath = join(home, '.codex', 'config.toml');
251
255
  const codexProjectPath = join(cwd, '.codex', 'config.toml');
252
256
  editors.push({
253
257
  name: 'Codex',
254
258
  detected: existsSync(codexGlobalPath) || existsSync(codexProjectPath),
255
- scopes: ['project', 'global'],
259
+ scopes: ['global'],
256
260
  defaultScope: 'global',
257
- configPath: (scope) => scope === 'project' ? codexProjectPath : codexGlobalPath,
258
- write: (apiKey, scope) => writeCodexConfig(
259
- scope === 'project' ? codexProjectPath : codexGlobalPath,
260
- apiKey,
261
- ),
261
+ configPath: () => codexGlobalPath,
262
+ write: (apiKey) => writeCodexConfig(codexGlobalPath, apiKey),
262
263
  skillDirs: {
263
264
  project: join(cwd, '.agents', 'skills', 'spritecook'),
264
265
  global: join(home, '.agents', 'skills', 'spritecook'),
@@ -380,8 +381,11 @@ function writeClaudeCodeConfig(configPath, apiKey) {
380
381
  try { config = JSON.parse(readFileSync(configPath, 'utf-8')); } catch { /* start fresh */ }
381
382
  }
382
383
 
384
+ // Claude Code requires "type": "http" for remote servers
385
+ // Config lives in ~/.claude.json per https://docs.anthropic.com/en/docs/claude-code/mcp
383
386
  if (!config.mcpServers) config.mcpServers = {};
384
387
  config.mcpServers.spritecook = {
388
+ type: 'http',
385
389
  url: mcpUrl,
386
390
  headers: { Authorization: `Bearer ${apiKey}` },
387
391
  };