@gvnrdao/dh-mcp 0.3.1 → 0.4.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/README.md +18 -18
- package/dist/boundary.js +7 -31
- package/dist/index.js +19 -45
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,13 +11,13 @@ so there is **nothing to install first** (no Node, no npm):
|
|
|
11
11
|
|
|
12
12
|
| You are on | Install path |
|
|
13
13
|
|---|---|
|
|
14
|
-
| **Claude Desktop (macOS / Windows)** | Download the bundle and open it (double-click / drag into Settings → Extensions): `https://assets.gvnr.xyz/dh-mcp/v0.
|
|
15
|
-
| **Linux — including Claude Desktop builds on Linux — or any other MCP host** | One line, no sudo: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| sh` — installs a self-contained binary (its own Node runtime inside) to `~/.dh-mcp/bin/dh-mcp`, verifies its SHA-256, and prints the exact `mcpServers` snippet. **Then wire the host:** Claude Code: `claude mcp add diamond-hands -- $HOME/.dh-mcp/bin/dh-mcp` (new session); Claude Desktop (Linux builds): the snippet in `~/.config/Claude/claude_desktop_config.json`, full quit + relaunch; other hosts: the snippet in their MCP config. Pin a version: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| DH_VERSION=0.
|
|
14
|
+
| **Claude Desktop (macOS / Windows)** | Download the bundle and open it (double-click / drag into Settings → Extensions): `https://assets.gvnr.xyz/dh-mcp/v0.4.0/dh-mcp-0.4.0.mcpb` — Claude Desktop runs it on its own embedded runtime; network and optional keystore are configured in the extension's settings UI (the password is held by the OS credential store, never written to a config file). |
|
|
15
|
+
| **Linux — including Claude Desktop builds on Linux — or any other MCP host** | One line, no sudo: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| sh` — installs a self-contained binary (its own Node runtime inside) to `~/.dh-mcp/bin/dh-mcp`, verifies its SHA-256, and prints the exact `mcpServers` snippet. **Then wire the host:** Claude Code: `claude mcp add diamond-hands -- $HOME/.dh-mcp/bin/dh-mcp` (new session); Claude Desktop (Linux builds): the snippet in `~/.config/Claude/claude_desktop_config.json`, full quit + relaunch; other hosts: the snippet in their MCP config. Pin a version: `curl -fsSL https://assets.gvnr.xyz/dh-mcp/install.sh \| DH_VERSION=0.4.0 sh` |
|
|
16
16
|
| **Developers** (requires **Node ≥ 18 on PATH** — this path does NOT work on a bare machine) | Claude Code: `claude mcp add diamond-hands -- npx -y @gvnrdao/dh-mcp` · any host JSON: `{ "mcpServers": { "diamond-hands": { "command": "npx", "args": ["-y", "@gvnrdao/dh-mcp"] } } }` |
|
|
17
17
|
|
|
18
18
|
Downloads landing page (which file is for which system, checksums, security notes):
|
|
19
19
|
**https://assets.gvnr.xyz/dh-mcp/** — all artifacts and `SHA256SUMS` live under it
|
|
20
|
-
(`latest/` and `v<version>/` — e.g. `v0.
|
|
20
|
+
(`latest/` and `v<version>/` — e.g. `v0.4.0/`).
|
|
21
21
|
|
|
22
22
|
Local installs serve local MCP hosts only — **claude.ai web / mobile / Cowork cannot
|
|
23
23
|
reach them** (a hosted remote connector is a separate, upcoming tier).
|
|
@@ -42,7 +42,7 @@ overridable by environment variables:
|
|
|
42
42
|
| Variable | Default | Meaning |
|
|
43
43
|
|---|---|---|
|
|
44
44
|
| `DH_ADAPTER` | `real` | `real` protocol, or `mock` (offline practice sandbox; needs `DH_MOCK_DB` + `DH_MOCK_LATENCY`) |
|
|
45
|
-
| `DH_NETWORK` | `sepolia` | `sepolia` or `mainnet` (
|
|
45
|
+
| `DH_NETWORK` | `sepolia` | `sepolia` (practice) or `mainnet` (REAL money — reads and writes both work out of the box) |
|
|
46
46
|
| `ETH_RPC_URL` | public node per network | your own RPC if preferred |
|
|
47
47
|
| `DH_SERVICE_ENDPOINT` | per network | Diamond Hands ops service |
|
|
48
48
|
| `DH_KEYSTORE_PATH` + `DH_KEYSTORE_PASSWORD` | unset | optional: encrypted keystore for automatic signing (both or neither) |
|
|
@@ -57,7 +57,7 @@ paste-code) or a local encrypted keystore. Safe smart-account and delegation mod
|
|
|
57
57
|
| Network | Reads (public) | Reads (authenticated) | Writes |
|
|
58
58
|
|---|---|---|---|
|
|
59
59
|
| **sepolia** (default — the real protocol, practice money) | always, no setup | after a login: keystore env pair, or "connect my wallet" (`signer_setup`) | signer modes **keystore** and **external** (your own wallet). External-mode BTC withdrawal is not shipped yet — it refuses with that true reason; keystore withdrawal works |
|
|
60
|
-
| **mainnet** (real money) | always (indexer gaps are reported honestly) | after a login (the broker throttles logins per address) | **
|
|
60
|
+
| **mainnet** (real money) | always (indexer gaps are reported honestly) | after a login (the broker throttles logins per address) | signer modes **keystore** and **external**, same as sepolia — every operation moves REAL funds behind your confirmation + signature; PSM writes refuse (sepolia-only) |
|
|
61
61
|
| **mock** (`DH_ADAPTER=mock` — offline practice sandbox) | always | always | all modes, including the simulated Safe and delegation planes |
|
|
62
62
|
|
|
63
63
|
Signer modes `safe` and `safe-module` (Safe smart-account borrower, delegation) are
|
|
@@ -73,8 +73,8 @@ refuses legibly, and the user says "connect my wallet" (`signer_setup` action `c
|
|
|
73
73
|
- The approval bridge listens on **loopback only** (127.0.0.1, token-gated).
|
|
74
74
|
- Every fund-moving call requires your explicit confirmation AND a real signature; the
|
|
75
75
|
card you sign is decoded from the exact transaction — never re-formatted.
|
|
76
|
-
- **Mainnet
|
|
77
|
-
writes refuse
|
|
76
|
+
- **Mainnet operations move real funds** — they run only behind your explicit
|
|
77
|
+
confirmation plus a real signature you approve; PSM mainnet writes refuse (sepolia-only).
|
|
78
78
|
|
|
79
79
|
## What it solves
|
|
80
80
|
|
|
@@ -151,12 +151,11 @@ diagrams, data contracts, scenario catalog) live in the repository:
|
|
|
151
151
|
- Behavior is pinned by scenario tests that run through the genuine MCP request path
|
|
152
152
|
(in-memory client/server pair), covering happy paths and failure classes alike
|
|
153
153
|
(missing config, uncollateralized operations, source divergence, upstream outages).
|
|
154
|
-
- Current stage: **real adapter (sepolia
|
|
155
|
-
behind the same boundary contract and the same scenario suites.
|
|
156
|
-
runs on the real adapter; external-mode BTC withdrawal is the
|
|
157
|
-
(its true reason is stated; keystore withdrawal works).
|
|
158
|
-
-
|
|
159
|
-
unrestricted, with indexer gaps reported honestly.
|
|
154
|
+
- Current stage: **real adapter (sepolia AND mainnet, reads and writes) + mock
|
|
155
|
+
simulator**, all behind the same boundary contract and the same scenario suites.
|
|
156
|
+
External-wallet signing runs on the real adapter; external-mode BTC withdrawal is the
|
|
157
|
+
one remaining refusal (its true reason is stated; keystore withdrawal works).
|
|
158
|
+
- Reads are unrestricted, with indexer gaps reported honestly.
|
|
160
159
|
|
|
161
160
|
## Security model
|
|
162
161
|
|
|
@@ -191,12 +190,13 @@ pair (`DH_KEYSTORE_PATH` + `DH_KEYSTORE_PASSWORD`) or connecting the user's own
|
|
|
191
190
|
Dependencies are pinned to exact versions so nothing drifts silently between installs.
|
|
192
191
|
Bump deliberately, in lockstep with sibling packages, and run `npm ci` in CI.
|
|
193
192
|
|
|
194
|
-
### Mainnet
|
|
193
|
+
### Mainnet moves real funds
|
|
195
194
|
|
|
196
|
-
Mainnet reads work out of the box.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
approval flow and key management; PSM mainnet
|
|
195
|
+
Mainnet reads and writes both work out of the box. Every fund-moving operation still
|
|
196
|
+
requires the explicit human `confirmed: true` plus a real signature (wallet approval
|
|
197
|
+
card or keystore), and the network switch ceremony states the money reality loudly.
|
|
198
|
+
Review your host's approval flow and key management before using mainnet; PSM mainnet
|
|
199
|
+
writes refuse (sepolia-only).
|
|
200
200
|
|
|
201
201
|
## For AI assistants
|
|
202
202
|
|
package/dist/boundary.js
CHANGED
|
@@ -87601,7 +87601,7 @@ function psmMainnetWriteRefusal(network, chainId) {
|
|
|
87601
87601
|
return {
|
|
87602
87602
|
kind: "rejected",
|
|
87603
87603
|
source: SOURCE5,
|
|
87604
|
-
message: `psmSwap is refused (MAINNET_WRITES_DISABLED): PSM writes are enabled on sepolia ONLY, and this process is configured for network '${network}' (chainId ${chainId}) \u2014 the
|
|
87604
|
+
message: `psmSwap is refused (MAINNET_WRITES_DISABLED): PSM writes are enabled on sepolia ONLY, and this process is configured for network '${network}' (chainId ${chainId}) \u2014 the PSM-specific sepolia-only anchor; mainnet PSM operations await their dedicated security review. No ceremony was started and no signer was touched. PSM reads (psm_quote, protocol://psm) remain available. Loan operations are NOT affected by this gate.`
|
|
87605
87605
|
};
|
|
87606
87606
|
}
|
|
87607
87607
|
var SOURCE5 = "real-ops";
|
|
@@ -88525,7 +88525,7 @@ var RealUpstreamPlugin = class {
|
|
|
88525
88525
|
})
|
|
88526
88526
|
)
|
|
88527
88527
|
};
|
|
88528
|
-
const writeRefusalReason =
|
|
88528
|
+
const writeRefusalReason = !this.wallet ? `no signer is configured (SIGNER_UNAVAILABLE) \u2014 writes need the keystore env pair (DH_KEYSTORE_PATH + DH_KEYSTORE_PASSWORD), or run signer_setup.` : `the lit-ops login session is unavailable \u2014 the keystore is configured but EIP-712 login did not complete; check the broker endpoint and retry.`;
|
|
88529
88529
|
const readOnly = (op) => Promise.resolve(
|
|
88530
88530
|
upFail({
|
|
88531
88531
|
kind: "unavailable",
|
|
@@ -88533,10 +88533,9 @@ var RealUpstreamPlugin = class {
|
|
|
88533
88533
|
message: `${op} is refused: ${writeRefusalReason}`
|
|
88534
88534
|
})
|
|
88535
88535
|
);
|
|
88536
|
-
|
|
88537
|
-
if (writesArmed && this.runtime) {
|
|
88536
|
+
if (this.runtime) {
|
|
88538
88537
|
this.ops = this.resolvingOps();
|
|
88539
|
-
} else if (
|
|
88538
|
+
} else if (this.wallet && this.session) {
|
|
88540
88539
|
this.ops = this.keystoreGateway(this.wallet.connect(this.provider), this.session);
|
|
88541
88540
|
} else {
|
|
88542
88541
|
this.ops = {
|
|
@@ -88589,8 +88588,6 @@ var RealUpstreamPlugin = class {
|
|
|
88589
88588
|
* Safe to call repeatedly; failures leave the write plane honestly unavailable
|
|
88590
88589
|
* (createPosition/withdraw report the uninitialized SDK). */
|
|
88591
88590
|
async initWriteSdk() {
|
|
88592
|
-
const writesArmed = this.config.network === "sepolia" || this.config.network === "mainnet" && this.config.mainnetWritesAck === true;
|
|
88593
|
-
if (!writesArmed) return;
|
|
88594
88591
|
if (this.runtime && this.runtime.manager.mode() !== "keystore") return;
|
|
88595
88592
|
const wallet = this.wallet ?? this.runtime?.keystore.signer() ?? null;
|
|
88596
88593
|
if (!wallet) return;
|
|
@@ -88687,7 +88684,7 @@ var RealUpstreamPlugin = class {
|
|
|
88687
88684
|
verifyBudget() {
|
|
88688
88685
|
return this.config.network === "mainnet" ? { attempts: 100, delayMs: 3e3 } : void 0;
|
|
88689
88686
|
}
|
|
88690
|
-
/** The
|
|
88687
|
+
/** The runtime ops surface: every method resolves the CURRENT signer mode first, so
|
|
88691
88688
|
* the refusal-truth matrix is decided at call time, never frozen at boot. */
|
|
88692
88689
|
resolvingOps() {
|
|
88693
88690
|
const call = (k) => (async (p) => {
|
|
@@ -90163,20 +90160,6 @@ function resolveRealConfig(env) {
|
|
|
90163
90160
|
bridgeOpenBrowser = bridgeOpenRaw === "1";
|
|
90164
90161
|
}
|
|
90165
90162
|
}
|
|
90166
|
-
const ACK_PHRASE = "I-UNDERSTAND-REAL-FUNDS";
|
|
90167
|
-
const ackRaw = env["DH_MAINNET_WRITES_ACK"];
|
|
90168
|
-
let mainnetWritesAck;
|
|
90169
|
-
if (ackRaw !== void 0 && ackRaw !== "") {
|
|
90170
|
-
if (network !== "mainnet") {
|
|
90171
|
-
problems.push("DH_MAINNET_WRITES_ACK is only meaningful with DH_NETWORK=mainnet \u2014 unset it on other networks.");
|
|
90172
|
-
} else if (ackRaw !== ACK_PHRASE) {
|
|
90173
|
-
problems.push(
|
|
90174
|
-
"DH_MAINNET_WRITES_ACK is set but does not match the required acknowledgement phrase \u2014 mainnet writes stay refused. (The phrase is deliberate friction: it arms REAL-FUND transactions.)"
|
|
90175
|
-
);
|
|
90176
|
-
} else {
|
|
90177
|
-
mainnetWritesAck = true;
|
|
90178
|
-
}
|
|
90179
|
-
}
|
|
90180
90163
|
const validatorRaw = env["DH_VALIDATOR_VERSION"];
|
|
90181
90164
|
let validatorVersion = defaults2.validatorVersion;
|
|
90182
90165
|
if (validatorRaw !== void 0 && validatorRaw !== "") {
|
|
@@ -90211,8 +90194,7 @@ function resolveRealConfig(env) {
|
|
|
90211
90194
|
...bridgeUrlFile ? { bridgeUrlFile } : {},
|
|
90212
90195
|
...bridgeOpenBrowser !== void 0 ? { bridgeOpenBrowser } : {},
|
|
90213
90196
|
...wcProjectId ? { wcProjectId } : {},
|
|
90214
|
-
...validatorVersion !== void 0 ? { validatorVersion } : {}
|
|
90215
|
-
...mainnetWritesAck === true ? { mainnetWritesAck: true } : {}
|
|
90197
|
+
...validatorVersion !== void 0 ? { validatorVersion } : {}
|
|
90216
90198
|
}
|
|
90217
90199
|
};
|
|
90218
90200
|
}
|
|
@@ -90387,18 +90369,12 @@ async function createRealBoundary(config, wallet) {
|
|
|
90387
90369
|
const plugin = new RealUpstreamPlugin(config, wallet, { manager, bridge, keystore });
|
|
90388
90370
|
await plugin.initWriteSdk();
|
|
90389
90371
|
const configFingerprint = (0, import_node_crypto7.createHash)("sha256").update(JSON.stringify({ adapter: config.adapter, network: config.network, ops: config.serviceEndpoint })).digest("hex").slice(0, 12);
|
|
90390
|
-
const writesArmed = config.network === "sepolia" || config.network === "mainnet" && config.mainnetWritesAck === true;
|
|
90391
90372
|
const capabilities = () => ({
|
|
90392
90373
|
reads: {
|
|
90393
90374
|
public: true,
|
|
90394
90375
|
authenticated: plugin.authenticatedReadsAvailable() ? "available" : "needs-signer"
|
|
90395
90376
|
},
|
|
90396
|
-
writes:
|
|
90397
|
-
enabled: false,
|
|
90398
|
-
reason: "writes are operator-gated on mainnet \u2014 the standing mainnet write block; mainnet writes await their dedicated security review. Reads remain available.",
|
|
90399
|
-
signerModes: [],
|
|
90400
|
-
activeMode: manager.mode()
|
|
90401
|
-
},
|
|
90377
|
+
writes: { enabled: true, signerModes: ["external", "keystore"], activeMode: manager.mode() },
|
|
90402
90378
|
signerSetupTool: true,
|
|
90403
90379
|
// Plan 13: the real adapter switches networks by conversation (network_switch tool).
|
|
90404
90380
|
networkSwitch: true
|
package/dist/index.js
CHANGED
|
@@ -52214,20 +52214,6 @@ function resolveRealConfig(env) {
|
|
|
52214
52214
|
bridgeOpenBrowser = bridgeOpenRaw === "1";
|
|
52215
52215
|
}
|
|
52216
52216
|
}
|
|
52217
|
-
const ACK_PHRASE = "I-UNDERSTAND-REAL-FUNDS";
|
|
52218
|
-
const ackRaw = env["DH_MAINNET_WRITES_ACK"];
|
|
52219
|
-
let mainnetWritesAck;
|
|
52220
|
-
if (ackRaw !== void 0 && ackRaw !== "") {
|
|
52221
|
-
if (network !== "mainnet") {
|
|
52222
|
-
problems.push("DH_MAINNET_WRITES_ACK is only meaningful with DH_NETWORK=mainnet \u2014 unset it on other networks.");
|
|
52223
|
-
} else if (ackRaw !== ACK_PHRASE) {
|
|
52224
|
-
problems.push(
|
|
52225
|
-
"DH_MAINNET_WRITES_ACK is set but does not match the required acknowledgement phrase \u2014 mainnet writes stay refused. (The phrase is deliberate friction: it arms REAL-FUND transactions.)"
|
|
52226
|
-
);
|
|
52227
|
-
} else {
|
|
52228
|
-
mainnetWritesAck = true;
|
|
52229
|
-
}
|
|
52230
|
-
}
|
|
52231
52217
|
const validatorRaw = env["DH_VALIDATOR_VERSION"];
|
|
52232
52218
|
let validatorVersion = defaults2.validatorVersion;
|
|
52233
52219
|
if (validatorRaw !== void 0 && validatorRaw !== "") {
|
|
@@ -52262,8 +52248,7 @@ function resolveRealConfig(env) {
|
|
|
52262
52248
|
...bridgeUrlFile ? { bridgeUrlFile } : {},
|
|
52263
52249
|
...bridgeOpenBrowser !== void 0 ? { bridgeOpenBrowser } : {},
|
|
52264
52250
|
...wcProjectId ? { wcProjectId } : {},
|
|
52265
|
-
...validatorVersion !== void 0 ? { validatorVersion } : {}
|
|
52266
|
-
...mainnetWritesAck === true ? { mainnetWritesAck: true } : {}
|
|
52251
|
+
...validatorVersion !== void 0 ? { validatorVersion } : {}
|
|
52267
52252
|
}
|
|
52268
52253
|
};
|
|
52269
52254
|
}
|
|
@@ -87814,7 +87799,7 @@ function psmMainnetWriteRefusal(network, chainId) {
|
|
|
87814
87799
|
return {
|
|
87815
87800
|
kind: "rejected",
|
|
87816
87801
|
source: SOURCE5,
|
|
87817
|
-
message: `psmSwap is refused (MAINNET_WRITES_DISABLED): PSM writes are enabled on sepolia ONLY, and this process is configured for network '${network}' (chainId ${chainId}) \u2014 the
|
|
87802
|
+
message: `psmSwap is refused (MAINNET_WRITES_DISABLED): PSM writes are enabled on sepolia ONLY, and this process is configured for network '${network}' (chainId ${chainId}) \u2014 the PSM-specific sepolia-only anchor; mainnet PSM operations await their dedicated security review. No ceremony was started and no signer was touched. PSM reads (psm_quote, protocol://psm) remain available. Loan operations are NOT affected by this gate.`
|
|
87818
87803
|
};
|
|
87819
87804
|
}
|
|
87820
87805
|
var SOURCE5 = "real-ops";
|
|
@@ -88738,7 +88723,7 @@ var RealUpstreamPlugin = class {
|
|
|
88738
88723
|
})
|
|
88739
88724
|
)
|
|
88740
88725
|
};
|
|
88741
|
-
const writeRefusalReason =
|
|
88726
|
+
const writeRefusalReason = !this.wallet ? `no signer is configured (SIGNER_UNAVAILABLE) \u2014 writes need the keystore env pair (DH_KEYSTORE_PATH + DH_KEYSTORE_PASSWORD), or run signer_setup.` : `the lit-ops login session is unavailable \u2014 the keystore is configured but EIP-712 login did not complete; check the broker endpoint and retry.`;
|
|
88742
88727
|
const readOnly = (op) => Promise.resolve(
|
|
88743
88728
|
upFail({
|
|
88744
88729
|
kind: "unavailable",
|
|
@@ -88746,10 +88731,9 @@ var RealUpstreamPlugin = class {
|
|
|
88746
88731
|
message: `${op} is refused: ${writeRefusalReason}`
|
|
88747
88732
|
})
|
|
88748
88733
|
);
|
|
88749
|
-
|
|
88750
|
-
if (writesArmed && this.runtime) {
|
|
88734
|
+
if (this.runtime) {
|
|
88751
88735
|
this.ops = this.resolvingOps();
|
|
88752
|
-
} else if (
|
|
88736
|
+
} else if (this.wallet && this.session) {
|
|
88753
88737
|
this.ops = this.keystoreGateway(this.wallet.connect(this.provider), this.session);
|
|
88754
88738
|
} else {
|
|
88755
88739
|
this.ops = {
|
|
@@ -88802,8 +88786,6 @@ var RealUpstreamPlugin = class {
|
|
|
88802
88786
|
* Safe to call repeatedly; failures leave the write plane honestly unavailable
|
|
88803
88787
|
* (createPosition/withdraw report the uninitialized SDK). */
|
|
88804
88788
|
async initWriteSdk() {
|
|
88805
|
-
const writesArmed = this.config.network === "sepolia" || this.config.network === "mainnet" && this.config.mainnetWritesAck === true;
|
|
88806
|
-
if (!writesArmed) return;
|
|
88807
88789
|
if (this.runtime && this.runtime.manager.mode() !== "keystore") return;
|
|
88808
88790
|
const wallet = this.wallet ?? this.runtime?.keystore.signer() ?? null;
|
|
88809
88791
|
if (!wallet) return;
|
|
@@ -88900,7 +88882,7 @@ var RealUpstreamPlugin = class {
|
|
|
88900
88882
|
verifyBudget() {
|
|
88901
88883
|
return this.config.network === "mainnet" ? { attempts: 100, delayMs: 3e3 } : void 0;
|
|
88902
88884
|
}
|
|
88903
|
-
/** The
|
|
88885
|
+
/** The runtime ops surface: every method resolves the CURRENT signer mode first, so
|
|
88904
88886
|
* the refusal-truth matrix is decided at call time, never frozen at boot. */
|
|
88905
88887
|
resolvingOps() {
|
|
88906
88888
|
const call = (k) => (async (p) => {
|
|
@@ -90388,18 +90370,12 @@ async function createRealBoundary(config, wallet) {
|
|
|
90388
90370
|
const plugin = new RealUpstreamPlugin(config, wallet, { manager, bridge, keystore });
|
|
90389
90371
|
await plugin.initWriteSdk();
|
|
90390
90372
|
const configFingerprint = (0, import_node_crypto7.createHash)("sha256").update(JSON.stringify({ adapter: config.adapter, network: config.network, ops: config.serviceEndpoint })).digest("hex").slice(0, 12);
|
|
90391
|
-
const writesArmed = config.network === "sepolia" || config.network === "mainnet" && config.mainnetWritesAck === true;
|
|
90392
90373
|
const capabilities = () => ({
|
|
90393
90374
|
reads: {
|
|
90394
90375
|
public: true,
|
|
90395
90376
|
authenticated: plugin.authenticatedReadsAvailable() ? "available" : "needs-signer"
|
|
90396
90377
|
},
|
|
90397
|
-
writes:
|
|
90398
|
-
enabled: false,
|
|
90399
|
-
reason: "writes are operator-gated on mainnet \u2014 the standing mainnet write block; mainnet writes await their dedicated security review. Reads remain available.",
|
|
90400
|
-
signerModes: [],
|
|
90401
|
-
activeMode: manager.mode()
|
|
90402
|
-
},
|
|
90378
|
+
writes: { enabled: true, signerModes: ["external", "keystore"], activeMode: manager.mode() },
|
|
90403
90379
|
signerSetupTool: true,
|
|
90404
90380
|
// Plan 13: the real adapter switches networks by conversation (network_switch tool).
|
|
90405
90381
|
networkSwitch: true
|
|
@@ -90488,7 +90464,6 @@ function createNetworkSwitchRuntime(opts) {
|
|
|
90488
90464
|
},
|
|
90489
90465
|
async switchTo(network) {
|
|
90490
90466
|
const targetEnv = { ...opts.env, DH_NETWORK: network };
|
|
90491
|
-
delete targetEnv["DH_MAINNET_WRITES_ACK"];
|
|
90492
90467
|
const configResult = resolveBoundaryConfig(targetEnv);
|
|
90493
90468
|
if (!configResult.ok) return { ok: false, error: configResult.error };
|
|
90494
90469
|
const next = await buildBoundary(configResult);
|
|
@@ -91659,8 +91634,8 @@ tolerance; if fees or the rate drifted beyond that between quote and execution,
|
|
|
91659
91634
|
contract refuses \u2014 you never silently receive less. Output always lands at the signer's
|
|
91660
91635
|
own address. If you approve step 1 but decline step 2, the exact-amount allowance remains
|
|
91661
91636
|
standing \u2014 it authorizes only that amount and nothing else; the result says so plainly.
|
|
91662
|
-
On the real protocol, PSM writes run on sepolia ONLY \u2014 mainnet PSM writes are refused
|
|
91663
|
-
the
|
|
91637
|
+
On the real protocol, PSM writes run on sepolia ONLY \u2014 mainnet PSM writes are refused
|
|
91638
|
+
(the PSM-specific sepolia-only anchor; loan operations are not affected).`,
|
|
91664
91639
|
authorization: `# Authorization \u2014 who signs, and what a signature means
|
|
91665
91640
|
|
|
91666
91641
|
Every fund-moving operation needs TWO things, always in this order:
|
|
@@ -91804,9 +91779,9 @@ no switch, and that is by design.
|
|
|
91804
91779
|
the human approves the card. sepolia = practice funds; mainnet = REAL MONEY.
|
|
91805
91780
|
- NOTHING carries across: positions, vaults, signer bindings, logins are per-network.
|
|
91806
91781
|
A sepolia position does not exist on mainnet and vice versa.
|
|
91807
|
-
-
|
|
91808
|
-
|
|
91809
|
-
|
|
91782
|
+
- Fund-moving loan operations work on BOTH networks \u2014 on mainnet they move REAL money,
|
|
91783
|
+
and every one still requires the user's explicit confirmation plus the signer
|
|
91784
|
+
ceremony. The exception is PSM swaps: sepolia-only, refused on mainnet.
|
|
91810
91785
|
- A pending signing ceremony blocks the switch (finish or decline it first).
|
|
91811
91786
|
- The switch is session-scoped: when the server restarts, the configured default
|
|
91812
91787
|
network returns.
|
|
@@ -91822,9 +91797,8 @@ reality in your next message. The user must never have to ask which world they a
|
|
|
91822
91797
|
- **"Not logged in" on a read** \u2014 authenticated reads NEVER pop the wallet; the remedy is
|
|
91823
91798
|
the same pair: keystore env pair, or "connect my wallet" (\`signer_setup connect\`). An
|
|
91824
91799
|
EXPIRED login refuses the same way \u2014 reconnect on the user's word.
|
|
91825
|
-
- **
|
|
91826
|
-
|
|
91827
|
-
TRUE after a conversational network switch too \u2014 switching never arms writes.
|
|
91800
|
+
- **PSM write refused on mainnet** \u2014 PSM swaps are sepolia-only (a deliberate anchor,
|
|
91801
|
+
not a bug); loan operations work on mainnet. Reads keep working everywhere.
|
|
91828
91802
|
- **"Wrong network" / wants mainnet or sepolia** \u2014 real adapter: \`network_switch\`
|
|
91829
91803
|
(human-confirmed card; nothing carries across networks). Mock: the world is pinned by
|
|
91830
91804
|
config \u2014 no switch exists there.
|
|
@@ -91995,7 +91969,7 @@ function registerGuidePrompts(server) {
|
|
|
91995
91969
|
// src/tools/network-switch.ts
|
|
91996
91970
|
var import_zod8 = require("zod");
|
|
91997
91971
|
function moneyLine(network) {
|
|
91998
|
-
return network === "mainnet" ? "mainnet \u2014 REAL MONEY: fund-moving operations spend real funds
|
|
91972
|
+
return network === "mainnet" ? "mainnet \u2014 REAL MONEY: fund-moving operations spend real funds" : `${network} \u2014 PRACTICE FUNDS (test network: real contracts, no real money)`;
|
|
91999
91973
|
}
|
|
92000
91974
|
function registerNetworkSwitchTool(server, getB, runtime, getSigner) {
|
|
92001
91975
|
registerBoundaryTool(
|
|
@@ -92003,7 +91977,7 @@ function registerNetworkSwitchTool(server, getB, runtime, getSigner) {
|
|
|
92003
91977
|
"network_switch",
|
|
92004
91978
|
{
|
|
92005
91979
|
title: "Show or switch the active network",
|
|
92006
|
-
description: "Which world this server is on \u2014 and switching it by conversation (real adapter). 'status' states the active network and whether money is real. 'switch' moves this session between sepolia (practice funds) and mainnet (REAL MONEY) after an explicit human confirmation; positions, vaults, and signer bindings are per-network and do not carry across.
|
|
91980
|
+
description: "Which world this server is on \u2014 and switching it by conversation (real adapter). 'status' states the active network and whether money is real. 'switch' moves this session between sepolia (practice funds) and mainnet (REAL MONEY) after an explicit human confirmation; positions, vaults, and signer bindings are per-network and do not carry across. Fund-moving operations work on BOTH networks (on mainnet they move REAL money; PSM swaps stay sepolia-only). The switch lasts for this server session only; the configured default returns on restart. After a switch, re-read boundary://info and STATE the new environment to the user.",
|
|
92007
91981
|
inputSchema: {
|
|
92008
91982
|
action: import_zod8.z.enum(["status", "switch"]).describe("status = current world; switch = change network (needs confirmed:true)"),
|
|
92009
91983
|
network: import_zod8.z.string().optional().describe("switch target: sepolia | mainnet"),
|
|
@@ -92021,7 +91995,7 @@ function registerNetworkSwitchTool(server, getB, runtime, getSigner) {
|
|
|
92021
91995
|
lines.push(
|
|
92022
91996
|
`Switchable networks: ${SWITCHABLE_NETWORKS.join(", ")} (action 'switch', confirmed:true after human approval).`,
|
|
92023
91997
|
"A switch changes worlds entirely: positions, vaults, and signer bindings are per-network.",
|
|
92024
|
-
"
|
|
91998
|
+
"Fund-moving operations work on both networks \u2014 on mainnet they move REAL money (PSM swaps: sepolia-only).",
|
|
92025
91999
|
"Session-scoped: the configured default network returns when the server restarts."
|
|
92026
92000
|
);
|
|
92027
92001
|
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
@@ -92052,7 +92026,7 @@ function registerNetworkSwitchTool(server, getB, runtime, getSigner) {
|
|
|
92052
92026
|
FROM: ${from}
|
|
92053
92027
|
TO: ${moneyLine(target)}
|
|
92054
92028
|
- Positions, vaults, and signer bindings are PER-NETWORK: nothing carries across.
|
|
92055
|
-
-
|
|
92029
|
+
- Fund-moving operations WORK on the target network \u2014 on mainnet they move REAL money.
|
|
92056
92030
|
- Session-scoped: the configured default network returns on server restart.
|
|
92057
92031
|
Re-invoke with confirmed: true ONLY after a human has approved this exact switch. Do not set it on your own.`
|
|
92058
92032
|
}
|
|
@@ -92176,7 +92150,7 @@ function registerBoundaryInfoResource(server, getB) {
|
|
|
92176
92150
|
}
|
|
92177
92151
|
|
|
92178
92152
|
// src/server.ts
|
|
92179
|
-
var SERVER_VERSION = "0.
|
|
92153
|
+
var SERVER_VERSION = "0.4.0";
|
|
92180
92154
|
var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else.";
|
|
92181
92155
|
function createServer2(deps) {
|
|
92182
92156
|
const server = new import_mcp2.McpServer(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gvnrdao/dh-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP server for the Diamond Hands protocol — Bitcoin-collateralized UCD lending with human-approved signing (sepolia by default; mainnet
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "MCP server for the Diamond Hands protocol — Bitcoin-collateralized UCD lending with human-approved signing (sepolia practice by default; mainnet fully enabled)",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|