@prereason/mcp 0.1.2 → 0.1.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.
- package/CHANGELOG.md +7 -0
- package/README.md +17 -14
- package/bin/cli.js +19 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.3 (2026-02-21)
|
|
4
|
+
|
|
5
|
+
- Add `PREREASON_API_KEY` environment variable support (fixes Windows `cmd.exe` quoting crash)
|
|
6
|
+
- Add `PREREASON_URL` environment variable for custom endpoint
|
|
7
|
+
- Update all config examples to use `env` block (matches Stripe/Supabase pattern)
|
|
8
|
+
- `--header` CLI args still supported for backward compatibility
|
|
9
|
+
|
|
3
10
|
## 0.1.2 (2026-02-21)
|
|
4
11
|
|
|
5
12
|
- Fix Windows path resolution issue in Claude Desktop (rename `.mjs` → `.js` bin entry)
|
package/README.md
CHANGED
|
@@ -18,10 +18,10 @@ Add to your `claude_desktop_config.json`:
|
|
|
18
18
|
"mcpServers": {
|
|
19
19
|
"prereason": {
|
|
20
20
|
"command": "npx",
|
|
21
|
-
"args": [
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
21
|
+
"args": ["-y", "@prereason/mcp"],
|
|
22
|
+
"env": {
|
|
23
|
+
"PREREASON_API_KEY": "YOUR_API_KEY"
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -104,10 +104,10 @@ Once connected, ask Claude:
|
|
|
104
104
|
|
|
105
105
|
### Windows: "'C:\Program' is not recognized"
|
|
106
106
|
|
|
107
|
-
If
|
|
107
|
+
If you still see this error, ensure you're using the `env` block (not `--header` args) as shown in Quick Start above. If the issue persists, install globally and use `node`:
|
|
108
108
|
|
|
109
|
-
1.
|
|
110
|
-
2. Use `
|
|
109
|
+
1. Run: `npm install -g @prereason/mcp`
|
|
110
|
+
2. Use this config (replace `YOUR_USER` with your Windows username):
|
|
111
111
|
|
|
112
112
|
```json
|
|
113
113
|
{
|
|
@@ -115,16 +115,16 @@ If Node.js is installed in a path with spaces (e.g. `C:\Program Files\nodejs\`),
|
|
|
115
115
|
"prereason": {
|
|
116
116
|
"command": "node",
|
|
117
117
|
"args": [
|
|
118
|
-
"C:\\Users\\YOUR_USER\\AppData\\Roaming\\npm\\node_modules\\@prereason\\mcp\\bin\\cli.js"
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
"C:\\Users\\YOUR_USER\\AppData\\Roaming\\npm\\node_modules\\@prereason\\mcp\\bin\\cli.js"
|
|
119
|
+
],
|
|
120
|
+
"env": {
|
|
121
|
+
"PREREASON_API_KEY": "YOUR_API_KEY"
|
|
122
|
+
}
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
126
|
```
|
|
125
127
|
|
|
126
|
-
Replace `YOUR_USER` with your Windows username.
|
|
127
|
-
|
|
128
128
|
### Auth errors on get_context / get_metric
|
|
129
129
|
- `list_templates`, `list_metrics`, and `get_health` work without a key
|
|
130
130
|
- `get_context` and `get_metric` require a valid API key
|
|
@@ -155,11 +155,14 @@ claude mcp add prereason --transport http https://api.prereason.com/api/mcp
|
|
|
155
155
|
## CLI Usage
|
|
156
156
|
|
|
157
157
|
```bash
|
|
158
|
-
#
|
|
158
|
+
# Using environment variable (recommended)
|
|
159
|
+
PREREASON_API_KEY=pr_live_... npx @prereason/mcp
|
|
160
|
+
|
|
161
|
+
# Using --header flag (backward compatible)
|
|
159
162
|
npx @prereason/mcp --header "Authorization:Bearer YOUR_API_KEY"
|
|
160
163
|
|
|
161
164
|
# Custom URL
|
|
162
|
-
|
|
165
|
+
PREREASON_URL=https://custom.endpoint/mcp npx @prereason/mcp
|
|
163
166
|
|
|
164
167
|
# Help
|
|
165
168
|
npx @prereason/mcp --help
|
package/bin/cli.js
CHANGED
|
@@ -4,13 +4,17 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Connects Claude Desktop (stdio) to PreReason's Streamable HTTP MCP endpoint.
|
|
6
6
|
*
|
|
7
|
+
* Auth (preferred — works on all platforms):
|
|
8
|
+
* Set PREREASON_API_KEY env var in your MCP client config.
|
|
9
|
+
*
|
|
7
10
|
* Usage:
|
|
11
|
+
* npx @prereason/mcp
|
|
8
12
|
* npx @prereason/mcp [--header Key:Value]...
|
|
9
13
|
* npx @prereason/mcp <URL> [--header Key:Value]...
|
|
10
14
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
15
|
+
* Environment variables:
|
|
16
|
+
* PREREASON_API_KEY Your API key (adds Authorization: Bearer header)
|
|
17
|
+
* PREREASON_URL Override the default endpoint URL
|
|
14
18
|
*/
|
|
15
19
|
|
|
16
20
|
import { createRequire } from 'node:module';
|
|
@@ -25,8 +29,11 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
|
25
29
|
const pkg = require('../package.json');
|
|
26
30
|
process.stderr.write(`${pkg.name} v${pkg.version}\n\n`);
|
|
27
31
|
process.stderr.write('Usage:\n');
|
|
28
|
-
process.stderr.write(' npx @prereason/mcp
|
|
29
|
-
process.stderr.write(' npx @prereason/mcp
|
|
32
|
+
process.stderr.write(' npx @prereason/mcp\n');
|
|
33
|
+
process.stderr.write(' npx @prereason/mcp [--header Key:Value]...\n\n');
|
|
34
|
+
process.stderr.write('Environment variables (recommended):\n');
|
|
35
|
+
process.stderr.write(' PREREASON_API_KEY Your API key (adds Authorization: Bearer header)\n');
|
|
36
|
+
process.stderr.write(' PREREASON_URL Override the default endpoint URL\n\n');
|
|
30
37
|
process.stderr.write('Options:\n');
|
|
31
38
|
process.stderr.write(' --header Key:Value Add HTTP header (can be repeated)\n');
|
|
32
39
|
process.stderr.write(' --help, -h Show this help\n');
|
|
@@ -42,10 +49,15 @@ if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
|
42
49
|
process.exit(0);
|
|
43
50
|
}
|
|
44
51
|
|
|
45
|
-
// ---
|
|
46
|
-
let urlArg = DEFAULT_URL;
|
|
52
|
+
// --- Read environment variables (preferred, avoids Windows cmd.exe quoting issues) ---
|
|
53
|
+
let urlArg = process.env.PREREASON_URL || DEFAULT_URL;
|
|
47
54
|
const headers = {};
|
|
48
55
|
|
|
56
|
+
if (process.env.PREREASON_API_KEY) {
|
|
57
|
+
headers['Authorization'] = `Bearer ${process.env.PREREASON_API_KEY}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// --- Parse CLI arguments (override env vars) ---
|
|
49
61
|
for (let i = 2; i < process.argv.length; i++) {
|
|
50
62
|
if (process.argv[i] === '--header' && process.argv[i + 1]) {
|
|
51
63
|
const val = process.argv[++i];
|