@arcisprotocol/mcp 0.1.1 → 0.1.2
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/dist/{chunk-742DILRU.js → chunk-6OFSQEDB.js} +13 -4
- package/dist/index.js +2 -4
- package/dist/remote.js +2 -4
- package/dist/server.js +1 -6
- package/package.json +1 -1
|
@@ -53,6 +53,15 @@ var fmtRate = (raw) => {
|
|
|
53
53
|
const n = Number(raw) / 1e18;
|
|
54
54
|
return n > 1e3 || n < 1e-4 ? "1.000000" : n.toFixed(6);
|
|
55
55
|
};
|
|
56
|
+
var writeRateLimit = /* @__PURE__ */ new Map();
|
|
57
|
+
var WRITE_COOLDOWN_MS = 6e4;
|
|
58
|
+
function checkRateLimit(key) {
|
|
59
|
+
const last = writeRateLimit.get(key) || 0;
|
|
60
|
+
const remaining = WRITE_COOLDOWN_MS - (Date.now() - last);
|
|
61
|
+
if (remaining > 0) return `Rate limited. Try again in ${Math.ceil(remaining / 1e3)}s.`;
|
|
62
|
+
writeRateLimit.set(key, Date.now());
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
56
65
|
var server = new MCPServer({
|
|
57
66
|
name: "arcis-protocol",
|
|
58
67
|
title: "Arcis Protocol",
|
|
@@ -264,6 +273,8 @@ server.tool(
|
|
|
264
273
|
},
|
|
265
274
|
async ({ amount, private_key }) => {
|
|
266
275
|
try {
|
|
276
|
+
const rateErr = checkRateLimit(private_key.slice(0, 10));
|
|
277
|
+
if (rateErr) return error(rateErr);
|
|
267
278
|
const amountRaw = BigInt(Math.floor(amount * 1e6));
|
|
268
279
|
const account = privateKeyToAccount(private_key);
|
|
269
280
|
const wallet = createWalletClient({ chain: baseSepolia, transport: http(), account });
|
|
@@ -319,6 +330,8 @@ server.tool(
|
|
|
319
330
|
},
|
|
320
331
|
async ({ shares, private_key, withdraw_all }) => {
|
|
321
332
|
try {
|
|
333
|
+
const rateErr = checkRateLimit(private_key.slice(0, 10));
|
|
334
|
+
if (rateErr) return error(rateErr);
|
|
322
335
|
const account = privateKeyToAccount(private_key);
|
|
323
336
|
const wallet = createWalletClient({ chain: baseSepolia, transport: http(), account });
|
|
324
337
|
let sharesRaw;
|
|
@@ -389,7 +402,3 @@ Three functions. Any agent framework.
|
|
|
389
402
|
- X: https://x.com/ArcisProtocol
|
|
390
403
|
`)
|
|
391
404
|
);
|
|
392
|
-
|
|
393
|
-
export {
|
|
394
|
-
server
|
|
395
|
-
};
|
package/dist/index.js
CHANGED
package/dist/remote.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
server
|
|
3
|
-
} from "./chunk-742DILRU.js";
|
|
1
|
+
import "./chunk-6OFSQEDB.js";
|
|
4
2
|
|
|
5
3
|
// src/remote.ts
|
|
6
4
|
var PORT = parseInt(process.env.PORT || "3001");
|
|
7
|
-
|
|
5
|
+
(void 0).listen(PORT);
|
|
8
6
|
console.log(`Arcis MCP Server listening on http://localhost:${PORT}/mcp`);
|
package/dist/server.js
CHANGED