asrai-mcp 0.4.5 → 0.5.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
@@ -1,22 +1,12 @@
1
1
  # asrai-mcp
2
2
 
3
- Crypto market analysis tools for AI agents, powered by the Asrai API.
4
- Pay-per-use via [x402](https://x402.org) — no subscriptions, no API keys.
3
+ Crypto market analysis MCP server for Claude Desktop pay-per-use via x402 on Base mainnet.
5
4
 
6
- > **Note:** This is the npx launcher for the [asrai-mcp Python package](https://pypi.org/project/asrai-mcp/).
7
- > It requires [uv](https://docs.astral.sh/uv/) to be installed on your system.
5
+ **Zero install.** Just Node.js (already on your machine via npx).
8
6
 
9
- ## Quick Start
7
+ ## Quick start
10
8
 
11
- ```bash
12
- # Install uv (one time)
13
- curl -LsSf https://astral.sh/uv/install.sh | sh
14
-
15
- # Run via npx
16
- npx -y asrai-mcp
17
- ```
18
-
19
- ## Claude Desktop Config
9
+ **Step 1** — Add to Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
20
10
 
21
11
  ```json
22
12
  {
@@ -24,21 +14,63 @@ npx -y asrai-mcp
24
14
  "asrai": {
25
15
  "command": "npx",
26
16
  "args": ["-y", "asrai-mcp"],
27
- "env": { "PRIVATE_KEY": "0x<YOUR_PRIVATE_KEY>" }
17
+ "env": {
18
+ "PRIVATE_KEY": "0x<your_base_wallet_private_key>"
19
+ }
28
20
  }
29
21
  }
30
22
  }
31
23
  ```
32
24
 
33
- You need an Ethereum wallet funded with USDC on Base mainnet.
34
- Each request costs **$0.001 USDC**.
25
+ **Step 2** Restart Claude Desktop. Done.
26
+
27
+ Each API call costs **$0.001 USDC** from your wallet on Base mainnet. Make sure your wallet has a small USDC balance (~$1–2 to start).
28
+
29
+ ## What you get
30
+
31
+ 15+ crypto analysis tools available directly in Claude:
32
+
33
+ | Tool | What it does | Cost |
34
+ |---|---|---|
35
+ | `market_overview` | Trending, gainers/losers, RSI extremes | $0.004 |
36
+ | `technical_analysis` | ALSAT, SuperALSAT, PSAR, MACD-DEMA, AlphaTrend | $0.007 |
37
+ | `sentiment` | CBBI, CMC sentiment, AI insights | $0.003 |
38
+ | `forecast` | AI 3-7 day price prediction | $0.001 |
39
+ | `screener` | Find coins by criteria | $0.001 |
40
+ | `smart_money` | Order blocks, FVGs, support/resistance | $0.002 |
41
+ | `elliott_wave` | Elliott Wave analysis | $0.001 |
42
+ | `ichimoku` | Ichimoku cloud | $0.001 |
43
+ | `cashflow` | Capital flow data | $0.001 |
44
+ | `coin_info` | Stats, info, price, tags | $0.004 |
45
+ | `dexscreener` | DEX trading data | $0.001 |
46
+ | `chain_tokens` | Low-cap tokens on chain | $0.001 |
47
+ | `portfolio` | Portfolio analysis | $0.001 |
48
+ | `channel_summary` | Latest crypto narratives | $0.001 |
49
+ | `ask_ai` | AI analyst freeform answer | $0.002 |
50
+ | `indicator_guide` | Asrai indicator reference | FREE |
51
+
52
+ ## Spend limit
35
53
 
36
- ## Full Documentation
54
+ Default session cap: **$2.00 USDC**. To change:
37
55
 
38
- See the main package: [github.com/abuzerasr/asrai-mcp](https://github.com/abuzerasr/asrai-mcp)
56
+ ```json
57
+ "env": {
58
+ "PRIVATE_KEY": "0x...",
59
+ "ASRAI_MAX_SPEND": "5.0"
60
+ }
61
+ ```
62
+
63
+ ## Alternative install (if you prefer)
64
+
65
+ ```bash
66
+ # via uvx (requires uv)
67
+ uvx asrai-mcp
68
+
69
+ # via pip
70
+ pip install asrai-mcp
71
+ ```
39
72
 
40
73
  ## Links
41
74
 
42
- - Website: [asrai.me](https://asrai.me)
43
- - Agents page: [asrai.me/agents](https://asrai.me/agents)
44
- - PyPI: [pypi.org/project/asrai-mcp](https://pypi.org/project/asrai-mcp/)
75
+ - Homepage: https://asrai.me/agents
76
+ - GitHub: https://github.com/abuzerasr/asrai-mcp
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Asrai MCP SSE Server — Docker / n8n mode.
4
+ * Usage: npx asrai-mcp-server
5
+ * or via Docker (see docker-compose.yml)
6
+ */
7
+
8
+ import { config } from "dotenv";
9
+ import { homedir } from "os";
10
+ import { join } from "path";
11
+ import { startSseServer } from "../src/sse-server.js";
12
+
13
+ config({ path: join(homedir(), ".env") });
14
+ config();
15
+
16
+ startSseServer();
package/bin/asrai-mcp.js CHANGED
@@ -1,115 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * asrai-mcp npm wrapper
4
- * Launches the Python asrai-mcp package via uvx (preferred) or pip-installed command.
5
- *
6
- * Usage via npx:
7
- * npx -y asrai-mcp
8
- *
9
- * Usage in Claude Desktop config:
10
- * { "command": "npx", "args": ["-y", "asrai-mcp"] }
3
+ * Asrai MCP server — pure Node.js, zero install required.
4
+ * Usage: npx -y asrai-mcp
11
5
  */
12
6
 
13
- const { spawnSync } = require('child_process');
14
- const os = require('os');
7
+ import { config } from "dotenv";
8
+ import { homedir } from "os";
9
+ import { join } from "path";
10
+ import { startStdio } from "../src/server.js";
15
11
 
16
- const args = process.argv.slice(2);
17
- const isWindows = os.platform() === 'win32';
12
+ // Load ~/.env first, then cwd .env as fallback
13
+ config({ path: join(homedir(), ".env") });
14
+ config();
18
15
 
19
- // All messages go to stderrstdout must stay clean for MCP JSON-RPC protocol
20
- function log(msg) {
21
- process.stderr.write(msg + '\n');
16
+ // Warn if no key setone message, once
17
+ if (!process.env.PRIVATE_KEY) {
18
+ process.stderr.write("[asrai-mcp] Warning: PRIVATE_KEY not set — x402 payments will fail.\n");
19
+ process.stderr.write("[asrai-mcp] Set it in your Claude Desktop config or ~/.env file.\n");
20
+ process.stderr.write("[asrai-mcp] See: https://github.com/abuzerasr/asrai-mcp\n");
22
21
  }
23
22
 
24
- function checkCommand(cmd) {
25
- const check = spawnSync(
26
- isWindows ? 'where' : 'which',
27
- [cmd],
28
- { stdio: 'ignore' }
29
- );
30
- return check.status === 0;
31
- }
32
-
33
- // ─── Check what's available ───────────────────────────────────────────────────
34
-
35
- const hasUvx = checkCommand('uvx');
36
- const hasUv = checkCommand('uv');
37
- const hasPip = checkCommand('asrai-mcp');
38
-
39
- // ─── Nothing available ────────────────────────────────────────────────────────
40
-
41
- if (!hasUvx && !hasUv && !hasPip) {
42
- log('');
43
- log('asrai-mcp: Python is required but not found.');
44
- log('');
45
- log('Quick fix — install uv (Python package manager):');
46
- if (isWindows) {
47
- log(' powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"');
48
- } else {
49
- log(' curl -LsSf https://astral.sh/uv/install.sh | sh');
50
- }
51
- log(' Then re-run: npx -y asrai-mcp');
52
- log('');
53
- log('Alternative — install via pip:');
54
- log(' pip install asrai-mcp');
55
- log('');
23
+ startStdio().catch((err) => {
24
+ process.stderr.write(`[asrai-mcp] Fatal: ${err.message}\n`);
56
25
  process.exit(1);
57
- }
58
-
59
- // ─── Warn if no PRIVATE_KEY set (stdio mode only) ─────────────────────────────
60
-
61
- if (!process.env.PRIVATE_KEY && args.length === 0) {
62
- log('[asrai-mcp] Warning: PRIVATE_KEY env var not set — x402 payments will fail.');
63
- log('[asrai-mcp] Set it in your Claude Desktop config or .env file.');
64
- log('[asrai-mcp] See: https://github.com/asrai-ai/asrai-mcp');
65
- log('');
66
- }
67
-
68
- // ─── Try uvx ──────────────────────────────────────────────────────────────────
69
-
70
- if (hasUvx || hasUv) {
71
- log('[asrai-mcp] Starting via uvx (downloads latest version if needed)...');
72
-
73
- const result = spawnSync('uvx', ['asrai-mcp', ...args], {
74
- stdio: ['inherit', 'inherit', 'inherit'],
75
- env: process.env,
76
- });
77
-
78
- if (result.error) {
79
- log('[asrai-mcp] uvx failed: ' + result.error.message);
80
- } else if (result.status === 0) {
81
- process.exit(0);
82
- } else {
83
- log('[asrai-mcp] uvx exited with code ' + result.status);
84
- }
85
-
86
- // If uvx failed but pip-installed version exists, fall through
87
- if (!hasPip) {
88
- log('');
89
- log('[asrai-mcp] Failed to start. Try:');
90
- log(' pip install asrai-mcp # install manually');
91
- log(' PRIVATE_KEY=0x... # set your wallet key');
92
- log('');
93
- process.exit(result.status ?? 1);
94
- }
95
- }
96
-
97
- // ─── Fall back to pip-installed asrai-mcp ────────────────────────────────────
98
-
99
- if (hasPip) {
100
- log('[asrai-mcp] Starting (pip-installed)...');
101
-
102
- const result = spawnSync('asrai-mcp', args, {
103
- stdio: ['inherit', 'inherit', 'inherit'],
104
- env: process.env,
105
- });
106
-
107
- if (result.error) {
108
- log('[asrai-mcp] Error: ' + result.error.message);
109
- process.exit(1);
110
- }
111
-
112
- process.exit(result.status ?? 1);
113
- }
114
-
115
- process.exit(1);
26
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "asrai-mcp",
3
- "version": "0.4.5",
4
- "description": "Asrai crypto analysis MCP server — pay-per-use via x402 on Base (npx wrapper for Python package)",
3
+ "version": "0.5.0",
4
+ "description": "Asrai crypto analysis MCP server — pay-per-use via x402 on Base. Zero install: just npx.",
5
5
  "keywords": ["mcp", "crypto", "asrai", "x402", "trading", "signals"],
6
6
  "homepage": "https://asrai.me/agents",
7
7
  "repository": {
@@ -9,14 +9,25 @@
9
9
  "url": "https://github.com/abuzerasr/asrai-mcp"
10
10
  },
11
11
  "license": "MIT",
12
+ "type": "module",
12
13
  "bin": {
13
- "asrai-mcp": "./bin/asrai-mcp.js"
14
+ "asrai-mcp": "./bin/asrai-mcp.js",
15
+ "asrai-mcp-server": "./bin/asrai-mcp-server.js"
14
16
  },
15
17
  "files": [
16
18
  "bin/",
19
+ "src/",
17
20
  "README.md"
18
21
  ],
19
22
  "engines": {
20
23
  "node": ">=18"
24
+ },
25
+ "dependencies": {
26
+ "@modelcontextprotocol/sdk": "^1.27.1",
27
+ "@x402/fetch": "^2.5.0",
28
+ "@x402/evm": "^2.5.0",
29
+ "viem": "^2.46.3",
30
+ "dotenv": "^16.0.0",
31
+ "express": "^4.21.0"
21
32
  }
22
33
  }