burnrate 0.1.6 → 0.1.8

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.
package/README.md CHANGED
@@ -41,21 +41,23 @@ The players who learn to work WITH Claude—analyzing intel, optimizing routes,
41
41
 
42
42
  ## Quick Start
43
43
 
44
- **One command to set up, then you're in.**
44
+ **Create a directory, run setup, start playing.**
45
45
 
46
46
  ```bash
47
+ mkdir burnrate && cd burnrate
47
48
  npx burnrate setup
49
+ claude
48
50
  ```
49
51
 
50
- The setup wizard connects to the live server, auto-configures your Claude Code MCP settings, and verifies the connection.
52
+ The setup wizard connects to the live server, writes a `.mcp.json` config in the current directory, and verifies the connection. Then start Claude Code from that directory.
51
53
 
52
- **Restart Claude Code**, then tell Claude:
54
+ Tell Claude:
53
55
 
54
56
  ```
55
57
  Use burnrate_join to create a character named "YourName"
56
58
  ```
57
59
 
58
- You'll get an API key. Run `npx burnrate setup` again and paste it in, or manually add `"BURNRATE_API_KEY": "your-key"` to the env block in `~/.claude/settings.json`. Restart Claude Code one more time, and you're set.
60
+ You'll get an API key. Run `npx burnrate setup` again and paste it in, or manually add `"BURNRATE_API_KEY": "your-key"` to the env block in `.mcp.json`. Restart Claude Code and you're set.
59
61
 
60
62
  ### Setup from Source (Alternative)
61
63
 
@@ -69,14 +71,15 @@ npm run setup
69
71
 
70
72
  ### Manual Config (Alternative)
71
73
 
72
- Add this directly to `~/.claude/settings.json`:
74
+ Create a `.mcp.json` file in any directory you'll run Claude Code from:
73
75
 
