@grinta-mcp/server 0.2.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/dist/utils.js ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Shared utilities for Starknet Agent
3
+ */
4
+ /**
5
+ * Format a token amount from raw units to human-readable
6
+ */
7
+ export function formatAmount(raw, decimals) {
8
+ const str = raw.toString();
9
+ if (decimals === 0)
10
+ return str;
11
+ const padded = str.padStart(decimals + 1, "0");
12
+ const whole = padded.slice(0, -decimals);
13
+ const frac = padded.slice(-decimals).replace(/0+$/, "");
14
+ return frac ? `${whole}.${frac}` : whole;
15
+ }
16
+ /**
17
+ * Parse a human-readable amount to raw units
18
+ */
19
+ export function parseAmount(amount, decimals) {
20
+ const [whole, frac = ""] = amount.split(".");
21
+ const paddedFrac = frac.padEnd(decimals, "0").slice(0, decimals);
22
+ return BigInt(whole + paddedFrac);
23
+ }
24
+ /**
25
+ * Sleep for the specified milliseconds
26
+ */
27
+ export function sleep(ms) {
28
+ return new Promise((resolve) => setTimeout(resolve, ms));
29
+ }
30
+ /**
31
+ * Validate a Starknet address format
32
+ */
33
+ export function isValidAddress(address) {
34
+ return /^0x[0-9a-fA-F]{1,64}$/.test(address);
35
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@grinta-mcp/server",
3
+ "version": "0.2.0",
4
+ "description": "MCP server for Grinta CDP protocol on Starknet — open SAFEs, borrow GRIT, swap, monitor health",
5
+ "type": "module",
6
+ "main": "dist/mcp.js",
7
+ "bin": {
8
+ "grinta-mcp": "dist/mcp.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "start": "tsx src/index.ts",
15
+ "dev": "tsx watch src/index.ts",
16
+ "mcp": "tsx src/mcp.ts",
17
+ "build": "tsc",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "dependencies": {
21
+ "@modelcontextprotocol/sdk": "^1.27.1",
22
+ "dotenv": "^16.4.7",
23
+ "starknet": "^8.9.1",
24
+ "zod": "^3.23.0"
25
+ },
26
+ "devDependencies": {
27
+ "@avnu/avnu-sdk": "^4.0.1",
28
+ "@types/node": "^22.0.0",
29
+ "tsx": "^4.0.0",
30
+ "typescript": "^5.9.0"
31
+ },
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ }
35
+ }