@nonagon-link/mcp 0.3.3 → 0.3.4
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/dist/server.js +51 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ Add to your MCP client config (e.g. `.claude/settings.json` or `claude_desktop_c
|
|
|
129
129
|
"mcpServers": {
|
|
130
130
|
"nonagon-link": {
|
|
131
131
|
"command": "npx",
|
|
132
|
-
"args": ["-y", "--ignore-scripts", "@nonagon-link/mcp@0.3.
|
|
132
|
+
"args": ["-y", "--ignore-scripts", "@nonagon-link/mcp@0.3.4"],
|
|
133
133
|
"env": {
|
|
134
134
|
"NONAGON_PRIVATE_KEY": "<Base58 Solana secret key>",
|
|
135
135
|
"NONAGON_LINK_BASE_URL": "https://api.nnglink.ai",
|
|
@@ -140,7 +140,7 @@ Add to your MCP client config (e.g. `.claude/settings.json` or `claude_desktop_c
|
|
|
140
140
|
}
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
> **Always pin an exact version** (`@nonagon-link/mcp@0.3.
|
|
143
|
+
> **Always pin an exact version** (`@nonagon-link/mcp@0.3.4`). Never use an unversioned `@nonagon-link/mcp` — your private key is passed to the process environment, so an unpinned install would expose it to whatever the latest published version is. `--ignore-scripts` additionally prevents dependency install scripts from running with your environment.
|
|
144
144
|
>
|
|
145
145
|
> **Set `NONAGON_PAY_TO`** to the NONAGON LINK Solana platform wallet (see [NONAGON LINK payees](#nonagon-link-payees)) — do not copy `payTo` from an untrusted 402. Unset = every **Solana USDC** payment is refused. EVM payments (JPYC, EVM USDC) are allowed separately by `NONAGON_EVM_PAY_TO`; unset, every EVM payment is refused.
|
|
146
146
|
|
|
@@ -158,7 +158,7 @@ The current values are also listed at https://nnglink.ai/docs/mcp.
|
|
|
158
158
|
For stricter isolation, install once and reference the binary directly:
|
|
159
159
|
|
|
160
160
|
```bash
|
|
161
|
-
npm install -g @nonagon-link/mcp@0.3.
|
|
161
|
+
npm install -g @nonagon-link/mcp@0.3.4
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
```json
|
package/dist/server.js
CHANGED
|
@@ -1577,16 +1577,27 @@ async function pinnedFetch(input, options) {
|
|
|
1577
1577
|
},
|
|
1578
1578
|
maxRedirections: 0
|
|
1579
1579
|
});
|
|
1580
|
+
return fetchWithPinnedAgent(input, fetchOptions, agent, redirectMode);
|
|
1581
|
+
}
|
|
1582
|
+
async function fetchWithPinnedAgent(input, fetchOptions, agent, redirectMode) {
|
|
1583
|
+
const release = () => {
|
|
1584
|
+
agent.close().catch(() => {
|
|
1585
|
+
});
|
|
1586
|
+
};
|
|
1587
|
+
let response;
|
|
1580
1588
|
try {
|
|
1581
|
-
|
|
1589
|
+
response = await fetch(input, {
|
|
1582
1590
|
...fetchOptions,
|
|
1583
1591
|
// @ts-expect-error undici dispatcher — Node.js の fetch は undici ベースで dispatcher をサポート
|
|
1584
1592
|
dispatcher: agent,
|
|
1585
1593
|
redirect: redirectMode
|
|
1586
1594
|
});
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1595
|
+
} catch (error) {
|
|
1596
|
+
release();
|
|
1597
|
+
throw error;
|
|
1589
1598
|
}
|
|
1599
|
+
release();
|
|
1600
|
+
return response;
|
|
1590
1601
|
}
|
|
1591
1602
|
|
|
1592
1603
|
// ../../apps/nonagon_link/src/mcp/lib/pinnedFetchAdapter.ts
|
|
@@ -1629,12 +1640,41 @@ async function buildPinnedFetchArgs(input, init) {
|
|
|
1629
1640
|
}
|
|
1630
1641
|
return { url: String(input), init };
|
|
1631
1642
|
}
|
|
1643
|
+
var MAX_402_BODY_BYTES = 65536;
|
|
1644
|
+
async function bound402Body(response) {
|
|
1645
|
+
const reader = response.body?.getReader();
|
|
1646
|
+
if (!reader) return response;
|
|
1647
|
+
const chunks = [];
|
|
1648
|
+
let total = 0;
|
|
1649
|
+
try {
|
|
1650
|
+
for (; ; ) {
|
|
1651
|
+
const { done, value } = await reader.read();
|
|
1652
|
+
if (done) break;
|
|
1653
|
+
total += value.length;
|
|
1654
|
+
if (total > MAX_402_BODY_BYTES) throw new Error("UPSTREAM_402_BODY_TOO_LARGE");
|
|
1655
|
+
chunks.push(value);
|
|
1656
|
+
}
|
|
1657
|
+
} catch (err) {
|
|
1658
|
+
await reader.cancel().catch(() => {
|
|
1659
|
+
});
|
|
1660
|
+
throw err;
|
|
1661
|
+
}
|
|
1662
|
+
const headers = new Headers(response.headers);
|
|
1663
|
+
headers.delete("content-length");
|
|
1664
|
+
headers.delete("content-encoding");
|
|
1665
|
+
return new Response(Buffer.concat(chunks), {
|
|
1666
|
+
status: response.status,
|
|
1667
|
+
statusText: response.statusText,
|
|
1668
|
+
headers
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1632
1671
|
var pinnedFetchAdapter = async (input, init) => {
|
|
1633
1672
|
const resolved = await buildPinnedFetchArgs(input, init);
|
|
1634
|
-
|
|
1673
|
+
const response = await pinnedFetch(resolved.url, {
|
|
1635
1674
|
...resolved.init,
|
|
1636
1675
|
dnsResolver: resolved.init?.dnsResolver ?? resolverWithGetaddrinfoFallback
|
|
1637
1676
|
});
|
|
1677
|
+
return response.status === 402 ? bound402Body(response) : response;
|
|
1638
1678
|
};
|
|
1639
1679
|
|
|
1640
1680
|
// ../../apps/nonagon_link/src/mcp/lib/logger.ts
|
|
@@ -1752,6 +1792,13 @@ import Ajv2 from "ajv";
|
|
|
1752
1792
|
import addFormats2 from "ajv-formats";
|
|
1753
1793
|
import { decodePaymentRequiredHeader } from "@x402/core/http";
|
|
1754
1794
|
|
|
1795
|
+
// ../../apps/nonagon_link/src/lib/facilitator/paymentOutcome.ts
|
|
1796
|
+
var registry = globalThis;
|
|
1797
|
+
var { evidence, bodies } = registry.__nonagonPaymentOutcome ??= {
|
|
1798
|
+
evidence: /* @__PURE__ */ new WeakMap(),
|
|
1799
|
+
bodies: /* @__PURE__ */ new WeakMap()
|
|
1800
|
+
};
|
|
1801
|
+
|
|
1755
1802
|
// ../../apps/nonagon_link/src/lib/discovery/bazaar.ts
|
|
1756
1803
|
import Ajv from "ajv";
|
|
1757
1804
|
import addFormats from "ajv-formats";
|