asrai-mcp 0.5.8 → 0.7.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/bin/asrai.js +70 -0
- package/bin/install-skill.js +78 -0
- package/package.json +5 -2
- package/skill/SKILL.md +88 -0
- package/skill/references/endpoints.md +82 -0
- package/src/server.js +1 -1
- package/src/tools.js +7 -7
package/bin/asrai.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* asrai CLI — call any Asrai tool from bash.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* npx -y -p asrai-mcp asrai <tool> [args...]
|
|
7
|
+
*
|
|
8
|
+
* Examples:
|
|
9
|
+
* npx -y -p asrai-mcp asrai ask_ai "What is the BTC outlook?"
|
|
10
|
+
* npx -y -p asrai-mcp asrai technical_analysis BTC 4h
|
|
11
|
+
* npx -y -p asrai-mcp asrai sentiment
|
|
12
|
+
* npx -y -p asrai-mcp asrai forecast ETH
|
|
13
|
+
* npx -y -p asrai-mcp asrai market_overview
|
|
14
|
+
* npx -y -p asrai-mcp asrai coin_info SOL
|
|
15
|
+
* npx -y -p asrai-mcp asrai screener ath
|
|
16
|
+
* npx -y -p asrai-mcp asrai smart_money BTC 1d
|
|
17
|
+
* npx -y -p asrai-mcp asrai elliott_wave BTC 4h
|
|
18
|
+
* npx -y -p asrai-mcp asrai cashflow market
|
|
19
|
+
* npx -y -p asrai-mcp asrai portfolio
|
|
20
|
+
* npx -y -p asrai-mcp asrai channel_summary
|
|
21
|
+
* npx -y -p asrai-mcp asrai indicator_guide ALSAT
|
|
22
|
+
*
|
|
23
|
+
* Requires ASRAI_PRIVATE_KEY in ~/.env or environment.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { config } from 'dotenv';
|
|
27
|
+
import { homedir } from 'os';
|
|
28
|
+
import { join } from 'path';
|
|
29
|
+
|
|
30
|
+
config({ path: join(homedir(), '.env') });
|
|
31
|
+
config();
|
|
32
|
+
|
|
33
|
+
const key = process.env.ASRAI_PRIVATE_KEY?.trim();
|
|
34
|
+
|
|
35
|
+
const [,, tool, ...args] = process.argv;
|
|
36
|
+
|
|
37
|
+
if (!tool) {
|
|
38
|
+
console.error('Usage: asrai <tool> [args...]');
|
|
39
|
+
console.error('Tools: ask_ai, technical_analysis, sentiment, forecast, market_overview,');
|
|
40
|
+
console.error(' coin_info, screener, smart_money, elliott_wave, ichimoku, cashflow,');
|
|
41
|
+
console.error(' dexscreener, chain_tokens, portfolio, channel_summary, indicator_guide');
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// indicator_guide is free — no key needed
|
|
46
|
+
if (tool !== 'indicator_guide' && !key) {
|
|
47
|
+
console.error('Error: ASRAI_PRIVATE_KEY is not set. Add it to ~/.env');
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
import * as tools from '../src/tools.js';
|
|
52
|
+
import { indicator_guide } from '../src/indicator_guide.js';
|
|
53
|
+
|
|
54
|
+
const allTools = { ...tools, indicator_guide };
|
|
55
|
+
const fn = allTools[tool];
|
|
56
|
+
if (!fn) {
|
|
57
|
+
console.error(`Unknown tool: ${tool}`);
|
|
58
|
+
console.error('Run "asrai" with no arguments to see available tools.');
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let result;
|
|
63
|
+
try {
|
|
64
|
+
result = await fn(...args);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
console.error(`Error: ${err.message}`);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log(typeof result === 'string' ? result : JSON.stringify(result, null, 2));
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* asrai-mcp install-skill
|
|
4
|
+
*
|
|
5
|
+
* Auto-installs SKILL.md to detected agent directories.
|
|
6
|
+
* Supports: OpenClaw, Cursor/Cline/.agents/skills, manual fallback.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* npx -y -p asrai-mcp install-skill
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { existsSync, mkdirSync, copyFileSync } from 'fs';
|
|
13
|
+
import { join, dirname } from 'path';
|
|
14
|
+
import { homedir } from 'os';
|
|
15
|
+
import { fileURLToPath } from 'url';
|
|
16
|
+
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
const home = homedir();
|
|
19
|
+
|
|
20
|
+
// Files bundled inside this package
|
|
21
|
+
const SKILL_SRC = join(__dirname, '..', 'skill', 'SKILL.md');
|
|
22
|
+
const ENDPOINTS_SRC = join(__dirname, '..', 'skill', 'references', 'endpoints.md');
|
|
23
|
+
|
|
24
|
+
// Candidate install paths
|
|
25
|
+
const candidates = [
|
|
26
|
+
{
|
|
27
|
+
name: 'OpenClaw',
|
|
28
|
+
path: join(home, '.openclaw', 'workspace', 'skills', 'asrai'),
|
|
29
|
+
detect: join(home, '.openclaw', 'workspace', 'skills'),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'OpenClaw (alt)',
|
|
33
|
+
path: join(home, '.openclaw', 'skills', 'asrai'),
|
|
34
|
+
detect: join(home, '.openclaw', 'skills'),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'agents/skills (local)',
|
|
38
|
+
path: join(process.cwd(), '.agents', 'skills', 'asrai'),
|
|
39
|
+
detect: join(process.cwd(), '.agents', 'skills'),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'agents/skills (home)',
|
|
43
|
+
path: join(home, '.agents', 'skills', 'asrai'),
|
|
44
|
+
detect: join(home, '.agents', 'skills'),
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
function installTo(destDir, label) {
|
|
49
|
+
mkdirSync(join(destDir, 'references'), { recursive: true });
|
|
50
|
+
copyFileSync(SKILL_SRC, join(destDir, 'SKILL.md'));
|
|
51
|
+
copyFileSync(ENDPOINTS_SRC, join(destDir, 'references', 'endpoints.md'));
|
|
52
|
+
console.log(`✓ Installed to ${label}: ${destDir}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let installed = 0;
|
|
56
|
+
|
|
57
|
+
for (const c of candidates) {
|
|
58
|
+
if (existsSync(c.detect)) {
|
|
59
|
+
installTo(c.path, c.name);
|
|
60
|
+
installed++;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (installed === 0) {
|
|
65
|
+
console.log('No agent skills directory detected automatically.\n');
|
|
66
|
+
console.log('Manual install options:');
|
|
67
|
+
console.log(' OpenClaw:');
|
|
68
|
+
console.log(` mkdir -p ~/.openclaw/workspace/skills/asrai/references`);
|
|
69
|
+
console.log(` cp ${SKILL_SRC} ~/.openclaw/workspace/skills/asrai/SKILL.md`);
|
|
70
|
+
console.log(` cp ${ENDPOINTS_SRC} ~/.openclaw/workspace/skills/asrai/references/endpoints.md`);
|
|
71
|
+
console.log('');
|
|
72
|
+
console.log(' Or clone the skill repo directly:');
|
|
73
|
+
console.log(' git clone https://github.com/abuzerasr/asrai-skill.git ~/.openclaw/workspace/skills/asrai');
|
|
74
|
+
} else {
|
|
75
|
+
console.log('\nDone. Restart your agent or run "refresh skills" to activate asrai.');
|
|
76
|
+
console.log('\nNext: set ASRAI_PRIVATE_KEY in ~/.env');
|
|
77
|
+
console.log(' echo "ASRAI_PRIVATE_KEY=0x<your_key>" >> ~/.env');
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asrai-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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",
|
|
@@ -19,11 +19,14 @@
|
|
|
19
19
|
"type": "module",
|
|
20
20
|
"bin": {
|
|
21
21
|
"asrai-mcp": "./bin/asrai-mcp.js",
|
|
22
|
-
"asrai-mcp-server": "./bin/asrai-mcp-server.js"
|
|
22
|
+
"asrai-mcp-server": "./bin/asrai-mcp-server.js",
|
|
23
|
+
"asrai": "./bin/asrai.js",
|
|
24
|
+
"install-skill": "./bin/install-skill.js"
|
|
23
25
|
},
|
|
24
26
|
"files": [
|
|
25
27
|
"bin/",
|
|
26
28
|
"src/",
|
|
29
|
+
"skill/",
|
|
27
30
|
"README.md"
|
|
28
31
|
],
|
|
29
32
|
"engines": {
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asrai-x402
|
|
3
|
+
description: Crypto market analysis using Asrai API. Covers technical analysis, screeners, sentiment, forecasting, smart money, Elliott Wave, cashflow, DEX data, and AI-powered insights. Each API call costs $0.005 USDC from your own wallet on Base mainnet via x402.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata: {"openclaw":{"emoji":"📈","requires":{"env":["ASRAI_PRIVATE_KEY"]}},"clawdbot":{"emoji":"📈","requires":{"env":["ASRAI_PRIVATE_KEY"]}}}
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Asrai — Crypto Analysis via x402
|
|
9
|
+
|
|
10
|
+
Use Asrai tools when the user asks about crypto prices, market analysis, trading signals, sentiment, or investment advice.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
- Crypto price / chart / technical analysis → use asrai tools
|
|
15
|
+
- Market sentiment, CBBI, fear/greed → use asrai tools
|
|
16
|
+
- "What should I buy?" / portfolio advice → use `portfolio` tool
|
|
17
|
+
- Elliott Wave, smart money, order blocks → use asrai tools
|
|
18
|
+
- DEX data, low-cap tokens → use asrai tools
|
|
19
|
+
- General knowledge you already know well → answer directly (costs $0.005 per call)
|
|
20
|
+
|
|
21
|
+
## How to call
|
|
22
|
+
|
|
23
|
+
### If asrai MCP tools are available (Cursor, Cline, Claude Desktop)
|
|
24
|
+
|
|
25
|
+
Call the appropriate MCP tool directly:
|
|
26
|
+
```
|
|
27
|
+
technical_analysis(symbol, timeframe)
|
|
28
|
+
sentiment()
|
|
29
|
+
forecast(symbol)
|
|
30
|
+
market_overview()
|
|
31
|
+
ask_ai(question)
|
|
32
|
+
...
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### If no MCP tool — use bash (OpenClaw and other agents)
|
|
36
|
+
|
|
37
|
+
Use the same tool names via bash:
|
|
38
|
+
```bash
|
|
39
|
+
npx -y -p asrai-mcp asrai <tool> [args...]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
```bash
|
|
44
|
+
npx -y -p asrai-mcp asrai ask_ai "What is the outlook for BTC today?"
|
|
45
|
+
npx -y -p asrai-mcp asrai technical_analysis BTC 4h
|
|
46
|
+
npx -y -p asrai-mcp asrai sentiment
|
|
47
|
+
npx -y -p asrai-mcp asrai forecast ETH
|
|
48
|
+
npx -y -p asrai-mcp asrai market_overview
|
|
49
|
+
npx -y -p asrai-mcp asrai coin_info SOL
|
|
50
|
+
npx -y -p asrai-mcp asrai portfolio
|
|
51
|
+
npx -y -p asrai-mcp asrai indicator_guide ALSAT
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Requires `ASRAI_PRIVATE_KEY` set in `~/.env` or environment. Payment is signed automatically.
|
|
55
|
+
|
|
56
|
+
## MCP tools
|
|
57
|
+
|
|
58
|
+
| Tool | What it does | Cost |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| `market_overview` | Trending, gainers/losers, RSI, sentiment, screeners | $0.095 |
|
|
61
|
+
| `technical_analysis(symbol, timeframe)` | Signals, ALSAT, SuperALSAT, Elliott Wave, Ichimoku | $0.06 |
|
|
62
|
+
| `sentiment` | CBBI, CMC sentiment, AI insights | $0.015 |
|
|
63
|
+
| `forecast(symbol)` | AI price forecast | $0.005 |
|
|
64
|
+
| `screener(type)` | Find coins by criteria | $0.005 |
|
|
65
|
+
| `smart_money(symbol, timeframe)` | Order blocks, FVGs, support/resistance | $0.01 |
|
|
66
|
+
| `elliott_wave(symbol, timeframe)` | Elliott Wave analysis | $0.005 |
|
|
67
|
+
| `ichimoku(symbol, timeframe)` | Ichimoku cloud | $0.005 |
|
|
68
|
+
| `cashflow(mode, symbol)` | Capital flow | $0.005 |
|
|
69
|
+
| `coin_info(symbol)` | Stats, price, CMC AI, DEX data | $0.025–$0.03 |
|
|
70
|
+
| `dexscreener(contract)` | DEX data | $0.005 |
|
|
71
|
+
| `chain_tokens(chain, max_mcap)` | Low-cap tokens on chain | $0.005 |
|
|
72
|
+
| `portfolio` | Abu's curated model portfolio | $0.005 |
|
|
73
|
+
| `channel_summary` | Latest narratives | $0.005 |
|
|
74
|
+
| `ask_ai(question)` | AI analyst answer | $0.01 |
|
|
75
|
+
| `indicator_guide(name)` | Guide for custom indicators | FREE |
|
|
76
|
+
|
|
77
|
+
## Output rules
|
|
78
|
+
|
|
79
|
+
- Write like an experienced trader explaining to a friend — conversational, confident, direct
|
|
80
|
+
- Think like both a trader AND a long-term investor. Default to investor mode. Switch to trader mode only when user asks for entries
|
|
81
|
+
- Keep responses 200–400 words. Short lines, breathing room between sections
|
|
82
|
+
- Never list raw indicator values — synthesize into plain language verdict
|
|
83
|
+
- End with 1 clear action bias: accumulate / wait / avoid — and why
|
|
84
|
+
- Never mention tool names, API calls, or payment details in responses
|
|
85
|
+
|
|
86
|
+
## Cost
|
|
87
|
+
|
|
88
|
+
$0.005 USDC per call (most tools), $0.01 for `ask_ai`, FREE for `indicator_guide`. Signed from the user's own wallet on Base mainnet. Tell the user if they ask.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Asrai x402 Endpoints
|
|
2
|
+
|
|
3
|
+
## Base URL
|
|
4
|
+
`https://x402.asrai.me`
|
|
5
|
+
|
|
6
|
+
## Payment
|
|
7
|
+
x402 automatic — $0.005 USDC per endpoint on Base mainnet ($0.01 for `/ai`)
|
|
8
|
+
|
|
9
|
+
## Endpoint Catalog
|
|
10
|
+
|
|
11
|
+
### Market Pulse
|
|
12
|
+
- `GET /api/trending/` — trending coins
|
|
13
|
+
- `GET /api/gainers-losers/` — top gainers and losers
|
|
14
|
+
- `GET /api/rsi/` — RSI extremes (overbought/oversold)
|
|
15
|
+
- `GET /api/top-bottom/` — top/bottom signals
|
|
16
|
+
- `GET /api/ath/` — coins near all-time high
|
|
17
|
+
- `GET /api/channel-summary/` — latest narratives from monitored channels
|
|
18
|
+
|
|
19
|
+
### Sentiment
|
|
20
|
+
- `GET /api/cbbi/` — Bitcoin cycle index
|
|
21
|
+
- `GET /api/cmc-sentiment/` — CMC market sentiment
|
|
22
|
+
- `GET /api/cmcai/` — CMC AI insights
|
|
23
|
+
- `GET /api/cmcai/<symbol>` — CMC AI for specific coin
|
|
24
|
+
|
|
25
|
+
### Technical Signals (single coin)
|
|
26
|
+
- `GET /api/signal/<symbol>usdt/1D|4H|1W` — buy/sell signal
|
|
27
|
+
- `GET /api/alsat/<symbol>usdt/1D|4H|1W` — ALSAT indicator
|
|
28
|
+
- `GET /api/superalsat/<symbol>usdt` — SuperALSAT
|
|
29
|
+
- `GET /api/alphatrend/<symbol>usdt/1D|4H|1W` — AlphaTrend
|
|
30
|
+
- `GET /api/psar/<symbol>usdt/1D|4H|1W` — Parabolic SAR
|
|
31
|
+
- `GET /api/macd-dema/<symbol>usdt/1D|4H|1W` — MACD + DEMA
|
|
32
|
+
- `GET /api/td/<symbol>usdt/1D|4H|1W` — Tom DeMark sequential
|
|
33
|
+
- `GET /api/ichimoku/<symbol>usdt/1D|4H|1W` — Ichimoku cloud
|
|
34
|
+
- `GET /api/ew/<symbol>usdt/1D|4H|1W` — Elliott Wave
|
|
35
|
+
- `GET /api/smartmoney/<symbol>usdt/1D|4H|1W` — SMC (order blocks, FVG, BOS)
|
|
36
|
+
- `GET /api/support-resistance/<symbol>usdt/1D|4H|1W` — support/resistance levels
|
|
37
|
+
- `GET /api/forecasting/<symbol>usdt` — AI price forecast
|
|
38
|
+
|
|
39
|
+
### Screeners
|
|
40
|
+
- `GET /api/ichimoku-trend/`
|
|
41
|
+
- `GET /api/sar-coins/`
|
|
42
|
+
- `GET /api/macd-coins/`
|
|
43
|
+
- `GET /api/emacross/`
|
|
44
|
+
- `GET /api/techrating/`
|
|
45
|
+
- `GET /api/vwap/`
|
|
46
|
+
- `GET /api/volume/`
|
|
47
|
+
- `GET /api/highvolumelowcap/`
|
|
48
|
+
- `GET /api/bounce-dip/`
|
|
49
|
+
- `GET /api/galaxyscore/`
|
|
50
|
+
- `GET /api/socialdominance/`
|
|
51
|
+
- `GET /api/late-unlocked-coins/`
|
|
52
|
+
- `GET /api/rsi/` — RSI heatmap
|
|
53
|
+
- `GET /api/ao/` — Awesome Oscillator screener
|
|
54
|
+
|
|
55
|
+
### Coin Info
|
|
56
|
+
- `GET /api/coinstats/<symbol>` — market cap, volume, supply
|
|
57
|
+
- `GET /api/info/<symbol>` — project info
|
|
58
|
+
- `GET /api/price/<symbol>` — current price
|
|
59
|
+
- `GET /api/tags/<symbol>` — coin tags/categories
|
|
60
|
+
|
|
61
|
+
### Cashflow
|
|
62
|
+
- `GET /api/cashflow/market` — market-wide capital flow
|
|
63
|
+
- `GET /api/cashflow/coin/<symbol>` — flow for one coin
|
|
64
|
+
- `GET /api/cashflow/group/<symbols_csv>` — flow for group of coins
|
|
65
|
+
|
|
66
|
+
### Chain / DEX
|
|
67
|
+
- `GET /api/dexscreener/<contract_address>` — DEX data by contract
|
|
68
|
+
- `GET /api/dexscreener/<chain>/<contract_address>` — DEX data by chain + contract
|
|
69
|
+
- `GET /api/chain/<chain>/<max_mcap>` — low-cap tokens on a chain
|
|
70
|
+
|
|
71
|
+
### Portfolio
|
|
72
|
+
- `GET /api/portfolio/` — full portfolio
|
|
73
|
+
- `GET /api/portfolio/<symbol>` — portfolio for specific coin
|
|
74
|
+
|
|
75
|
+
### AI
|
|
76
|
+
- `POST /ai` body: `{"message": "<question>"}` — AI analyst ($0.01)
|
|
77
|
+
|
|
78
|
+
## Macro signals
|
|
79
|
+
- `GET /api/signal/btc.d/1D` — BTC dominance
|
|
80
|
+
- `GET /api/signal/others.d/1D` — altcoin dominance
|
|
81
|
+
- `GET /api/signal/spx/1D` — S&P 500
|
|
82
|
+
- `GET /api/signal/ndq/1D` — Nasdaq
|
package/src/server.js
CHANGED
|
@@ -71,7 +71,7 @@ async function handleTool(name, args) {
|
|
|
71
71
|
export function createServer() {
|
|
72
72
|
const server = new Server(
|
|
73
73
|
{ name: "asrai", version: "0.5.5" },
|
|
74
|
-
{ capabilities: { tools: {} }
|
|
74
|
+
{ capabilities: { tools: {} } }
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
package/src/tools.js
CHANGED
|
@@ -78,13 +78,13 @@ async function _post(path, body) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
async function _gather(...paths) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return
|
|
81
|
+
const entries = await Promise.all(
|
|
82
|
+
paths.map(async (path) => {
|
|
83
|
+
try { return [path, await _get(path)]; }
|
|
84
|
+
catch (e) { return [path, String(e)]; }
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
return Object.fromEntries(entries);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// ── Shared handlers (from tool-endpoints.js) ──────────────────────────────────
|