@aetherwealth/mcp 0.1.18-beta.4 → 0.1.21

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 (3) hide show
  1. package/README.md +124 -121
  2. package/dist/index.js +35 -35
  3. package/package.json +23 -3
package/README.md CHANGED
@@ -1,146 +1,149 @@
1
- # @aetherwealth/mcp
1
+ # Aether Wealth MCP Server
2
2
 
3
- A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes
4
- a user's **Aether Wealth** trading journal to MCP clients such as Claude Desktop.
3
+ Official Model Context Protocol (MCP) server for Aether Wealth. Connect any
4
+ stdio-compatible MCP client to your Aether Wealth trading journal, accounts,
5
+ alerts, market context, macro calendar, and technical indicators.
5
6
 
6
- Authentication is **per-user OAuth 2.1** the user signs in through the browser
7
- and the MCP stores a personal access token locally. No shared secret is
8
- configured on the user's machine. Data calls go to `aether-backend` over a typed
9
- **tRPC** client.
7
+ The package runs locally with `npx`, authenticates with browser-based OAuth, and
8
+ uses your Aether Wealth account permissions for every data tool. It is built for
9
+ traders who want an AI assistant to inspect their journal, summarize performance,
10
+ create alerts, and fetch market context without copying API keys into their MCP
11
+ client.
10
12
 
11
- > Destructive tools (`delete_trade`, `delete_account`) are intentionally not
12
- > exposed — trades are permanent records; delete them in the web app. Market-data
13
- > tools are public (work without sign-in); everything else needs `login`.
13
+ ## Install
14
14
 
15
- ## Tools
16
-
17
- **Auth**
18
-
19
- | Tool | Purpose |
20
- |------|---------|
21
- | `login` | Sign in. Opens the browser; after you approve, the MCP stores a per-user token. |
22
- | `logout` | Sign out on this device (clears the stored token). |
23
-
24
- **Trades** (require sign-in)
25
-
26
- | Tool | Purpose |
27
- |------|---------|
28
- | `list_trades` | List trades; filter by account, status, pair, or date range. |
29
- | `get_trade` | Get a single trade by id. |
30
- | `list_accounts` | List trading accounts (for `create_trade`'s `accountId`). |
31
- | `trade_stats` | Performance statistics (win rate, PnL, …). |
32
- | `create_trade` | Record a new trade. |
33
- | `update_trade` | Update fields on a trade. |
34
- | `close_trade` | Close an open trade with an exit price + time. |
35
-
36
- **Alerts** (require sign-in)
37
-
38
- | Tool | Purpose |
39
- |------|---------|
40
- | `list_alerts` / `list_indicator_alerts` | List price+trendline / indicator alerts. |
41
- | `create_price_alert` | Price-level alert (above/below/crosses). |
42
- | `create_trendline_alert` | Trendline alert from two points. |
43
- | `create_indicator_alert` | Indicator-output alert (e.g. RSI crosses 70). |
44
- | `update_alert` / `delete_alert` | Update / delete a price/trendline alert. |
45
- | `update_indicator_alert` / `delete_indicator_alert` | Update / delete an indicator alert. |
15
+ Use the package in any MCP client that can launch a local stdio server.
46
16
 
47
- **Market data** (public — no sign-in)
17
+ ```bash
18
+ npx -y @aetherwealth/mcp
19
+ ```
48
20
 
49
- | Tool | Purpose |
50
- |------|---------|
51
- | `get_candles` | Recent OHLC candles (up to 500) for a pair + timeframe, read from Redis. |
52
- | `list_economic_calendar` | Economic calendar events; filter by currency, date, impact. |
53
- | `get_macro_series` | Macro indicator time series (e.g. USD cpi). |
54
- | `get_market_config` | Catalog of supported instruments + timeframes. |
21
+ Most MCP clients use a JSON config like this:
55
22
 
56
- A sign-in-required tool called while signed out returns an "authentication
57
- required — call `login`" error, so the assistant prompts you to sign in.
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "aether-wealth": {
27
+ "command": "npx",
28
+ "args": ["-y", "@aetherwealth/mcp"]
29
+ }
30
+ }
31
+ }
32
+ ```
58
33
 
59
- ## Authentication flow
34
+ Restart your MCP client after adding the server. Then ask it to run the
35
+ `login` tool once.
60
36
 
61
- `login` runs an OAuth 2.1 Authorization Code + PKCE flow as a public client:
37
+ ## What It Does
62
38
 
63
- 1. Discover the provider endpoints from `${AETHER_BASE_URL}/auth/api/.well-known/openid-configuration`.
64
- 2. Start a loopback listener on `127.0.0.1` (a fixed port from a small set).
65
- 3. Open the browser to the authorize URL. If you're already signed in to the
66
- Aether Wealth web app it completes immediately; otherwise you sign in there.
67
- 4. The redirect lands on the loopback listener with an authorization code, which
68
- is exchanged (with the PKCE verifier) for an access token.
69
- 5. The token is stored in the **OS keychain** (macOS Keychain / Windows
70
- Credential Manager / Linux libsecret), with a `0600`-file fallback, keyed by
71
- backend host so prod and beta tokens coexist.
39
+ Aether Wealth MCP gives AI assistants a safe tool layer over Aether Wealth:
72
40
 
73
- The token is long-lived; there is no refresh token. When it expires, run `login`
74
- again.
41
+ - Read and summarize your trading journal
42
+ - List accounts and performance stats
43
+ - Create, update, and close trade records
44
+ - Create and manage price, trendline, and indicator alerts
45
+ - Fetch candles, economic calendar events, macro series, and market config
46
+ - Compute technical indicators such as RSI, MACD, EMA, Bollinger Bands, ATR,
47
+ ADX, Supertrend, and more
75
48
 
76
- ## Configuration
49
+ Aether Wealth is trading analysis and journaling software. This MCP server does
50
+ not place broker orders or execute trades.
77
51
 
78
- See [`.env.example`](./.env.example).
52
+ ## Authentication
79
53
 
80
- | Var | Required | Notes |
81
- |-----|----------|-------|
82
- | `AETHER_BASE_URL` | prod only | aether-backend base URL (OAuth + tRPC). Falls back to `http://localhost:9006` in dev. |
83
- | `AETHER_MCP_CREDENTIALS_FILE` | no | Set to force the `0600`-file credential store instead of the OS keychain. |
84
- | `MCP_TRANSPORT` | no | `stdio` (default) or `http`. |
85
- | `MCP_HTTP_PORT` / `MCP_HTTP_HOST` / `MCP_HTTP_PATH` / `MCP_HTTP_BEARER` | no | HTTP transport only. |
54
+ The `login` tool opens the Aether Wealth OAuth flow in your browser. After you
55
+ approve access, the MCP stores a local token in the operating-system keychain
56
+ where available, with a protected file fallback.
86
57
 
