@prereason/mcp 0.1.2 → 0.1.5

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 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
@@ -3,35 +3,41 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@prereason/mcp.svg)](https://www.npmjs.com/package/@prereason/mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- MCP bridge for [PreReason](https://www.prereason.com) connects Claude Desktop to PreReason's Bitcoin and macro data API.
6
+ MCP server for [PreReason](https://www.prereason.com): pre-analyzed Bitcoin and macro financial intelligence.
7
7
 
8
- PreReason provides pre-computed context templates with market data, macro indicators, trend analysis, confidence scores, and causal reasoning for LLM agents.
8
+ PreReason returns interpreted signals (bullish/bearish/neutral), trend analysis, regime classification, confidence scores, percentile rankings, and cross-asset correlations. Use it when your task needs market context for decision-making, not raw price feeds.
9
9
 
10
10
  ## Quick Start
11
11
 
12
+ ### Option 1: Direct HTTP (Claude Code, Cursor, Windsurf, etc.)
13
+
14
+ Clients that support remote MCP servers can connect directly to `https://api.prereason.com/api/mcp` with no bridge package needed. See [Other MCP Clients](#other-mcp-clients) below.
15
+
16
+ ### Option 2: stdio bridge (Claude Desktop and other stdio-only clients)
17
+
12
18
  **Requires [Node.js 18+](https://nodejs.org)**
13
19
 
14
- Add to your `claude_desktop_config.json`:
20
+ Add to your MCP client config (e.g. `claude_desktop_config.json`):
15
21
 
16
22
  ```json
17
23
  {
18
24
  "mcpServers": {
19
25
  "prereason": {
20
26
  "command": "npx",
21
- "args": [
22
- "-y", "@prereason/mcp",
23
- "--header", "Authorization:Bearer YOUR_API_KEY"
24
- ]
27
+ "args": ["-y", "@prereason/mcp"],
28
+ "env": {
29
+ "PREREASON_API_KEY": "YOUR_API_KEY"
30
+ }
25
31
  }
26
32
  }
27
33
  }
28
34
  ```
29
35
 
30
- Config file location:
36
+ Claude Desktop config file location:
31
37
  - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
32
38
  - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
33
39
 
34
- Restart Claude Desktop after editing the config. PreReason should appear in your connectors list with 5 tools.
40
+ Restart your MCP client after editing the config. PreReason should appear with 5 tools.
35
41
 
36
42
  ## Get an API Key
37
43
 
@@ -54,35 +60,35 @@ Restart Claude Desktop after editing the config. PreReason should appear in your
54
60
  ### Free (6 templates)
55
61
  | Template | Description |
56
62
  |----------|-------------|
57
- | `quick-check` | Minimal fast context: BTC + Net Liquidity + correlation |
58
- | `btc-context` | BTC + liquidity + hash ribbon + difficulty + momentum |
59
- | `macro-snapshot` | Fed balance, M2, treasury yields, VIX, net liquidity |
60
- | `correlation-check` | BTC correlation matrix vs macro indicators |
61
- | `btc-pulse` | Volume, fees, mempool analysis |
62
- | `grid-stress` | Epoch pace and difficulty adjustment forecast |
63
-
64
- ### Basic $19.99/mo (5 templates)
63
+ | `btc.quick-check` | Minimal fast context: BTC + Net Liquidity + correlation |
64
+ | `btc.context` | BTC + liquidity + hash ribbon + difficulty + momentum |
65
+ | `macro.snapshot` | Fed balance, M2, treasury yields, VIX, net liquidity |
66
+ | `cross.correlations` | BTC correlation matrix vs macro indicators |
67
+ | `btc.pulse` | Volume, fees, mempool analysis |
68
+ | `btc.grid-stress` | Epoch pace and difficulty adjustment forecast |
69
+
70
+ ### Basic - $19.99/mo (5 templates)
65
71
  | Template | Description |
66
72
  |----------|-------------|
67
- | `btc-momentum` | Extended momentum with 90d trends and percentiles |
68
- | `liquidity-momentum` | Liquidity indicators with momentum analysis |
69
- | `on-chain-health` | Hash rate, difficulty, fees, mempool health |
70
- | `market-breadth` | Cross-asset breadth with SPY, DXY, VIX |
71
- | `miner-survival` | Hashprice thermometer with miner stress scoring |
73
+ | `btc.momentum` | Extended momentum with 90d trends and percentiles |
74
+ | `macro.liquidity` | Liquidity indicators with momentum analysis |
75
+ | `btc.on-chain` | Hash rate, difficulty, fees, mempool health |
76
+ | `cross.breadth` | Cross-asset breadth with SPY, DXY, VIX |
77
+ | `btc.miner-survival` | Hashprice thermometer with miner stress scoring |
72
78
 
73
- ### Pro $49.99/mo (6 templates)
79
+ ### Pro - $49.99/mo (6 templates)
74
80
  | Template | Description |
75
81
  |----------|-------------|
76
- | `full-context` | Complete market intelligence with all metrics and analysis |
77
- | `factor-attribution` | Multi-factor attribution for BTC price movements |
78
- | `regime-check` | Market regime classification (risk-on/risk-off/transition) |
79
- | `fx-liquidity` | FX environment with DXY, treasury, and global liquidity |
80
- | `energy-cost` | Production cost model with gas input pressure |
81
- | `treasury-holdings` | Corporate Bitcoin treasury intelligence from SEC filings |
82
+ | `btc.full` | Complete market intelligence with all metrics and analysis |
83
+ | `btc.factors` | Multi-factor attribution for BTC price movements |
84
+ | `cross.regime` | Market regime classification (risk-on/risk-off/transition) |
85
+ | `fx.liquidity` | FX environment with DXY, treasury, and global liquidity |
86
+ | `btc.energy` | Production cost model with gas input pressure |
87
+ | `btc.treasury` | Corporate Bitcoin treasury intelligence from SEC filings |
82
88
 
83
89
  ## Example Prompts
84
90
 
85
- Once connected, ask Claude:
91
+ Once connected, try prompts like:
86
92
 
87
93
  - "What's the current BTC regime?"
88
94
  - "Show me the macro snapshot"
@@ -104,10 +110,10 @@ Once connected, ask Claude:
104
110
 
105
111
  ### Windows: "'C:\Program' is not recognized"
106
112
 
107
- If Node.js is installed in a path with spaces (e.g. `C:\Program Files\nodejs\`), `npx` may fail inside Claude Desktop. Workaround:
113
+ 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
114
 
109
- 1. Install globally: `npm install -g @prereason/mcp`
110
- 2. Use `node` command instead:
115
+ 1. Run: `npm install -g @prereason/mcp`
116
+ 2. Use this config (replace `YOUR_USER` with your Windows username):
111
117
 
112
118
  ```json
113
119
  {
@@ -115,16 +121,16 @@ If Node.js is installed in a path with spaces (e.g. `C:\Program Files\nodejs\`),
115
121
  "prereason": {
116
122
  "command": "node",
117
123
  "args": [
118
- "C:\\Users\\YOUR_USER\\AppData\\Roaming\\npm\\node_modules\\@prereason\\mcp\\bin\\cli.js",
119
- "--header", "Authorization:Bearer YOUR_API_KEY"
120
- ]
124
+ "C:\\Users\\YOUR_USER\\AppData\\Roaming\\npm\\node_modules\\@prereason\\mcp\\bin\\cli.js"
125
+ ],
126
+ "env": {
127
+ "PREREASON_API_KEY": "YOUR_API_KEY"
128
+ }
121
129
  }
122
130
  }
123
131
  }
124
132
  ```
125
133
 
126
- Replace `YOUR_USER` with your Windows username.
127
-
128
134
  ### Auth errors on get_context / get_metric
129
135
  - `list_templates`, `list_metrics`, and `get_health` work without a key
130
136
  - `get_context` and `get_metric` require a valid API key
@@ -132,7 +138,7 @@ Replace `YOUR_USER` with your Windows username.
132
138
 
133
139
  ## Other MCP Clients
134
140
 
135
- Claude Code, Cursor, and Windsurf support remote HTTP servers directly **no bridge package needed**:
141
+ Clients that support remote HTTP servers (Claude Code, Cursor, Windsurf, and others) can connect directly without this bridge package:
136
142
 
137
143
  ```bash
138
144
  # Claude Code (CLI)
@@ -155,11 +161,14 @@ claude mcp add prereason --transport http https://api.prereason.com/api/mcp
155
161
  ## CLI Usage
156
162
 
157
163
  ```bash
158
- # Default URL (https://api.prereason.com/api/mcp)
164
+ # Using environment variable (recommended)
165
+ PREREASON_API_KEY=pr_live_... npx @prereason/mcp
166
+
167
+ # Using --header flag (backward compatible)
159
168
  npx @prereason/mcp --header "Authorization:Bearer YOUR_API_KEY"
160
169
 
161
170
  # Custom URL
162
- npx @prereason/mcp https://custom-endpoint.com/mcp --header "Authorization:Bearer KEY"
171
+ PREREASON_URL=https://custom.endpoint/mcp npx @prereason/mcp
163
172
 
164
173
  # Help
165
174
  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
- * Examples:
12
- * npx @prereason/mcp --header "Authorization:Bearer pr_live_..."
13
- * npx @prereason/mcp https://api.prereason.com/api/mcp --header "Authorization:Bearer pr_live_..."
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 [--header Key:Value]...\n');
29
- process.stderr.write(' npx @prereason/mcp <URL> [--header Key:Value]...\n\n');
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
- // --- Parse CLI arguments ---
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];
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@prereason/mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
- "description": "Connect Claude Desktop to PreReason's Bitcoin & macro data API via MCP",
5
+ "description": "MCP server for pre-analyzed Bitcoin and macro financial intelligence. Trend signals, regime classification, confidence scores, and 17 context templates.",
6
6
  "bin": {
7
7
  "prereason-mcp": "./bin/cli.js"
8
8
  },
@@ -26,7 +26,15 @@
26
26
  "macro",
27
27
  "prereason",
28
28
  "ai",
29
- "llm"
29
+ "llm",
30
+ "finance",
31
+ "crypto",
32
+ "financial-data",
33
+ "liquidity",
34
+ "ai-agent",
35
+ "trading",
36
+ "market-data",
37
+ "context-protocol"
30
38
  ],
31
39
  "license": "MIT",
32
40
  "homepage": "https://www.prereason.com/docs#mcp",