@hoodag/mcp 0.1.0 → 0.1.1

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 (2) hide show
  1. package/index.js +4 -2
  2. package/package.json +3 -1
package/index.js CHANGED
@@ -11,6 +11,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
11
11
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
12
12
  import { z } from 'zod';
13
13
  import { createPublicClient, http, keccak256, toBytes, isAddress } from 'viem';
14
+ import { ens_normalize } from '@adraffy/ens-normalize';
14
15
 
15
16
  const RPC_URL = process.env.HOOD_RPC_URL || 'https://rpc.mainnet.chain.robinhood.com';
16
17
  const YEAR = 365n * 24n * 60n * 60n;
@@ -39,8 +40,9 @@ const registrarAbi = [
39
40
  const client = createPublicClient({ transport: http(RPC_URL) });
40
41
 
41
42
  const ZERO = '0x0000000000000000000000000000000000000000';
42
- const label = (name) => name.toLowerCase().replace(/\.hood$/, '');
43
- const fqdn = (name) => (name.toLowerCase().endsWith('.hood') ? name.toLowerCase() : `${label(name)}.hood`);
43
+ // ENSIP-15 normalize so "ROBIN"/emoji resolve to the canonical label the contract stores.
44
+ const label = (name) => { const s = String(name).trim().replace(/\.hood$/i, ''); try { return ens_normalize(s); } catch { return s.toLowerCase(); } };
45
+ const fqdn = (name) => `${label(name)}.hood`;
44
46
  const tokenId = (name) => BigInt(keccak256(toBytes(label(name))));
45
47
  const usd = (wei, ethUsd) => (!wei || !ethUsd ? null : (Number(wei) / 1e18) * (Number(ethUsd) / 1e18));
46
48
  const text = (obj) => ({ content: [{ type: 'text', text: JSON.stringify(obj, null, 2) }] });
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@hoodag/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
+ "mcpName": "ag.hood/name-service",
4
5
  "description": "MCP server for the .hood name service on Robinhood Chain — lets AI agents resolve names, reverse-resolve addresses, read records, and check availability.",
5
6
  "type": "module",
6
7
  "bin": {
@@ -27,6 +28,7 @@
27
28
  "homepage": "https://hood.ag",
28
29
  "license": "MIT",
29
30
  "dependencies": {
31
+ "@adraffy/ens-normalize": "^1.11.1",
30
32
  "@modelcontextprotocol/sdk": "^1.12.0",
31
33
  "viem": "^2.31.0",
32
34
  "zod": "^3.23.8"