asrai-mcp 1.1.0 → 1.3.0

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/README.md CHANGED
@@ -79,8 +79,47 @@ Each API call costs **$0.005 USDC** from your wallet on Base mainnet. Make sure
79
79
  | `chain_tokens(chain, max_mcap)` | Low-cap tokens on a specific chain | $0.005 |
80
80
  | `portfolio` | Abu's curated model portfolio — investment reference | $0.005 |
81
81
  | `ask_ai(question)` | AI analyst freeform answer | $0.01 |
82
+ | `positions` | Your live open positions across connected exchanges (MEXC, Binance, Lighter) — requires exchange keys configured via /exchange_apis in Telegram | $0.005–$0.015 |
82
83
  | `indicator_guide(name)` | Reference guide for Asrai-specific indicators | FREE |
83
84
 
85
+ ## Exchange positions (`positions` tool)
86
+
87
+ To use the `positions` tool, add your exchange API keys to `~/.env`:
88
+
89
+ ```
90
+ # MEXC
91
+ MEXC_API_KEY=mx0vgl...
92
+ MEXC_SECRET_KEY=your_secret...
93
+
94
+ # Binance
95
+ BINANCE_API_KEY=your_api_key...
96
+ BINANCE_SECRET_KEY=your_secret...
97
+
98
+ # Lighter
99
+ LIGHTER_L1_ADDRESS=0x...
100
+ LIGHTER_API_PRIVATE_KEY=0x...
101
+ ```
102
+
103
+ Or pass them in the Claude Desktop config `env` block:
104
+
105
+ ```json
106
+ {
107
+ "mcpServers": {
108
+ "asrai": {
109
+ "command": "npx",
110
+ "args": ["-y", "asrai-mcp@latest"],
111
+ "env": {
112
+ "ASRAI_PRIVATE_KEY": "0x<your_base_wallet_private_key>",
113
+ "MEXC_API_KEY": "mx0vgl...",
114
+ "MEXC_SECRET_KEY": "your_secret..."
115
+ }
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ Only configure the exchanges you use — the tool auto-detects which keys are set and fetches only those.
122
+
84
123
  ## Spend limit
85
124
 
86
125
  Default session cap: **$2.00 USDC**. To change:
package/bin/asrai.js CHANGED
@@ -38,7 +38,8 @@ if (!tool) {
38
38
  console.error('Usage: asrai <tool> [args...]');
39
39
  console.error('Tools: ask_ai, technical_analysis, sentiment, forecast, market_overview,');
40
40
  console.error(' coin_info, screener, smart_money, elliott_wave, ichimoku, cashflow,');
41
- console.error(' dexscreener, chain_tokens, portfolio, channel_summary, indicator_guide');
41
+ console.error(' dexscreener, chain_tokens, portfolio, channel_summary, indicator_guide,');
42
+ console.error(' positions (requires MEXC_API_KEY, BINANCE_API_KEY, or LIGHTER_L1_ADDRESS in ~/.env)');
42
43
  process.exit(1);
43
44
  }
44
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asrai-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Asrai crypto analysis MCP server — pay-per-use via x402 on Base. Zero install: just npx.",
5
5
  "keywords": [
6
6
  "mcp",
package/skill/SKILL.md CHANGED
@@ -13,11 +13,33 @@ Use Asrai tools when the user asks about crypto prices, market analysis, trading
13
13
 
14
14
  - Crypto price / chart / technical analysis → use asrai tools
15
15
  - Market sentiment, CBBI, fear/greed → use asrai tools
16
- - "What should I buy?" / portfolio advice → use `portfolio` tool
16
+ - "What should I buy?" / buy opportunities / entry points → use `trade_signals` + `portfolio`
17
+ - Full market overview / morning report → use `market_overview`
17
18
  - Elliott Wave, smart money, order blocks → use asrai tools
18
19
  - DEX data, low-cap tokens → use asrai tools
19
20
  - General knowledge you already know well → answer directly (costs $0.005 per call)
20
21
 
22
+ ## Tool selection guide
23
+
24
+ | User asks... | Primary tool | Supporting tools |
25
+ |---|---|---|
26
+ | "what to buy?" / "buy opportunities" / "entry points" | `trade_signals` | `portfolio`, `sentiment` |
27
+ | "market overview" / "morning report" / "full brief" | `market_overview` | — |
28
+ | "what's trending?" / "hot coins" | `trending` | `gainers_losers` |
29
+ | "BTC analysis" / chart / signals | `technical_analysis` | `smart_money`, `elliott_wave` |
30
+ | "price prediction" / "forecast" | `forecast` | `technical_analysis` |
31
+ | "market sentiment" / "fear greed" / CBBI | `sentiment` | `dominance`, `macro` |
32
+ | "ATH" / "all-time high" coins | `ath_tracker` | `trade_signals` |
33
+ | "volume spikes" / unusual volume | `volume_spikes` | `high_volume_low_cap` |
34
+ | "find coins" / screener criteria | `screener` | `top_bottom` |
35
+ | "cashflow" / capital flow | `cashflow` | `sentiment` |
36
+ | "unlocked coins" / vesting pressure | `late_unlocked_coins` | — |
37
+ | "low cap gems" / DEX / chain tokens | `chain_tokens` | `dexscreener`, `high_volume_low_cap` |
38
+ | "portfolio" / "Abu's picks" | `portfolio` | `coin_info` |
39
+ | "my positions" / "open trades" / "my PnL" / "what am I trading" | `positions` | — |
40
+
41
+ **Important:** For buy opportunity questions ALWAYS call `trade_signals` — it combines trending movers, bounces, SAR & MACD entries, RSI, and Galaxy Score in one call.
42
+
21
43
  ## How to call
22
44
 
23
45
  ### If asrai MCP tools are available (Cursor, Cline, Claude Desktop)
@@ -82,8 +104,28 @@ Requires `ASRAI_PRIVATE_KEY` set in `~/.env` or environment. Payment is signed a
82
104
  | `chain_tokens(chain, max_mcap)` | Low-cap tokens on a specific chain | $0.005 |
83
105
  | `portfolio` | Abu's curated model portfolio — investment reference | $0.005 |
84
106
  | `ask_ai(question)` | AI analyst freeform answer | $0.01 |
107
+ | `positions` | Your live open positions across connected exchanges (MEXC, Binance, Lighter) — requires exchange keys configured via /exchange_apis in Telegram | $0.005–$0.015 |
85
108
  | `indicator_guide(name)` | Reference guide for Asrai-specific indicators | FREE |
86
109
 
110
+ ## Exchange positions setup
111
+
112
+ To use the `positions` tool, add exchange API keys to `~/.env`:
113
+
114
+ ```
115
+ # MEXC
116
+ MEXC_API_KEY=mx0vgl...
117
+ MEXC_SECRET_KEY=your_secret...
118
+
119
+ # Binance
120
+ BINANCE_API_KEY=your_api_key...
121
+ BINANCE_SECRET_KEY=your_secret...
122
+
123
+ # Lighter
124
+ LIGHTER_L1_ADDRESS=0x...
125
+ LIGHTER_API_PRIVATE_KEY=0x...
126
+ ```
127
+
128
+ Only configure the exchanges you use — tool auto-detects which keys are set.
87
129
 
88
130
  🎨 Output Style — Human-Friendly Format
89
131
 
@@ -52,7 +52,7 @@ x402 automatic — $0.005 USDC per endpoint on Base mainnet ($0.01 for `/ai`)
52
52
  - `GET /api/rsi/`
53
53
  - `GET /api/ao/`
54
54
  - `GET /api/rsi-heatmap/`
55
- - `GET /api/indicator/today` — today's triggered ALSAT & indicator signals (TD9, AlphaTrend, etc.) — today's triggered ALSAT & indicator signals (TD9, AlphaTrend, etc.)
55
+ - `GET /api/indicator/today` — today's triggered ALSAT & indicator signals (TD9, AlphaTrend, etc.)
56
56
 
57
57
  ### Coin Info
58
58
  - `GET /api/coinstats/<symbol>` — market cap, volume, supply
@@ -74,6 +74,11 @@ x402 automatic — $0.005 USDC per endpoint on Base mainnet ($0.01 for `/ai`)
74
74
  - `GET /api/portfolio/` — full portfolio
75
75
  - `GET /api/portfolio/<symbol>` — portfolio for specific coin
76
76
 
77
+ ### Exchange Positions
78
+ - `GET /api/exchange/<exchange>/<api_key>/<secret_key>` — live positions for exchange (`mexc`, `binance`, `lighter`)
79
+ - Keys read from `~/.env` automatically: `MEXC_API_KEY`, `MEXC_SECRET_KEY`, `BINANCE_API_KEY`, `BINANCE_SECRET_KEY`, `LIGHTER_L1_ADDRESS`, `LIGHTER_API_PRIVATE_KEY`
80
+ - Returns: account info, open positions, unrealized PnL, leverage, margin, liquidation price
81
+
77
82
  ### AI
78
83
  - `POST /ai` body: `{"message": "<question>"}` — AI analyst ($0.01)
79
84
 
@@ -411,6 +411,7 @@ const GUIDE = {
411
411
  cmc_sentiment: "CMC per-coin sentiment — bullish/bearish crowd reading",
412
412
  highvolumelowcap: "High volume + small cap = early mover potential, higher risk",
413
413
  bounce_dip: "Auto-detected dip-buy or bounce zones — best aligned with ALSAT BUY",
414
+ Indicator_Today: "Today's triggered signals. alsat_signals = ALSAT BUY/SELL fired today. indicator_signals = TD9/AlphaTrend/etc fired today. Access via screener('indicator-today')",
414
415
  ath: "Coins near all-time highs — momentum continuation or blow-off top risk",
415
416
  late_unlocked_coins: "Far-future vesting tokens — no near-term selling pressure, safer hold",
416
417
  cmcai: "CMC AI insights — explains why market is up/down, narratives, institutional flow",
@@ -251,6 +251,15 @@ export const TOOLS = [
251
251
  required: [],
252
252
  },
253
253
  },
254
+ {
255
+ name: "positions",
256
+ description:
257
+ "Get your live open positions across connected exchanges (MEXC, Binance, Lighter). " +
258
+ "Shows entry price, mark price, unrealized PnL, leverage, margin, and liquidation price for each position. " +
259
+ "Requires exchange API keys to be configured — add them via /exchange_apis in the Asrai Telegram bot. " +
260
+ "Use when asked: 'show my positions', 'what am I trading', 'my open trades', 'my PnL', 'my exchange positions'.",
261
+ inputSchema: { type: "object", properties: {}, required: [] },
262
+ },
254
263
  {
255
264
  name: "indicator_guide",
256
265
  description:
package/src/tools.js CHANGED
@@ -102,3 +102,41 @@ export const {
102
102
  export async function ask_ai(question) {
103
103
  return JSON.stringify(await _post("/ai", { message: question }), null, 2);
104
104
  }
105
+
106
+ // ── positions — fetch live exchange positions from env-configured keys ─────────
107
+
108
+ export async function positions() {
109
+ const exchanges = [
110
+ {
111
+ name: "mexc",
112
+ api_key: process.env.MEXC_API_KEY,
113
+ secret_key: process.env.MEXC_SECRET_KEY,
114
+ },
115
+ {
116
+ name: "binance",
117
+ api_key: process.env.BINANCE_API_KEY,
118
+ secret_key: process.env.BINANCE_SECRET_KEY,
119
+ },
120
+ {
121
+ name: "lighter",
122
+ api_key: process.env.LIGHTER_L1_ADDRESS,
123
+ secret_key: process.env.LIGHTER_API_PRIVATE_KEY,
124
+ },
125
+ ].filter(e => e.api_key && e.secret_key);
126
+
127
+ if (exchanges.length === 0) {
128
+ return JSON.stringify({ error: "No exchange keys configured. Set MEXC_API_KEY/MEXC_SECRET_KEY, BINANCE_API_KEY/BINANCE_SECRET_KEY, or LIGHTER_L1_ADDRESS/LIGHTER_API_PRIVATE_KEY in your ~/.env" });
129
+ }
130
+
131
+ const results = {};
132
+ await Promise.allSettled(exchanges.map(async ({ name, api_key, secret_key }) => {
133
+ try {
134
+ const data = await _get(`/api/exchange/${encodeURIComponent(name)}/${encodeURIComponent(api_key)}/${encodeURIComponent(secret_key)}`);
135
+ results[name] = data;
136
+ } catch (err) {
137
+ results[name] = { error: err.message };
138
+ }
139
+ }));
140
+
141
+ return JSON.stringify(results, null, 2);
142
+ }