asrai-mcp 0.5.6 → 0.5.7
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 +3 -3
- package/bin/asrai-mcp.js +2 -2
- package/package.json +1 -1
- package/src/sse-server.js +1 -1
- package/src/tools.js +3 -3
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Crypto market analysis MCP server for Claude Desktop — pay-per-use via x402 on
|
|
|
21
21
|
"command": "npx",
|
|
22
22
|
"args": ["-y", "asrai-mcp"],
|
|
23
23
|
"env": {
|
|
24
|
-
"
|
|
24
|
+
"ASRAI_PRIVATE_KEY": "0x<your_base_wallet_private_key>"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -31,7 +31,7 @@ Crypto market analysis MCP server for Claude Desktop — pay-per-use via x402 on
|
|
|
31
31
|
**Or** store your key in `~/.env` (loaded automatically — no `env` block needed in config):
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
|
|
34
|
+
ASRAI_PRIVATE_KEY=0x<your_base_wallet_private_key>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
```json
|
|
@@ -78,7 +78,7 @@ Default session cap: **$2.00 USDC**. To change:
|
|
|
78
78
|
|
|
79
79
|
```json
|
|
80
80
|
"env": {
|
|
81
|
-
"
|
|
81
|
+
"ASRAI_PRIVATE_KEY": "0x...",
|
|
82
82
|
"ASRAI_MAX_SPEND": "5.0"
|
|
83
83
|
}
|
|
84
84
|
```
|
package/bin/asrai-mcp.js
CHANGED
|
@@ -14,8 +14,8 @@ config({ path: join(homedir(), ".env") });
|
|
|
14
14
|
config();
|
|
15
15
|
|
|
16
16
|
// Warn if no key set — one message, once
|
|
17
|
-
if (!process.env.
|
|
18
|
-
process.stderr.write("[asrai-mcp] Warning:
|
|
17
|
+
if (!process.env.ASRAI_PRIVATE_KEY) {
|
|
18
|
+
process.stderr.write("[asrai-mcp] Warning: ASRAI_PRIVATE_KEY not set — x402 payments will fail.\n");
|
|
19
19
|
process.stderr.write("[asrai-mcp] Set it in your Claude Desktop config or ~/.env file.\n");
|
|
20
20
|
process.stderr.write("[asrai-mcp] See: https://github.com/abuzerasr/asrai-mcp\n");
|
|
21
21
|
}
|
package/package.json
CHANGED
package/src/sse-server.js
CHANGED
|
@@ -43,7 +43,7 @@ const streamableTransports = {};
|
|
|
43
43
|
// ── Key extraction helper ─────────────────────────────────────────────────────
|
|
44
44
|
|
|
45
45
|
function extractKey(req, res, endpoint) {
|
|
46
|
-
const key = (req.query.key ?? process.env.
|
|
46
|
+
const key = (req.query.key ?? process.env.ASRAI_PRIVATE_KEY ?? "").trim();
|
|
47
47
|
if (!key) {
|
|
48
48
|
res.status(401).send(`Missing wallet key. Connect with: ${endpoint}?key=0x<private_key>`);
|
|
49
49
|
return null;
|
package/src/tools.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Each call costs PRICE_PER_CALL USDC from the user's wallet on Base mainnet.
|
|
4
4
|
*
|
|
5
5
|
* Supports two modes:
|
|
6
|
-
* - stdio (Claude Desktop): reads
|
|
6
|
+
* - stdio (Claude Desktop): reads ASRAI_PRIVATE_KEY from env
|
|
7
7
|
* - SSE (Docker/n8n): key injected per-connection via AsyncLocalStorage
|
|
8
8
|
*
|
|
9
9
|
* Endpoints and tool handlers imported from tool-endpoints.js (synced from asrai-shared/).
|
|
@@ -44,8 +44,8 @@ function checkSpend(amount) {
|
|
|
44
44
|
|
|
45
45
|
function buildFetch() {
|
|
46
46
|
const store = connectionStorage.getStore();
|
|
47
|
-
const key = store?.key ?? process.env.
|
|
48
|
-
if (!key) throw new Error("
|
|
47
|
+
const key = store?.key ?? process.env.ASRAI_PRIVATE_KEY;
|
|
48
|
+
if (!key) throw new Error("ASRAI_PRIVATE_KEY environment variable is required");
|
|
49
49
|
|
|
50
50
|
const signer = privateKeyToAccount(key);
|
|
51
51
|
const client = new x402Client();
|