burnrate 0.1.7 → 0.1.9
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 +9 -6
- package/dist/cli/setup.js +33 -33
- package/dist/mcp/server.js +4 -1
- package/dist/server/api.js +2 -1
- package/package.json +1 -1
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
|
-
**
|
|
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,
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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", "
|
|
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/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
|
|
76
|
-
// Detect whether we're running from source (git clone) or
|
|
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 —
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
103
|
-
|
|
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
|
-
|
|
107
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
const mcpConfig = {
|
|
114
|
+
mcpServers: {
|
|
115
|
+
burnrate: {
|
|
116
|
+
type: 'stdio',
|
|
117
|
+
command: mcpCommand,
|
|
118
|
+
args: mcpArgs,
|
|
119
|
+
env
|
|
120
|
+
}
|
|
121
|
+
}
|
|
119
122
|
};
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
║
|
|
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" ║
|
package/dist/mcp/server.js
CHANGED
|
@@ -32,7 +32,10 @@ class GameAPIClient {
|
|
|
32
32
|
});
|
|
33
33
|
const data = await response.json();
|
|
34
34
|
if (!response.ok) {
|
|
35
|
-
|
|
35
|
+
const errMsg = typeof data.error === 'string'
|
|
36
|
+
? data.error
|
|
37
|
+
: data.error?.message || `API error: ${response.status}`;
|
|
38
|
+
throw new Error(errMsg);
|
|
36
39
|
}
|
|
37
40
|
return data;
|
|
38
41
|
}
|
package/dist/server/api.js
CHANGED
|
@@ -147,7 +147,8 @@ app.post('/join', async (c) => {
|
|
|
147
147
|
message: `Welcome to BURNRATE, ${name}! Save your API key - you'll need it for all requests.`,
|
|
148
148
|
apiKey: player.apiKey,
|
|
149
149
|
playerId: player.id,
|
|
150
|
-
location: hub.name
|
|
150
|
+
location: hub.name,
|
|
151
|
+
nextStep: 'Ask Claude: "Use burnrate_tutorial to start the tutorial" — it will walk you through the basics and earn you credits.'
|
|
151
152
|
});
|
|
152
153
|
});
|
|
153
154
|
// ============================================================================
|