@prereason/mcp 0.1.11 → 0.1.13

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.
Files changed (5) hide show
  1. package/CHANGELOG.md +70 -64
  2. package/LICENSE +21 -21
  3. package/README.md +190 -190
  4. package/bin/cli.js +109 -109
  5. package/package.json +46 -45
package/CHANGELOG.md CHANGED
@@ -1,64 +1,70 @@
1
- # Changelog
2
-
3
- ## 0.1.11 (2026-03-17)
4
-
5
- - Vocabulary alignment: "templates" "briefings" across README, CHANGELOG, and tool references
6
- - Update published npm description to reference "briefings" instead of "templates"
7
-
8
- ## 0.1.10 (2026-03-15)
9
-
10
- - Enable SLSA provenance attestation via GitHub Actions publish workflow
11
- - Fix workflow placement: move from `packages/mcp/.github/` to repo root `.github/workflows/`
12
- - Switch publish trigger to `workflow_dispatch` for manual control
13
-
14
- ## 0.1.9 (2026-03-10)
15
-
16
- - Expand `socket.yml` to suppress all known-safe transitive dependency alerts from `@modelcontextprotocol/sdk`
17
- - Covers eval (ajv), shell (cross-spawn), filesystem (express/send), debug, dynamic require, unmaintained micro-packages, and more
18
-
19
- ## 0.1.8 (2026-03-05)
20
-
21
- - Remove `createRequire` / dynamic `require('../package.json')` — hardcode version constants
22
- - Eliminates Socket.dev "Dynamic require" and "Filesystem access" findings from our code
23
- - Add `socket.yml` for GitHub PR alert suppression of expected behaviors (network access, env vars)
24
-
25
- ## 0.1.7 (2026-03-04)
26
-
27
- - Pin `@modelcontextprotocol/sdk` to exact `1.27.1` (fixes transitive CVEs in hono and qs)
28
- - Update metric count from 26 to 30 (added 200D MA, distance from 200D MA, USDT market cap, USDT dominance)
29
- - Update `btc.momentum` description to reflect 200D MA support/resistance
30
- - Update `cross.regime` description to reflect USDT.D risk sentiment
31
-
32
- ## 0.1.6 (2026-02-25)
33
-
34
- - Fix description wording: replace "trend signals" with "trend interpretation"
35
- - Add SECURITY.md with vulnerability reporting policy
36
- - Add GitHub Actions CI workflow for provenance-signed npm publishing
37
- - Public source repo at https://github.com/PreReason/mcp
38
-
39
- ## 0.1.3 (2026-02-21)
40
-
41
- - Add `PREREASON_API_KEY` environment variable support (fixes Windows `cmd.exe` quoting crash)
42
- - Add `PREREASON_URL` environment variable for custom endpoint
43
- - Update all config examples to use `env` block (matches Stripe/Supabase pattern)
44
- - `--header` CLI args still supported for backward compatibility
45
-
46
- ## 0.1.2 (2026-02-21)
47
-
48
- - Fix Windows path resolution issue in Claude Desktop (rename `.mjs` → `.js` bin entry)
49
- - Add Windows troubleshooting section in README
50
-
51
- ## 0.1.1 (2026-02-21)
52
-
53
- - Add MIT LICENSE file
54
- - Enhance README with full briefing list, troubleshooting, and example prompts
55
- - Add CHANGELOG
56
-
57
- ## 0.1.0 (2026-02-20)
58
-
59
- - Initial release
60
- - stdio-to-Streamable HTTP bridge for Claude Desktop
61
- - Default URL: `https://api.prereason.com/api/mcp`
62
- - `--header Key:Value` flag for API key authentication
63
- - `--help` and `--version` flags
64
- - 5 MCP tools: get_context, get_metric, list_briefings, list_metrics, get_health
1
+ # Changelog
2
+
3
+ ## 0.1.12 (2026-03-17)
4
+
5
+ - Switch publish workflow to OIDC trusted publisher (no NPM_TOKEN needed)
6
+ - Trigger on tag push (`v*`) instead of GitHub releases
7
+ - Fix repository URL to canonical npm format
8
+
9
+ ## 0.1.11 (2026-03-17)
10
+
11
+ - Vocabulary alignment: "templates" "briefings" across README, CHANGELOG, and tool references
12
+ - Update published npm description to reference "briefings" instead of "templates"
13
+
14
+ ## 0.1.10 (2026-03-15)
15
+
16
+ - Enable SLSA provenance attestation via GitHub Actions publish workflow
17
+ - Fix workflow placement: move from `packages/mcp/.github/` to repo root `.github/workflows/`
18
+ - Switch publish trigger to `workflow_dispatch` for manual control
19
+
20
+ ## 0.1.9 (2026-03-10)
21
+
22
+ - Expand `socket.yml` to suppress all known-safe transitive dependency alerts from `@modelcontextprotocol/sdk`
23
+ - Covers eval (ajv), shell (cross-spawn), filesystem (express/send), debug, dynamic require, unmaintained micro-packages, and more
24
+
25
+ ## 0.1.8 (2026-03-05)
26
+
27
+ - Remove `createRequire` / dynamic `require('../package.json')` hardcode version constants
28
+ - Eliminates Socket.dev "Dynamic require" and "Filesystem access" findings from our code
29
+ - Add `socket.yml` for GitHub PR alert suppression of expected behaviors (network access, env vars)
30
+
31
+ ## 0.1.7 (2026-03-04)
32
+
33
+ - Pin `@modelcontextprotocol/sdk` to exact `1.27.1` (fixes transitive CVEs in hono and qs)
34
+ - Update metric count from 26 to 30 (added 200D MA, distance from 200D MA, USDT market cap, USDT dominance)
35
+ - Update `btc.momentum` description to reflect 200D MA support/resistance
36
+ - Update `cross.regime` description to reflect USDT.D risk sentiment
37
+
38
+ ## 0.1.6 (2026-02-25)
39
+
40
+ - Fix description wording: replace "trend signals" with "trend interpretation"
41
+ - Add SECURITY.md with vulnerability reporting policy
42
+ - Add GitHub Actions CI workflow for provenance-signed npm publishing
43
+ - Public source repo at https://github.com/PreReason/mcp
44
+
45
+ ## 0.1.3 (2026-02-21)
46
+
47
+ - Add `PREREASON_API_KEY` environment variable support (fixes Windows `cmd.exe` quoting crash)
48
+ - Add `PREREASON_URL` environment variable for custom endpoint
49
+ - Update all config examples to use `env` block (matches Stripe/Supabase pattern)
50
+ - `--header` CLI args still supported for backward compatibility
51
+
52
+ ## 0.1.2 (2026-02-21)
53
+
54
+ - Fix Windows path resolution issue in Claude Desktop (rename `.mjs` → `.js` bin entry)
55
+ - Add Windows troubleshooting section in README
56
+
57
+ ## 0.1.1 (2026-02-21)
58
+
59
+ - Add MIT LICENSE file
60
+ - Enhance README with full briefing list, troubleshooting, and example prompts
61
+ - Add CHANGELOG
62
+
63
+ ## 0.1.0 (2026-02-20)
64
+
65
+ - Initial release
66
+ - stdio-to-Streamable HTTP bridge for Claude Desktop
67
+ - Default URL: `https://api.prereason.com/api/mcp`
68
+ - `--header Key:Value` flag for API key authentication
69
+ - `--help` and `--version` flags
70
+ - 5 MCP tools: get_context, get_metric, list_briefings, 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
- [![npm version](https://img.shields.io/npm/v/@prereason/mcp.svg)](https://www.npmjs.com/package/@prereason/mcp)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
-
6
- MCP server for [PreReason](https://www.prereason.com) — the Context API for financial agents.
7
-
8
- PreReason returns pre-reasoned market briefings: trend signals, regime classification, confidence scores, cross-asset correlations, and causal narratives. Use it when your agent needs to reason about market conditions, not parse 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_briefings` | Open | List all 17 pre-reasoned market briefings 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 pre-reasoned market briefing (markdown or JSON) |
77
- | `get_metric` | Required | Fetch a single metric with trend/signal/percentile |
78
-
79
- ## 17 Market Briefings
80
-
81
- ### Free (6 briefings)
82
- | Briefing | 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 briefings)
92
- | Briefing | 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 briefings)
101
- | Briefing | 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 briefing 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 briefings"
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_briefings`, `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
+ [![npm version](https://img.shields.io/npm/v/@prereason/mcp.svg)](https://www.npmjs.com/package/@prereason/mcp)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ MCP server for [PreReason](https://www.prereason.com) — the Context API for financial agents.
7
+
8
+ PreReason returns pre-reasoned market briefings: trend signals, regime classification, confidence scores, cross-asset correlations, and causal narratives. Use it when your agent needs to reason about market conditions, not parse 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_briefings` | Open | List all 17 pre-reasoned market briefings 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 pre-reasoned market briefing (markdown or JSON) |
77
+ | `get_metric` | Required | Fetch a single metric with trend/signal/percentile |
78
+
79
+ ## 17 Market Briefings
80
+
81
+ ### Free (6 briefings)
82
+ | Briefing | 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 briefings)
92
+ | Briefing | 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 briefings)
101
+ | Briefing | 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 briefing 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 briefings"
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_briefings`, `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,109 +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 { 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.11';
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();
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.12';
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,46 @@
1
- {
2
- "name": "@prereason/mcp",
3
- "version": "0.1.11",
4
- "type": "module",
5
- "description": "MCP server for PreReason — the Context API for financial agents. 17 pre-reasoned market briefings with trend signals, regime classification, confidence scores, 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
- "context-api",
33
- "market-briefing",
34
- "liquidity",
35
- "ai-agent",
36
- "pre-reasoned",
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
- }
1
+ {
2
+ "name": "@prereason/mcp",
3
+ "version": "0.1.13",
4
+ "mcpName": "com.prereason/mcp",
5
+ "type": "module",
6
+ "description": "MCP server for PreReason — the Context API for financial agents. 17 pre-reasoned market briefings with trend signals, regime classification, confidence scores, and cross-asset correlations.",
7
+ "bin": {
8
+ "prereason-mcp": "./bin/cli.js"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "README.md",
13
+ "LICENSE",
14
+ "CHANGELOG.md"
15
+ ],
16
+ "dependencies": {
17
+ "@modelcontextprotocol/sdk": "1.27.1"
18
+ },
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "keywords": [
23
+ "mcp",
24
+ "model-context-protocol",
25
+ "claude",
26
+ "bitcoin",
27
+ "macro",
28
+ "prereason",
29
+ "ai",
30
+ "llm",
31
+ "finance",
32
+ "crypto",
33
+ "context-api",
34
+ "market-briefing",
35
+ "liquidity",
36
+ "ai-agent",
37
+ "pre-reasoned",
38
+ "context-protocol"
39
+ ],
40
+ "license": "MIT",
41
+ "homepage": "https://www.prereason.com/docs#mcp",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/PreReason/mcp.git"
45
+ }
46
+ }