87
- ## Running
58
+ No shared API key is configured in your MCP client. All data tools require
59
+ OAuth sign-in, including market-data tools. `logout` clears the local
60
+ credential for this device.
88
61
 
89
- ```bash
90
- # From the repo root
91
- bun run --filter=@aetherwealth/mcp start
92
- # Or directly
93
- cd apps/aether-wealth-mcp && bun run src/index.ts
94
- ```
62
+ ## Tools
95
63
 
96
- ### Claude Desktop config example
64
+ ### Auth
97
65
 
98
- ```json
99
- {
100
- "mcpServers": {
101
- "aether-wealth": {
102
- "command": "bun",
103
- "args": ["run", "/abs/path/to/apps/aether-wealth-mcp/src/index.ts"],
104
- "env": { "AETHER_BASE_URL": "https://api.aetherwealth.ai" }
105
- }
106
- }
107
- }
108
- ```
66
+ | Tool | Purpose |
67
+ | --- | --- |
68
+ | `login` | Sign in with Aether Wealth OAuth. |
69
+ | `logout` | Clear the local OAuth credential on this device. |
109
70
 
110
- Then ask the assistant to sign in (it calls `login`), complete the browser
111
- sign-in, and your trades become available.
71
+ ### Trades, Accounts, And Stats
112
72
 
113
- ## Build & quality
73
+ | Tool | Purpose |
74
+ | --- | --- |
75
+ | `list_trades` | List trades by account, status, pair, or date range. |
76
+ | `get_trade` | Fetch one trade by ID. |
77
+ | `list_accounts` | List your trading accounts. |
78
+ | `trade_stats` | Summarize performance, win rate, PnL, and related stats. |
79
+ | `create_trade` | Record a new trade. |
80
+ | `update_trade` | Update fields on an existing trade. |
81
+ | `close_trade` | Close an open trade with exit price and time. |
114
82
 
115
- ```bash
116
- bun run --filter=@aetherwealth/mcp test # vitest
117
- bun run --filter=@aetherwealth/mcp typecheck # tsc --noEmit
118
- bun run --filter=@aetherwealth/mcp lint # biome
119
- bun run --filter=@aetherwealth/mcp build # bun bundle → dist/
120
- ```
83
+ ### Alerts
121
84
 
