@gvnrdao/dh-mcp 0.5.15 → 0.5.17

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 CHANGED
@@ -53,9 +53,10 @@ overridable by environment variables:
53
53
  | `DH_KEYSTORE_PATH` + `DH_KEYSTORE_PASSWORD` | unset | optional: encrypted keystore for automatic signing (both or neither) |
54
54
 
55
55
  Signing is chosen **by conversation** (`signer_setup` — available on the real adapter):
56
- your own wallet (MetaMask browser popup, or WalletConnect for mobile — scannable QR or
57
- paste-code) or a local encrypted keystore. Safe smart-account and delegation modes are
58
- **mock-only for now** (table below).
56
+ your own wallet (**recommended** — MetaMask browser popup, or WalletConnect for mobile —
57
+ scannable QR or paste-code) or a local encrypted keystore (legacy, opt-in). See
58
+ [Where signing keys live](#where-signing-keys-live). Safe smart-account and delegation
59
+ modes are **mock-only for now** (table below).
59
60
 
60
61
  ## What works where
61
62
 
@@ -83,6 +84,66 @@ refuses legibly, and the user says "connect my wallet" (`signer_setup` action `c
83
84
  on mainnet and move real USDC and UCD, with the named-and-on-chain-verified stablecoin
84
85
  plus the PSM contract's own caps, pause switches and reserves as the bounds.
85
86
 
87
+ ## Where signing keys live
88
+
89
+ **In your wallet — not in this server, and not in your MCP host's config file.** Crypto
90
+ keys cannot be rotated the way an API key can, so the recommended signing mode (and the
91
+ only mode the hosted connector has) never gives the MCP a private key at all.
92
+
93
+ | Mode | Where the key is | What the MCP holds | Status |
94
+ |---|---|---|---|
95
+ | **external** — your own wallet | your wallet (MetaMask, or a mobile wallet over WalletConnect) | your public address — nothing secret | **recommended**; the only mode in the hosted connector |
96
+ | **keystore** — automatic signing | an encrypted (scrypt, ethers V3) keystore file on your machine | the decrypted key, in memory, for as long as the server runs | legacy, opt-in, local builds only |
97
+ | raw `DH_PRIVATE_KEY` env var | plaintext in the host config | the key | **removed** — no longer in the code |
98
+
99
+ ### Wallet signing (external mode)
100
+
101
+ The same model as other wallet-first crypto MCPs: the server prepares the transaction or
102
+ the EIP-712 typed data, and **your wallet signs it**.
103
+
104
+ 1. The MCP builds the transaction and decodes its calldata against a whitelist of
105
+ protocol functions — calldata that does not decode is refused before it ever reaches
106
+ your wallet.
107
+ 2. That decode becomes the approval card, shown on a token-gated approval page that
108
+ hands the request to MetaMask, or as a WalletConnect QR / pairing code for a
109
+ mobile wallet:
110
+ - **Local (stdio / loopback connector):** `http://127.0.0.1:<port>/` (token-gated).
111
+ - **Hosted connector:** `{publicOrigin}/approval/<mountId>/` (token-gated) — the
112
+ connector's own public origin, never loopback.
113
+ 3. You review and sign **in your wallet**; the wallet broadcasts.
114
+ 4. The MCP receives only the transaction hash, then verifies the landed transaction
115
+ matches the approved `to` / `data` / `value` / `chainId` and was sent by your address.
116
+ A mismatch is reported loudly, never silently retried.
117
+ 5. Login is an audience-bound EIP-712 signature through the same wallet.
118
+
119
+ What rests on your machine in this mode: the MCP host config (`~/.claude.json`,
120
+ `claude_desktop_config.json`) holds the launch command and, optionally, the network and
121
+ RPC URL — no key, no seed, no password. `~/.dh-mcp` holds the chosen signer mode and your
122
+ public address. Login session tokens live in process memory only.
123
+
124
+ One stated gap: the BTC-withdrawal EXECUTE step asks the wallet to `personal_sign` a bare
125
+ 32-byte hash built inside the SDK — identical to how diamondhands.credit signs it. The
126
+ approval card says plainly that this hash cannot be decoded, and gives its real expiry
127
+ deadline. Every other request is decoded before you sign.
128
+
129
+ ### Keystore mode (legacy, opt-in)
130
+
131
+ The first signing model, kept for headless local use. The key is encrypted at rest, but
132
+ the running process holds it decrypted, and anyone who can read **both** the keystore
133
+ file and its password has the key. Where the password lives is therefore the whole risk:
134
+
135
+ - **Claude Desktop `.mcpb`** — held by the OS credential store (the field is marked
136
+ sensitive), not written to a config file.
137
+ - **The unlock page** (`signer_setup` → "unlock my keystore") — typed into the local
138
+ loopback page, never written anywhere.
139
+ - **`DH_KEYSTORE_PASSWORD` in an `env` block or `claude mcp add -e …`** — stored **in
140
+ plaintext in the host config**, next to the keystore path. That is exactly the pattern
141
+ this section exists to avoid: do not use it for real funds — use wallet signing.
142
+
143
+ Passwords pasted into chat are refused by design. The hosted connector cannot run keystore
144
+ mode at all: the keystore runtime is not part of that build, and it refuses to boot if
145
+ keystore variables are present.
146
+
86
147
  ## What it solves
87
148
 
88
149
  Diamond Hands is otherwise operated by hand. This server adds a conversational access