@agtnames/mcp 1.2.0 → 1.3.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/config.js CHANGED
@@ -8,7 +8,12 @@
8
8
  import { readFileSync } from "node:fs";
9
9
  // Resolved relative to this module (dist/config.js or src/config.ts → ../package.json). No resolveJsonModule needed.
10
10
  export const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
11
- export const GATEWAY_ALLOWLIST = ["https://dweb.link/ipfs/", "https://ipfs.io/ipfs/", "https://cloudflare-ipfs.com/ipfs/", "https://w3s.link/ipfs/"];
11
+ /**
12
+ * Gateways the server may read `ipfs://` manifests from. With AGT_IPFS_GATEWAY unset every one is tried in this order
13
+ * until one answers (#332: public gateways rate-limit; a CID's bytes are the same everywhere and are checked against
14
+ * the CID). Setting AGT_IPFS_GATEWAY pins reads to that single gateway.
15
+ */
16
+ export const GATEWAY_ALLOWLIST = ["https://gateway.pinata.cloud/ipfs/", "https://dweb.link/ipfs/", "https://ipfs.io/ipfs/", "https://w3s.link/ipfs/", "https://cloudflare-ipfs.com/ipfs/"];
12
17
  export class ConfigError extends Error {
13
18
  constructor(message) { super(message); this.name = "ConfigError"; }
14
19
  }
@@ -22,17 +27,19 @@ function num(raw, d) {
22
27
  }
23
28
  export function loadConfig(env = process.env) {
24
29
  const get = (k) => env[k] || undefined; // "" → unset
25
- const gateway = (get("AGT_IPFS_GATEWAY") ?? GATEWAY_ALLOWLIST[0]).replace(/\/?$/, "/");
26
- if (!GATEWAY_ALLOWLIST.includes(gateway)) {
27
- throw new ConfigError(`AGT_IPFS_GATEWAY ${gateway} is not allow-listed (${GATEWAY_ALLOWLIST.join(", ")})`);
30
+ const pinned = get("AGT_IPFS_GATEWAY")?.replace(/\/?$/, "/");
31
+ if (pinned && !GATEWAY_ALLOWLIST.includes(pinned)) {
32
+ throw new ConfigError(`AGT_IPFS_GATEWAY ${pinned} is not allow-listed (${GATEWAY_ALLOWLIST.join(", ")})`);
28
33
  }
34
+ const gateways = pinned ? [pinned] : GATEWAY_ALLOWLIST;
29
35
  return {
30
36
  chain: get("AGT_CHAIN") ?? DEFAULTS.chain,
31
37
  rpcUrl: get("AGT_RPC_URL"),
32
38
  registry: get("AGT_REGISTRY"),
33
39
  fns: get("AGT_FNS"),
34
40
  legacy: get("AGT_LEGACY") === "1",
35
- ipfsGateway: gateway,
41
+ ipfsGateway: gateways[0],
42
+ ipfsGateways: gateways,
36
43
  dohUrl: get("AGT_DOH_URL"),
37
44
  timeoutMs: num(get("AGT_TIMEOUT_MS"), DEFAULTS.timeoutMs),
38
45
  maxManifestBytes: num(get("AGT_MAX_MANIFEST"), DEFAULTS.maxManifestBytes),
@@ -58,7 +65,8 @@ Environment (all optional; Polygon mainnet works with none)
58
65
  AGT_REGISTRY override the registry address (required only for localhost)
59
66
  AGT_FNS legacy FNS address for AGT_LEGACY
60
67
  AGT_LEGACY=1 enable Registry v1 + DNS TXT fallbacks
61
- AGT_IPFS_GATEWAY one of: ${GATEWAY_ALLOWLIST.join(" ")}
68
+ AGT_IPFS_GATEWAY pin ipfs:// reads to one gateway; unset = try each in order:
69
+ ${GATEWAY_ALLOWLIST.join(" ")}
62
70
  AGT_DOH_URL DoH endpoint for the DNS fallback
63
71
  AGT_TIMEOUT_MS per-request timeout (default ${DEFAULTS.timeoutMs})
64
72
  AGT_MAX_MANIFEST max manifest bytes (default ${DEFAULTS.maxManifestBytes})
package/dist/server.js CHANGED
@@ -160,7 +160,7 @@ export function buildServer(cfg, deps = {}) {
160
160
  return instance;
161
161
  instance = new AgtResolver({
162
162
  chain: cfg.chain, rpcUrl: cfg.rpcUrl, registry: cfg.registry, fns: cfg.fns,
163
- legacyFns: cfg.legacy, legacyDns: cfg.legacy, ipfsGateway: cfg.ipfsGateway, dohUrl: cfg.dohUrl,
163
+ legacyFns: cfg.legacy, legacyDns: cfg.legacy, ipfsGateways: cfg.ipfsGateways, dohUrl: cfg.dohUrl,
164
164
  timeoutMs: cfg.timeoutMs, maxManifestBytes: cfg.maxManifestBytes,
165
165
  });
166
166
  return instance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agtnames/mcp",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "MCP server for .agt agent names: resolve, verify and discover agents by name against AGT Registry v2, and (opt-in) write records under an owner-signed session grant. Works with any MCP-compatible client (Claude Code, Cursor, custom agents).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,7 +32,7 @@
32
32
  "prepublishOnly": "node scripts/check-publish-deps.mjs && npm run build && npm test"
33
33
  },
34
34
  "dependencies": {
35
- "@agtnames/resolver": "^1.0.3",
35
+ "@agtnames/resolver": "^1.1.0",
36
36
  "@modelcontextprotocol/sdk": "^1.30.0",
37
37
  "zod": "^3.25.0",
38
38
  "@agtnames/countersign": "^0.1.0",