122
- > The typecheck imports `AppRouter` from `@opusaether/aether-backend/trpc`, so
123
- > aether-backend's declarations must be built first (the turbo pipeline handles
124
- > this). A stale `node_modules` makes the vitest suite fail with
125
- > `[TSCONFIG_ERROR]` fix with `bun install` and `GITHUB_TOKEN` set.
85
+ | Tool | Purpose |
86
+ | --- | --- |
87
+ | `list_alerts` | List price and trendline alerts. |
88
+ | `create_price_alert` | Create a price-level alert. |
89
+ | `create_trendline_alert` | Create a trendline alert from two chart points. |
90
+ | `update_alert` | Update or archive a price or trendline alert. |
91
+ | `delete_alert` | Delete a price or trendline alert. |
92
+ | `list_indicator_alerts` | List indicator-based alerts. |
93
+ | `create_indicator_alert` | Create an alert on an indicator output condition. |
94
+ | `update_indicator_alert` | Update an indicator alert. |
95
+ | `delete_indicator_alert` | Delete an indicator alert. |
96
+
97
+ ### Market Context
126
98
 
127
- ## Architecture
99
+ | Tool | Purpose |
100
+ | --- | --- |
101
+ | `get_candles` | Fetch recent OHLC candles for a pair and timeframe. |
102
+ | `list_economic_calendar` | List economic calendar events by currency, release, date, or impact. |
103
+ | `get_macro_series` | Fetch macro indicator time series such as CPI or interest-rate data. |
104
+ | `get_market_config` | Fetch supported instruments and timeframes. |
128
105
 
129
- ```
130
- index.ts entry: config → credential store → OAuth session → tRPC client → transport
131
- config.ts env → { baseUrl, trpcUrl, host } (OAuth-only)
132
- trpc-client.ts typed tRPC client (AppRouter); attaches Bearer token per request
133
- tool-registry.ts login / logout / list_trades; McpToolContext = { session, trpc }
134
- server.ts registry → @modelcontextprotocol/sdk request-handler bridge
135
- oauth/
136
- contract.ts client id / redirect ports / scopes (mirrors aether-backend constants)
137
- pkce.ts PKCE verifier + S256 challenge, state
138
- discovery.ts fetch the AS openid-configuration
139
- loopback.ts loopback redirect listener (captures code/state)
140
- browser.ts open the system browser
141
- login.ts runLogin: PKCE → loopback → browser → token exchange
142
- credential-store.ts OS keychain + 0600-file fallback, keyed by host
143
- session.ts OAuthSession: getAccessToken / login / logout
144
- ```
106
+ ### Technical Indicators
145
107
 
146
- See [ADR 0001](../../docs/adr/0001-mcp-oauth.md) for the auth design + trade-offs.
108
+ | Tool | Purpose |
109
+ | --- | --- |
110
+ | `get_indicators` | Compute up to 8 technical indicators for a pair and interval. |
111
+
112
+ ## Example Prompts
113
+
114
+ - "List my open trades and group them by pair. Flag anything without a stop
115
+ loss."
116
+ - "Summarize my last 20 closed trades. What setup is leaking the most R?"
117
+ - "What high-impact USD events are left this week, and which open trades overlap
118
+ them?"
119
+ - "Fetch EUR/USD 1h RSI and MACD, then create an alert if RSI crosses below 40."
120
+ - "Create a price alert if XAU/USD crosses yesterday's high before New York
121
+ open."
122
+
123
+ ## Safety And Limits
124
+
125
+ - OAuth is per user. Your MCP client does not store a shared service secret.
126
+ - Tokens are stored locally and can be cleared with `logout`.
127
+ - Backend rate limits protect market-data reads, MCP Bearer traffic, and
128
+ cost-sensitive indicator calls.
129
+ - Technical indicators include request, active-pair, cache, and upstream credit
130
+ gates.
131
+ - Destructive trade and account deletion tools are intentionally not exposed.
132
+ - The MCP does not execute trades or route broker orders.
133
+
134
+ ## Updating
135
+
136
+ If your MCP client launches the server with `npx -y @aetherwealth/mcp`, restart
137
+ the client to pick up the current published package.
138
+
139
+ The backend can also advertise a minimum supported MCP version. If your local
140
+ server is too old, tool calls return an update-required message instead of
141
+ failing silently.
142
+
143
+ ## Links
144
+
145
+ - Aether Wealth: https://aetherwealth.ai
146
+ - Trading app: https://app.aetherwealth.ai
147
+ - MCP page: https://aetherwealth.ai/mcp
148
+ - Tool reference: https://aetherwealth.ai/mcp-tools.json
149
+ - npm package: https://www.npmjs.com/package/@aetherwealth/mcp