@prereason/mcp 0.1.7 → 0.1.10
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 +59 -42
- package/LICENSE +21 -21
- package/README.md +190 -190
- package/bin/cli.js +109 -111
- package/package.json +45 -45
package/CHANGELOG.md
CHANGED
|
@@ -1,42 +1,59 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 0.1.
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- Add
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.10 (2026-03-15)
|
|
4
|
+
|
|
5
|
+
- Enable SLSA provenance attestation via GitHub Actions publish workflow
|
|
6
|
+
- Fix workflow placement: move from `packages/mcp/.github/` to repo root `.github/workflows/`
|
|
7
|
+
- Switch publish trigger to `workflow_dispatch` for manual control
|
|
8
|
+
|
|
9
|
+
## 0.1.9 (2026-03-10)
|
|
10
|
+
|
|
11
|
+
- Expand `socket.yml` to suppress all known-safe transitive dependency alerts from `@modelcontextprotocol/sdk`
|
|
12
|
+
- Covers eval (ajv), shell (cross-spawn), filesystem (express/send), debug, dynamic require, unmaintained micro-packages, and more
|
|
13
|
+
|
|
14
|
+
## 0.1.8 (2026-03-05)
|
|
15
|
+
|
|
16
|
+
- Remove `createRequire` / dynamic `require('../package.json')` — hardcode version constants
|
|
17
|
+
- Eliminates Socket.dev "Dynamic require" and "Filesystem access" findings from our code
|
|
18
|
+
- Add `socket.yml` for GitHub PR alert suppression of expected behaviors (network access, env vars)
|
|
19
|
+
|
|
20
|
+
## 0.1.7 (2026-03-04)
|
|
21
|
+
|
|
22
|
+
- Pin `@modelcontextprotocol/sdk` to exact `1.27.1` (fixes transitive CVEs in hono and qs)
|
|
23
|
+
- Update metric count from 26 to 30 (added 200D MA, distance from 200D MA, USDT market cap, USDT dominance)
|
|
24
|
+
- Update `btc.momentum` description to reflect 200D MA support/resistance
|
|
25
|
+
- Update `cross.regime` description to reflect USDT.D risk sentiment
|
|
26
|
+
|
|
27
|
+
## 0.1.6 (2026-02-25)
|
|
28
|
+
|
|
29
|
+
- Fix description wording: replace "trend signals" with "trend interpretation"
|
|
30
|
+
- Add SECURITY.md with vulnerability reporting policy
|
|
31
|
+
- Add GitHub Actions CI workflow for provenance-signed npm publishing
|
|
32
|
+
- Public source repo at https://github.com/PreReason/mcp
|
|
33
|
+
|
|
34
|
+
## 0.1.3 (2026-02-21)
|
|
35
|
+
|
|
36
|
+
- Add `PREREASON_API_KEY` environment variable support (fixes Windows `cmd.exe` quoting crash)
|
|
37
|
+
- Add `PREREASON_URL` environment variable for custom endpoint
|
|
38
|
+
- Update all config examples to use `env` block (matches Stripe/Supabase pattern)
|
|
39
|
+
- `--header` CLI args still supported for backward compatibility
|
|
40
|
+
|
|
41
|
+
## 0.1.2 (2026-02-21)
|
|
42
|
+
|
|
43
|
+
- Fix Windows path resolution issue in Claude Desktop (rename `.mjs` → `.js` bin entry)
|
|
44
|
+
- Add Windows troubleshooting section in README
|
|
45
|
+
|
|
46
|
+
## 0.1.1 (2026-02-21)
|
|
47
|
+
|
|
48
|
+
- Add MIT LICENSE file
|
|
49
|
+
- Enhance README with full template list, troubleshooting, and example prompts
|
|
50
|
+
- Add CHANGELOG
|
|
51
|
+
|
|
52
|
+
## 0.1.0 (2026-02-20)
|
|
53
|
+
|
|
54
|
+
- Initial release
|
|
55
|
+
- stdio-to-Streamable HTTP bridge for Claude Desktop
|
|
56
|
+
- Default URL: `https://api.prereason.com/api/mcp`
|
|
57
|
+
- `--header Key:Value` flag for API key authentication
|
|
58
|
+
- `--help` and `--version` flags
|
|
59
|
+
- 5 MCP tools: get_context, get_metric, list_templates, list_metrics, get_health
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 PreReason
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PreReason
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,190 +1,190 @@
|
|
|
1
|
-
# @prereason/mcp
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@prereason/mcp)
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
|
|
6
|
-
MCP server for [PreReason](https://www.prereason.com): pre-analyzed Bitcoin and macro financial intelligence.
|
|
7
|
-
|
|
8
|
-
PreReason returns pre-analyzed market context: trend interpretation, momentum analysis, cross-asset correlations, and more. Use it when your task needs to understand market conditions for decision-making, not raw price feeds.
|
|
9
|
-
|
|
10
|
-
## Quick Start
|
|
11
|
-
|
|
12
|
-
### Option 1: Direct HTTP (Claude Code, Cursor, Windsurf, etc.)
|
|
13
|
-
|
|
14
|
-
Clients that support remote MCP servers can connect directly with no bridge package needed.
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# Claude Code (CLI one-liner)
|
|
18
|
-
claude mcp add prereason --transport http https://api.prereason.com/api/mcp
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Or add to `.mcp.json` / your client's MCP config:
|
|
22
|
-
|
|
23
|
-
```json
|
|
24
|
-
{
|
|
25
|
-
"mcpServers": {
|
|
26
|
-
"prereason": {
|
|
27
|
-
"type": "http",
|
|
28
|
-
"url": "https://api.prereason.com/api/mcp",
|
|
29
|
-
"headers": {
|
|
30
|
-
"Authorization": "Bearer YOUR_API_KEY"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Option 2: stdio bridge (Claude Desktop and other stdio-only clients)
|
|
38
|
-
|
|
39
|
-
**Requires [Node.js 18+](https://nodejs.org)**
|
|
40
|
-
|
|
41
|
-
Add to your MCP client config (e.g. `claude_desktop_config.json`):
|
|
42
|
-
|
|
43
|
-
```json
|
|
44
|
-
{
|
|
45
|
-
"mcpServers": {
|
|
46
|
-
"prereason": {
|
|
47
|
-
"command": "npx",
|
|
48
|
-
"args": ["-y", "@prereason/mcp"],
|
|
49
|
-
"env": {
|
|
50
|
-
"PREREASON_API_KEY": "YOUR_API_KEY"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Claude Desktop config file location:
|
|
58
|
-
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
59
|
-
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
60
|
-
|
|
61
|
-
Restart your MCP client after editing the config. PreReason should appear with 5 tools.
|
|
62
|
-
|
|
63
|
-
## Get an API Key
|
|
64
|
-
|
|
65
|
-
1. Sign up at [prereason.com/signup](https://www.prereason.com/signup)
|
|
66
|
-
2. Go to Dashboard > Settings > API Keys
|
|
67
|
-
3. Copy your key (starts with `pr_live_`)
|
|
68
|
-
|
|
69
|
-
## 5 MCP Tools
|
|
70
|
-
|
|
71
|
-
| Tool | Auth | Description |
|
|
72
|
-
|------|------|-------------|
|
|
73
|
-
| `list_templates` | Open | List all 17 context templates with tier requirements |
|
|
74
|
-
| `list_metrics` | Open | List all
|
|
75
|
-
| `get_health` | Open | API health check, version, account tier |
|
|
76
|
-
| `get_context` | Required | Fetch a context template (markdown or JSON) |
|
|
77
|
-
| `get_metric` | Required | Fetch a single metric with trend/signal/percentile |
|
|
78
|
-
|
|
79
|
-
## 17 Context Templates
|
|
80
|
-
|
|
81
|
-
### Free (6 templates)
|
|
82
|
-
| Template | Description |
|
|
83
|
-
|----------|-------------|
|
|
84
|
-
| `btc.quick-check` | Minimal fast context: BTC + Net Liquidity + correlation |
|
|
85
|
-
| `btc.context` | BTC + liquidity + hash ribbon + difficulty + momentum |
|
|
86
|
-
| `macro.snapshot` | Fed balance, M2, treasury yields, VIX, net liquidity |
|
|
87
|
-
| `cross.correlations` | BTC correlation matrix vs macro indicators |
|
|
88
|
-
| `btc.pulse` | Volume, fees, mempool analysis |
|
|
89
|
-
| `btc.grid-stress` | Epoch pace and difficulty adjustment forecast |
|
|
90
|
-
|
|
91
|
-
### Basic - $19.99/mo (5 templates)
|
|
92
|
-
| Template | Description |
|
|
93
|
-
|----------|-------------|
|
|
94
|
-
| `btc.momentum` | 200D MA support/resistance with 7d/30d/90d momentum and YTD percentiles |
|
|
95
|
-
| `macro.liquidity` | Liquidity indicators with momentum analysis |
|
|
96
|
-
| `btc.on-chain` | Hash rate, difficulty, fees, mempool health |
|
|
97
|
-
| `cross.breadth` | Cross-asset breadth with SPY, DXY, VIX |
|
|
98
|
-
| `btc.miner-survival` | Hashprice thermometer with miner stress scoring |
|
|
99
|
-
|
|
100
|
-
### Pro - $49.99/mo (6 templates)
|
|
101
|
-
| Template | Description |
|
|
102
|
-
|----------|-------------|
|
|
103
|
-
| `btc.full` | Complete market intelligence with all metrics and analysis |
|
|
104
|
-
| `btc.factors` | Multi-factor attribution for BTC price movements |
|
|
105
|
-
| `cross.regime` | Regime classification (risk-on/risk-off/transition) with USDT.D risk sentiment |
|
|
106
|
-
| `fx.liquidity` | FX environment with DXY, treasury, and global liquidity |
|
|
107
|
-
| `btc.energy` | Production cost model with gas input pressure |
|
|
108
|
-
| `btc.treasury` | Corporate Bitcoin treasury intelligence from SEC filings |
|
|
109
|
-
|
|
110
|
-
## Example Prompts
|
|
111
|
-
|
|
112
|
-
Once connected, try prompts like:
|
|
113
|
-
|
|
114
|
-
- "What's the current BTC regime?"
|
|
115
|
-
- "Show me the macro snapshot"
|
|
116
|
-
- "What does the full context template say about market conditions?"
|
|
117
|
-
- "Get the bitcoin price metric with trend analysis"
|
|
118
|
-
- "What's the hash ribbon signal right now?"
|
|
119
|
-
- "List available templates"
|
|
120
|
-
|
|
121
|
-
## Troubleshooting
|
|
122
|
-
|
|
123
|
-
### "Server disconnected" error
|
|
124
|
-
- Ensure Node.js 18+ is installed: `node --version`
|
|
125
|
-
- Check your API key starts with `pr_live_`
|
|
126
|
-
- Fully quit Claude Desktop (system tray > Quit) and reopen
|
|
127
|
-
|
|
128
|
-
### Tools not appearing
|
|
129
|
-
- Restart Claude Desktop after editing config
|
|
130
|
-
- Verify JSON syntax: `node -e "JSON.parse(require('fs').readFileSync('path/to/config','utf8'))"`
|
|
131
|
-
|
|
132
|
-
### Windows: "'C:\Program' is not recognized"
|
|
133
|
-
|
|
134
|
-
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`:
|
|
135
|
-
|
|
136
|
-
1. Run: `npm install -g @prereason/mcp`
|
|
137
|
-
2. Use this config (replace `YOUR_USER` with your Windows username):
|
|
138
|
-
|
|
139
|
-
```json
|
|
140
|
-
{
|
|
141
|
-
"mcpServers": {
|
|
142
|
-
"prereason": {
|
|
143
|
-
"command": "node",
|
|
144
|
-
"args": [
|
|
145
|
-
"C:\\Users\\YOUR_USER\\AppData\\Roaming\\npm\\node_modules\\@prereason\\mcp\\bin\\cli.js"
|
|
146
|
-
],
|
|
147
|
-
"env": {
|
|
148
|
-
"PREREASON_API_KEY": "YOUR_API_KEY"
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Auth errors on get_context / get_metric
|
|
156
|
-
- `list_templates`, `list_metrics`, and `get_health` work without a key
|
|
157
|
-
- `get_context` and `get_metric` require a valid API key
|
|
158
|
-
- Get a free key at [prereason.com/signup](https://www.prereason.com/signup)
|
|
159
|
-
|
|
160
|
-
## Other MCP Clients
|
|
161
|
-
|
|
162
|
-
If your client supports remote HTTP servers, use [Quick Start Option 1](#option-1-direct-http-claude-code-cursor-windsurf-etc) above. The stdio bridge package is only needed for clients that require stdio transport (e.g. Claude Desktop).
|
|
163
|
-
|
|
164
|
-
## CLI Usage
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
# Using environment variable (recommended)
|
|
168
|
-
PREREASON_API_KEY=pr_live_... npx @prereason/mcp
|
|
169
|
-
|
|
170
|
-
# Using --header flag (backward compatible)
|
|
171
|
-
npx @prereason/mcp --header "Authorization:Bearer YOUR_API_KEY"
|
|
172
|
-
|
|
173
|
-
# Custom URL
|
|
174
|
-
PREREASON_URL=https://custom.endpoint/mcp npx @prereason/mcp
|
|
175
|
-
|
|
176
|
-
# Help
|
|
177
|
-
npx @prereason/mcp --help
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Links
|
|
181
|
-
|
|
182
|
-
- [Documentation](https://www.prereason.com/docs#mcp)
|
|
183
|
-
- [Sign Up](https://www.prereason.com/signup)
|
|
184
|
-
- [API Discovery](https://www.prereason.com/.well-known/mcp/server.json)
|
|
185
|
-
- [Terms of Service](https://www.prereason.com/terms)
|
|
186
|
-
- [Privacy Policy](https://www.prereason.com/privacy)
|
|
187
|
-
|
|
188
|
-
## License
|
|
189
|
-
|
|
190
|
-
MIT
|
|
1
|
+
# @prereason/mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@prereason/mcp)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
MCP server for [PreReason](https://www.prereason.com): pre-analyzed Bitcoin and macro financial intelligence.
|
|
7
|
+
|
|
8
|
+
PreReason returns pre-analyzed market context: trend interpretation, momentum analysis, cross-asset correlations, and more. Use it when your task needs to understand market conditions for decision-making, not raw price feeds.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
### Option 1: Direct HTTP (Claude Code, Cursor, Windsurf, etc.)
|
|
13
|
+
|
|
14
|
+
Clients that support remote MCP servers can connect directly with no bridge package needed.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Claude Code (CLI one-liner)
|
|
18
|
+
claude mcp add prereason --transport http https://api.prereason.com/api/mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or add to `.mcp.json` / your client's MCP config:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"prereason": {
|
|
27
|
+
"type": "http",
|
|
28
|
+
"url": "https://api.prereason.com/api/mcp",
|
|
29
|
+
"headers": {
|
|
30
|
+
"Authorization": "Bearer YOUR_API_KEY"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Option 2: stdio bridge (Claude Desktop and other stdio-only clients)
|
|
38
|
+
|
|
39
|
+
**Requires [Node.js 18+](https://nodejs.org)**
|
|
40
|
+
|
|
41
|
+
Add to your MCP client config (e.g. `claude_desktop_config.json`):
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"prereason": {
|
|
47
|
+
"command": "npx",
|
|
48
|
+
"args": ["-y", "@prereason/mcp"],
|
|
49
|
+
"env": {
|
|
50
|
+
"PREREASON_API_KEY": "YOUR_API_KEY"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Claude Desktop config file location:
|
|
58
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
59
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
60
|
+
|
|
61
|
+
Restart your MCP client after editing the config. PreReason should appear with 5 tools.
|
|
62
|
+
|
|
63
|
+
## Get an API Key
|
|
64
|
+
|
|
65
|
+
1. Sign up at [prereason.com/signup](https://www.prereason.com/signup)
|
|
66
|
+
2. Go to Dashboard > Settings > API Keys
|
|
67
|
+
3. Copy your key (starts with `pr_live_`)
|
|
68
|
+
|
|
69
|
+
## 5 MCP Tools
|
|
70
|
+
|
|
71
|
+
| Tool | Auth | Description |
|
|
72
|
+
|------|------|-------------|
|
|
73
|
+
| `list_templates` | Open | List all 17 context templates with tier requirements |
|
|
74
|
+
| `list_metrics` | Open | List all 38 available metrics: 30 API + 8 mining/energy (filterable by category) |
|
|
75
|
+
| `get_health` | Open | API health check, version, account tier |
|
|
76
|
+
| `get_context` | Required | Fetch a context template (markdown or JSON) |
|
|
77
|
+
| `get_metric` | Required | Fetch a single metric with trend/signal/percentile |
|
|
78
|
+
|
|
79
|
+
## 17 Context Templates
|
|
80
|
+
|
|
81
|
+
### Free (6 templates)
|
|
82
|
+
| Template | Description |
|
|
83
|
+
|----------|-------------|
|
|
84
|
+
| `btc.quick-check` | Minimal fast context: BTC + Net Liquidity + correlation |
|
|
85
|
+
| `btc.context` | BTC + liquidity + hash ribbon + difficulty + momentum |
|
|
86
|
+
| `macro.snapshot` | Fed balance, M2, treasury yields, VIX, net liquidity |
|
|
87
|
+
| `cross.correlations` | BTC correlation matrix vs macro indicators |
|
|
88
|
+
| `btc.pulse` | Volume, fees, mempool analysis |
|
|
89
|
+
| `btc.grid-stress` | Epoch pace and difficulty adjustment forecast |
|
|
90
|
+
|
|
91
|
+
### Basic - $19.99/mo (5 templates)
|
|
92
|
+
| Template | Description |
|
|
93
|
+
|----------|-------------|
|
|
94
|
+
| `btc.momentum` | 200D MA support/resistance with 7d/30d/90d momentum and YTD percentiles |
|
|
95
|
+
| `macro.liquidity` | Liquidity indicators with momentum analysis |
|
|
96
|
+
| `btc.on-chain` | Hash rate, difficulty, fees, mempool health |
|
|
97
|
+
| `cross.breadth` | Cross-asset breadth with SPY, DXY, VIX |
|
|
98
|
+
| `btc.miner-survival` | Hashprice thermometer with miner stress scoring |
|
|
99
|
+
|
|
100
|
+
### Pro - $49.99/mo (6 templates)
|
|
101
|
+
| Template | Description |
|
|
102
|
+
|----------|-------------|
|
|
103
|
+
| `btc.full` | Complete market intelligence with all metrics and analysis |
|
|
104
|
+
| `btc.factors` | Multi-factor attribution for BTC price movements |
|
|
105
|
+
| `cross.regime` | Regime classification (risk-on/risk-off/transition) with USDT.D risk sentiment |
|
|
106
|
+
| `fx.liquidity` | FX environment with DXY, treasury, and global liquidity |
|
|
107
|
+
| `btc.energy` | Production cost model with gas input pressure |
|
|
108
|
+
| `btc.treasury` | Corporate Bitcoin treasury intelligence from SEC filings |
|
|
109
|
+
|
|
110
|
+
## Example Prompts
|
|
111
|
+
|
|
112
|
+
Once connected, try prompts like:
|
|
113
|
+
|
|
114
|
+
- "What's the current BTC regime?"
|
|
115
|
+
- "Show me the macro snapshot"
|
|
116
|
+
- "What does the full context template say about market conditions?"
|
|
117
|
+
- "Get the bitcoin price metric with trend analysis"
|
|
118
|
+
- "What's the hash ribbon signal right now?"
|
|
119
|
+
- "List available templates"
|
|
120
|
+
|
|
121
|
+
## Troubleshooting
|
|
122
|
+
|
|
123
|
+
### "Server disconnected" error
|
|
124
|
+
- Ensure Node.js 18+ is installed: `node --version`
|
|
125
|
+
- Check your API key starts with `pr_live_`
|
|
126
|
+
- Fully quit Claude Desktop (system tray > Quit) and reopen
|
|
127
|
+
|
|
128
|
+
### Tools not appearing
|
|
129
|
+
- Restart Claude Desktop after editing config
|
|
130
|
+
- Verify JSON syntax: `node -e "JSON.parse(require('fs').readFileSync('path/to/config','utf8'))"`
|
|
131
|
+
|
|
132
|
+
### Windows: "'C:\Program' is not recognized"
|
|
133
|
+
|
|
134
|
+
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`:
|
|
135
|
+
|
|
136
|
+
1. Run: `npm install -g @prereason/mcp`
|
|
137
|
+
2. Use this config (replace `YOUR_USER` with your Windows username):
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"mcpServers": {
|
|
142
|
+
"prereason": {
|
|
143
|
+
"command": "node",
|
|
144
|
+
"args": [
|
|
145
|
+
"C:\\Users\\YOUR_USER\\AppData\\Roaming\\npm\\node_modules\\@prereason\\mcp\\bin\\cli.js"
|
|
146
|
+
],
|
|
147
|
+
"env": {
|
|
148
|
+
"PREREASON_API_KEY": "YOUR_API_KEY"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Auth errors on get_context / get_metric
|
|
156
|
+
- `list_templates`, `list_metrics`, and `get_health` work without a key
|
|
157
|
+
- `get_context` and `get_metric` require a valid API key
|
|
158
|
+
- Get a free key at [prereason.com/signup](https://www.prereason.com/signup)
|
|
159
|
+
|
|
160
|
+
## Other MCP Clients
|
|
161
|
+
|
|
162
|
+
If your client supports remote HTTP servers, use [Quick Start Option 1](#option-1-direct-http-claude-code-cursor-windsurf-etc) above. The stdio bridge package is only needed for clients that require stdio transport (e.g. Claude Desktop).
|
|
163
|
+
|
|
164
|
+
## CLI Usage
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Using environment variable (recommended)
|
|
168
|
+
PREREASON_API_KEY=pr_live_... npx @prereason/mcp
|
|
169
|
+
|
|
170
|
+
# Using --header flag (backward compatible)
|
|
171
|
+
npx @prereason/mcp --header "Authorization:Bearer YOUR_API_KEY"
|
|
172
|
+
|
|
173
|
+
# Custom URL
|
|
174
|
+
PREREASON_URL=https://custom.endpoint/mcp npx @prereason/mcp
|
|
175
|
+
|
|
176
|
+
# Help
|
|
177
|
+
npx @prereason/mcp --help
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Links
|
|
181
|
+
|
|
182
|
+
- [Documentation](https://www.prereason.com/docs#mcp)
|
|
183
|
+
- [Sign Up](https://www.prereason.com/signup)
|
|
184
|
+
- [API Discovery](https://www.prereason.com/.well-known/mcp/server.json)
|
|
185
|
+
- [Terms of Service](https://www.prereason.com/terms)
|
|
186
|
+
- [Privacy Policy](https://www.prereason.com/privacy)
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT
|
package/bin/cli.js
CHANGED
|
@@ -1,111 +1,109 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* @prereason/mcp — MCP bridge for Claude Desktop
|
|
4
|
-
*
|
|
5
|
-
* Connects Claude Desktop (stdio) to PreReason's Streamable HTTP MCP endpoint.
|
|
6
|
-
*
|
|
7
|
-
* Auth (preferred — works on all platforms):
|
|
8
|
-
* Set PREREASON_API_KEY env var in your MCP client config.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* npx @prereason/mcp
|
|
12
|
-
* npx @prereason/mcp [--header Key:Value]...
|
|
13
|
-
* npx @prereason/mcp <URL> [--header Key:Value]...
|
|
14
|
-
*
|
|
15
|
-
* Environment variables:
|
|
16
|
-
* PREREASON_API_KEY Your API key (adds Authorization: Bearer header)
|
|
17
|
-
* PREREASON_URL Override the default endpoint URL
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
process.stderr.write(`${
|
|
31
|
-
process.stderr.write('Usage:\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');
|
|
37
|
-
process.stderr.write('Options:\n');
|
|
38
|
-
process.stderr.write(' --header Key:Value Add HTTP header (can be repeated)\n');
|
|
39
|
-
process.stderr.write(' --help, -h Show this help\n');
|
|
40
|
-
process.stderr.write(' --version, -v Show version\n\n');
|
|
41
|
-
process.stderr.write(`Default URL: ${DEFAULT_URL}\n`);
|
|
42
|
-
process.exit(0);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
await http.start();
|
|
111
|
-
await stdio.start();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @prereason/mcp — MCP bridge for Claude Desktop
|
|
4
|
+
*
|
|
5
|
+
* Connects Claude Desktop (stdio) to PreReason's Streamable HTTP MCP endpoint.
|
|
6
|
+
*
|
|
7
|
+
* Auth (preferred — works on all platforms):
|
|
8
|
+
* Set PREREASON_API_KEY env var in your MCP client config.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* npx @prereason/mcp
|
|
12
|
+
* npx @prereason/mcp [--header Key:Value]...
|
|
13
|
+
* npx @prereason/mcp <URL> [--header Key:Value]...
|
|
14
|
+
*
|
|
15
|
+
* Environment variables:
|
|
16
|
+
* PREREASON_API_KEY Your API key (adds Authorization: Bearer header)
|
|
17
|
+
* PREREASON_URL Override the default endpoint URL
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
21
|
+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
22
|
+
|
|
23
|
+
// Keep in sync with package.json on each release
|
|
24
|
+
const PKG_NAME = '@prereason/mcp';
|
|
25
|
+
const PKG_VERSION = '0.1.10';
|
|
26
|
+
const DEFAULT_URL = 'https://api.prereason.com/api/mcp';
|
|
27
|
+
|
|
28
|
+
// --- Help / Version ---
|
|
29
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
30
|
+
process.stderr.write(`${PKG_NAME} v${PKG_VERSION}\n\n`);
|
|
31
|
+
process.stderr.write('Usage:\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');
|
|
37
|
+
process.stderr.write('Options:\n');
|
|
38
|
+
process.stderr.write(' --header Key:Value Add HTTP header (can be repeated)\n');
|
|
39
|
+
process.stderr.write(' --help, -h Show this help\n');
|
|
40
|
+
process.stderr.write(' --version, -v Show version\n\n');
|
|
41
|
+
process.stderr.write(`Default URL: ${DEFAULT_URL}\n`);
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
46
|
+
process.stderr.write(`${PKG_VERSION}\n`);
|
|
47
|
+
process.exit(0);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// --- Read environment variables (preferred, avoids Windows cmd.exe quoting issues) ---
|
|
51
|
+
let urlArg = process.env.PREREASON_URL || DEFAULT_URL;
|
|
52
|
+
const headers = {};
|
|
53
|
+
|
|
54
|
+
if (process.env.PREREASON_API_KEY) {
|
|
55
|
+
headers['Authorization'] = `Bearer ${process.env.PREREASON_API_KEY}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// --- Parse CLI arguments (override env vars) ---
|
|
59
|
+
for (let i = 2; i < process.argv.length; i++) {
|
|
60
|
+
if (process.argv[i] === '--header' && process.argv[i + 1]) {
|
|
61
|
+
const val = process.argv[++i];
|
|
62
|
+
const colonIdx = val.indexOf(':');
|
|
63
|
+
if (colonIdx > 0) {
|
|
64
|
+
headers[val.slice(0, colonIdx).trim()] = val.slice(colonIdx + 1).trim();
|
|
65
|
+
}
|
|
66
|
+
} else if (!process.argv[i].startsWith('-')) {
|
|
67
|
+
urlArg = process.argv[i];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const url = new URL(urlArg);
|
|
72
|
+
|
|
73
|
+
// --- Create transports ---
|
|
74
|
+
const stdio = new StdioServerTransport();
|
|
75
|
+
const http = new StreamableHTTPClientTransport(url, {
|
|
76
|
+
requestInit: Object.keys(headers).length > 0 ? { headers } : undefined,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// --- Wire message routing ---
|
|
80
|
+
stdio.onmessage = (msg) => {
|
|
81
|
+
http.send(msg).catch((e) => {
|
|
82
|
+
process.stderr.write(`[prereason:send] ${e.message}\n`);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
http.onmessage = (msg) => {
|
|
87
|
+
stdio.send(msg).catch((e) => {
|
|
88
|
+
process.stderr.write(`[prereason:recv] ${e.message}\n`);
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// --- Error handling ---
|
|
93
|
+
stdio.onerror = (e) => process.stderr.write(`[prereason:stdio] ${e.message}\n`);
|
|
94
|
+
http.onerror = (e) => process.stderr.write(`[prereason:http] ${e.message}\n`);
|
|
95
|
+
|
|
96
|
+
// --- Graceful shutdown ---
|
|
97
|
+
stdio.onclose = () => {
|
|
98
|
+
http.close();
|
|
99
|
+
process.exit(0);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
http.onclose = () => {
|
|
103
|
+
stdio.close();
|
|
104
|
+
process.exit(0);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// --- Start ---
|
|
108
|
+
await http.start();
|
|
109
|
+
await stdio.start();
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@prereason/mcp",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "MCP server for pre-analyzed Bitcoin and macro financial intelligence. 17 context templates with trend interpretation, momentum analysis, and cross-asset correlations.",
|
|
6
|
-
"bin": {
|
|
7
|
-
"prereason-mcp": "./bin/cli.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"bin",
|
|
11
|
-
"README.md",
|
|
12
|
-
"LICENSE",
|
|
13
|
-
"CHANGELOG.md"
|
|
14
|
-
],
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@modelcontextprotocol/sdk": "1.27.1"
|
|
17
|
-
},
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=18"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"mcp",
|
|
23
|
-
"model-context-protocol",
|
|
24
|
-
"claude",
|
|
25
|
-
"bitcoin",
|
|
26
|
-
"macro",
|
|
27
|
-
"prereason",
|
|
28
|
-
"ai",
|
|
29
|
-
"llm",
|
|
30
|
-
"finance",
|
|
31
|
-
"crypto",
|
|
32
|
-
"financial-data",
|
|
33
|
-
"liquidity",
|
|
34
|
-
"ai-agent",
|
|
35
|
-
"trading",
|
|
36
|
-
"market-data",
|
|
37
|
-
"context-protocol"
|
|
38
|
-
],
|
|
39
|
-
"license": "MIT",
|
|
40
|
-
"homepage": "https://www.prereason.com/docs#mcp",
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "https://github.com/
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@prereason/mcp",
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "MCP server for pre-analyzed Bitcoin and macro financial intelligence. 17 context templates with trend interpretation, momentum analysis, and cross-asset correlations.",
|
|
6
|
+
"bin": {
|
|
7
|
+
"prereason-mcp": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"CHANGELOG.md"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@modelcontextprotocol/sdk": "1.27.1"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"mcp",
|
|
23
|
+
"model-context-protocol",
|
|
24
|
+
"claude",
|
|
25
|
+
"bitcoin",
|
|
26
|
+
"macro",
|
|
27
|
+
"prereason",
|
|
28
|
+
"ai",
|
|
29
|
+
"llm",
|
|
30
|
+
"finance",
|
|
31
|
+
"crypto",
|
|
32
|
+
"financial-data",
|
|
33
|
+
"liquidity",
|
|
34
|
+
"ai-agent",
|
|
35
|
+
"trading",
|
|
36
|
+
"market-data",
|
|
37
|
+
"context-protocol"
|
|
38
|
+
],
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"homepage": "https://www.prereason.com/docs#mcp",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/PreReason/mcp"
|
|
44
|
+
}
|
|
45
|
+
}
|