74
76
  ```json
75
77
  {
76
78
  "mcpServers": {
77
79
  "burnrate": {
80
+ "type": "stdio",
78
81
  "command": "npx",
79
- "args": ["-y", "burnrate", "start"],
82
+ "args": ["-y", "burnrate", "mcp"],
80
83
  "env": {
81
84
  "BURNRATE_API_URL": "https://burnrate-api-server-production.up.railway.app",
82
85
  "BURNRATE_API_KEY": "your-key-here"
package/dist/cli/index.js CHANGED
@@ -13,9 +13,10 @@ if (process.argv[2] === 'setup') {
13
13
  }
14
14
  if (process.argv[2] === 'mcp') {
15
15
  await import('../mcp/server.js');
16
- // MCP server runs indefinitely via stdio, so this line is only
17
- // reached if the server exits on its own
18
- process.exit(0);
16
+ // server.connect() resolves immediately after setting up the transport,
17
+ // so we block here to prevent fallthrough to heavy imports.
18
+ // Node exits naturally when the MCP client closes stdin.
19
+ await new Promise(() => { });
19
20
  }
20
21
  // Heavy imports — only reached when NOT running setup
21
22
  const { Command } = await import('commander');
package/dist/cli/setup.js CHANGED
@@ -7,7 +7,6 @@
7
7
  */
8
8
  import fs from 'fs';
9
9
  import path from 'path';
10
- import os from 'os';
11
10
  import readline from 'readline';
12
11
  const rl = readline.createInterface({
13
12
  input: process.stdin,
@@ -72,64 +71,65 @@ async function main() {
72
71
  console.log(' ⚠ Could not validate key (server unreachable).');
73
72
  }
74
73
  }
75
- // 5. Determine MCP server config
76
- // Detect whether we're running from source (git clone) or npx
74
+ // 5. Determine MCP server command
75
+ // Detect whether we're running from source (git clone) or npm install
77
76
  const distPath = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..', 'mcp', 'server.js');
78
77
  const isFromSource = !distPath.includes('node_modules');
79
78
  let mcpCommand;
80
79
  let mcpArgs;
81
80
  if (isFromSource && fs.existsSync(distPath)) {
82
- // Running from cloned source — use direct path
81
+ // Running from cloned source — use direct node path
83
82
  mcpCommand = 'node';
84
83
  mcpArgs = [distPath];
85
84
  console.log(`\nMCP server: ${distPath} (source)`);
86
85
  }
87
86
  else {
88
- // Installed via npx/npm — use npx to resolve package at runtime
89
- // This is stable and doesn't depend on ephemeral npx cache paths
90
- mcpCommand = 'npx';
91
- mcpArgs = ['-y', 'burnrate', 'mcp'];
92
- console.log(`\nMCP server: npx burnrate mcp (npm package)`);
93
- }
94
- // 6. Write Claude Code settings
95
- const claudeSettingsDir = path.join(os.homedir(), '.claude');
96
- const claudeSettingsPath = path.join(claudeSettingsDir, 'settings.json');
97
- let settings = {};
98
- if (fs.existsSync(claudeSettingsPath)) {
99
- try {
100
- settings = JSON.parse(fs.readFileSync(claudeSettingsPath, 'utf-8'));
87
+ // Installed via npx/npm — find the global or local node + server path
88
+ // Using absolute paths is most reliable for MCP servers
89
+ const nodePath = process.execPath; // absolute path to current node binary
90
+ // Resolve the server.js path relative to this setup script
91
+ const serverPath = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..', 'mcp', 'server.js');
92
+ if (fs.existsSync(serverPath)) {
93
+ mcpCommand = nodePath;
94
+ mcpArgs = [serverPath];
95
+ console.log(`\nMCP server: ${serverPath}`);
101
96
  }
102
- catch {
103
- console.log(' ⚠ Could not parse existing settings.json, creating new one.');
97
+ else {
98
+ // Fallback: use npx
99
+ mcpCommand = 'npx';
100
+ mcpArgs = ['-y', 'burnrate', 'mcp'];
101
+ console.log(`\nMCP server: npx burnrate mcp (npm package)`);
104
102
  }
105
103
  }
106
- if (!settings.mcpServers) {
107
- settings.mcpServers = {};
108
- }
104
+ // 6. Write .mcp.json in the current directory
105
+ // Claude Code reads MCP server config from .mcp.json at the project level
106
+ const mcpConfigPath = path.join(process.cwd(), '.mcp.json');
109
107
  const env = {
110
108
  BURNRATE_API_URL: apiUrl
111
109
  };
112
110
  if (apiKey) {
113
111
  env.BURNRATE_API_KEY = apiKey;
114
112
  }
115
- settings.mcpServers.burnrate = {
116
- command: mcpCommand,
117
- args: mcpArgs,
118
- env
113
+ const mcpConfig = {
114
+ mcpServers: {
115
+ burnrate: {
116
+ type: 'stdio',
117
+ command: mcpCommand,
118
+ args: mcpArgs,
119
+ env
120
+ }
121
+ }
119
122
  };
120
- // Ensure directory exists
121
- if (!fs.existsSync(claudeSettingsDir)) {
122
- fs.mkdirSync(claudeSettingsDir, { recursive: true });
123
- }
124
- fs.writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 2));
125
- console.log(`\n✓ Claude Code MCP settings written to ${claudeSettingsPath}`);
123
+ fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2) + '\n');
124
+ console.log(`\n✓ MCP config written to ${mcpConfigPath}`);
126
125
  // 7. Summary
127
126
  console.log(`
128
127
  ╔══════════════════════════════════════════════════════════════╗
129
128
  ║ SETUP COMPLETE ║
130
129
  ╠══════════════════════════════════════════════════════════════╣
131
130
  ║ ║
132
- Restart Claude Code to load the MCP server.
131
+ Start Claude Code from this directory:
132
+ ║ claude ║
133
133
  ║ ║
134
134
  ║ Then ask Claude: ║
135
135
  ║ "Use burnrate_join to create a character named MyName" ║
@@ -1874,4 +1874,10 @@ async function main() {
1874
1874
  await server.connect(transport);
1875
1875
  console.error('BURNRATE MCP Server running');
1876
1876
  }
1877
- main().catch(console.error);
1877
+ try {
1878
+ await main();
1879
+ }
1880
+ catch (err) {
1881
+ console.error(err);
1882
+ process.exit(1);
1883
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burnrate",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "A logistics war MMO for Claude Code. The front doesn't feed itself.",
5
5
  "type": "module",
6
6
  "main": "dist/cli/index.js",