asrai-mcp 0.4.5

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 +44 -0
  2. package/bin/asrai-mcp.js +115 -0
  3. package/package.json +22 -0
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # asrai-mcp
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.
5
+
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.
8
+
9
+ ## Quick Start
10
+
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
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "asrai": {
25
+ "command": "npx",
26
+ "args": ["-y", "asrai-mcp"],
27
+ "env": { "PRIVATE_KEY": "0x<YOUR_PRIVATE_KEY>" }
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ You need an Ethereum wallet funded with USDC on Base mainnet.
34
+ Each request costs **$0.001 USDC**.
35
+
36
+ ## Full Documentation
37
+
38
+ See the main package: [github.com/abuzerasr/asrai-mcp](https://github.com/abuzerasr/asrai-mcp)
39
+
40
+ ## Links
41
+
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/)
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
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"] }
11
+ */
12
+
13
+ const { spawnSync } = require('child_process');
14
+ const os = require('os');
15
+
16
+ const args = process.argv.slice(2);
17
+ const isWindows = os.platform() === 'win32';
18
+
19
+ // All messages go to stderr — stdout must stay clean for MCP JSON-RPC protocol
20
+ function log(msg) {
21
+ process.stderr.write(msg + '\n');
22
+ }
23
+
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('');
56
+ 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);
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
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)",
5
+ "keywords": ["mcp", "crypto", "asrai", "x402", "trading", "signals"],
6
+ "homepage": "https://asrai.me/agents",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/abuzerasr/asrai-mcp"
10
+ },
11
+ "license": "MIT",
12
+ "bin": {
13
+ "asrai-mcp": "./bin/asrai-mcp.js"
14
+ },
15
+ "files": [
16
+ "bin/",
17
+ "README.md"
18
+ ],
19
+ "engines": {
20
+ "node": ">=18"
21
+ }
22
+ }