dexe-mcp 0.5.4 → 0.5.8

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 (56) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +270 -194
  3. package/SECURITY.md +46 -0
  4. package/dist/config.d.ts +27 -4
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +105 -9
  7. package/dist/config.js.map +1 -1
  8. package/dist/lib/blacklist.d.ts +22 -0
  9. package/dist/lib/blacklist.d.ts.map +1 -0
  10. package/dist/lib/blacklist.js +43 -0
  11. package/dist/lib/blacklist.js.map +1 -0
  12. package/dist/lib/ipfs.d.ts +7 -0
  13. package/dist/lib/ipfs.d.ts.map +1 -1
  14. package/dist/lib/ipfs.js +32 -1
  15. package/dist/lib/ipfs.js.map +1 -1
  16. package/dist/lib/signer.d.ts +17 -4
  17. package/dist/lib/signer.d.ts.map +1 -1
  18. package/dist/lib/signer.js +33 -16
  19. package/dist/lib/signer.js.map +1 -1
  20. package/dist/rpc.d.ts +10 -5
  21. package/dist/rpc.d.ts.map +1 -1
  22. package/dist/rpc.js +18 -10
  23. package/dist/rpc.js.map +1 -1
  24. package/dist/tools/daoDeploy.d.ts.map +1 -1
  25. package/dist/tools/daoDeploy.js +14 -6
  26. package/dist/tools/daoDeploy.js.map +1 -1
  27. package/dist/tools/flow.d.ts +3 -0
  28. package/dist/tools/flow.d.ts.map +1 -1
  29. package/dist/tools/flow.js +29 -14
  30. package/dist/tools/flow.js.map +1 -1
  31. package/dist/tools/getConfig.d.ts +10 -0
  32. package/dist/tools/getConfig.d.ts.map +1 -0
  33. package/dist/tools/getConfig.js +52 -0
  34. package/dist/tools/getConfig.js.map +1 -0
  35. package/dist/tools/index.d.ts.map +1 -1
  36. package/dist/tools/index.js +2 -0
  37. package/dist/tools/index.js.map +1 -1
  38. package/dist/tools/ipfs.d.ts.map +1 -1
  39. package/dist/tools/ipfs.js +437 -16
  40. package/dist/tools/ipfs.js.map +1 -1
  41. package/dist/tools/otc.d.ts.map +1 -1
  42. package/dist/tools/otc.js +28 -6
  43. package/dist/tools/otc.js.map +1 -1
  44. package/dist/tools/proposalBuild.d.ts.map +1 -1
  45. package/dist/tools/proposalBuild.js +11 -2
  46. package/dist/tools/proposalBuild.js.map +1 -1
  47. package/dist/tools/proposalBuildComplex.d.ts.map +1 -1
  48. package/dist/tools/proposalBuildComplex.js +49 -14
  49. package/dist/tools/proposalBuildComplex.js.map +1 -1
  50. package/dist/tools/proposalBuildMore.js +60 -20
  51. package/dist/tools/proposalBuildMore.js.map +1 -1
  52. package/dist/tools/txSend.d.ts +1 -1
  53. package/dist/tools/txSend.d.ts.map +1 -1
  54. package/dist/tools/txSend.js +37 -9
  55. package/dist/tools/txSend.js.map +1 -1
  56. package/package.json +10 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,154 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.8
4
+
5
+ DAO avatar pipeline — root-cause fix + three new composites.
6
+
7
+ ### Avatar bug fixes (frontend rendering)
8
+
9
+ - **`dexe_ipfs_upload_file` now returns a CID v1 base32 string** (`bafy…`) as the primary `cid` field, with the original Pinata response preserved as `cidV0`. The DeXe frontend stores avatar URLs as `https://<cid>.ipfs.4everland.io/<file>`, and that subdomain gateway only resolves v1 — so the pre-0.5.8 server produced dead links every time an agent uploaded an avatar.
10
+ - **Image filenames are normalized to `.jpeg` for any `image/*` content type** (configurable via `normalizeImageExt: false`). Matches what `useCreateDAO` does in the frontend and what `parseAvatarFromIpfsResponse` expects when reading the profile back.
11
+ - **`dexe_ipfs_upload_dao_metadata` auto-converts any incoming `avatarCID` to v1 base32** before composing `avatarUrl`. Callers that previously passed in a v0 `Qm…` (which silently produced a dead link) now get a working URL.
12
+
13
+ ### New tools (+3, total 126 → 129)
14
+
15
+ - **`dexe_ipfs_upload_avatar`** — one-shot composite. Takes base64 image bytes, normalizes the filename to `.jpeg`, pins, converts the CID to v1, and returns the exact `{avatarCID, avatarFileName, avatarUrl}` triple that `dexe_ipfs_upload_dao_metadata` and `dexe_ipfs_update_dao_metadata` accept. Removes a three-step manual chain.
16
+ - **`dexe_dao_generate_avatar`** — generates a deterministic placeholder. Initials of the DAO name over a hash-coloured gradient, emitted as plain SVG (no `<foreignObject>`, no JS) and pinned through Pinata. Same input always produces the same colours, so re-deploys keep the brand. No external image-generation provider involved.
17
+ - **`dexe_ipfs_update_dao_metadata`** — smart "modify DAO profile" helper. Fetches the current DAO descriptionURL JSON, applies only the fields you pass in `overrides` (avatar / name / website / description / socialLinks / documents), re-pins the merged result, and returns the new CID ready to feed into `dexe_proposal_build_modify_dao_profile.newDescriptionURL`. Eliminates the previous footgun where re-uploading metadata meant manually re-specifying every unchanged field — any forgotten field silently disappeared from the profile.
18
+
19
+ ### Recommended modify-profile flow
20
+
21
+ ```text
22
+ 1. dexe_ipfs_upload_avatar → {avatarCID, avatarFileName, avatarUrl}
23
+ (or dexe_dao_generate_avatar)
24
+ 2. dexe_ipfs_update_dao_metadata → newDescriptionURL
25
+ 3. dexe_proposal_build_modify_dao_profile → TxPayload
26
+ 4. dexe_proposal_create → broadcast
27
+ ```
28
+
29
+ ### Supply-chain hygiene
30
+
31
+ - **Closes 4 transitive `npm audit` findings** under `@modelcontextprotocol/sdk@1.29.0`:
32
+ - `fast-uri` <=3.1.0 (high) — path-traversal + host-confusion (GHSA-q3j6-qgpj-74h6, GHSA-v39h-62p7-jpjc)
33
+ - `hono` <4.12.18 (moderate) — six advisories, incl. JSX HTML/CSS injection, JWT validation, cache-key leakage
34
+ - `ip-address` <=10.1.0 (moderate) — XSS in `Address6` HTML-emitting methods (GHSA-v2v4-37r5-5v8g)
35
+ - `express-rate-limit` (moderate)
36
+ - Resolved via `package.json` `overrides`. `@modelcontextprotocol/sdk` pin bumped from `^1.0.0` → `^1.29.0`. No public-API change.
37
+ - **`SECURITY.md`** added — vuln-disclosure policy, scoped threat model, contact email. Now ships in the tarball alongside `LICENSE`.
38
+ - **`.github/FUNDING.yml`** added (GitHub sponsors link).
39
+
40
+ `npm audit --omit=dev` now reports **0 vulnerabilities**.
41
+
42
+ ## 0.5.7
43
+
44
+ Last broadcast sweep: **57 / 57 green** on Polaris (BSC testnet 97), 2026-05-12.
45
+
46
+ ### Swarm coverage — 41 → 57 scenarios
47
+
48
+ - New broadcast-lifecycle scenarios for the three v0.5.6 builder rewrites: `S52-withdraw-treasury-execute`, `S53-apply-to-dao-execute`, `S54-reward-multiplier-execute`. Each runs the wrapper builder → `dexe_proposal_create` custom flow on the swarm fixture DAO and asserts the proposal lands in Voting / SucceededFor / ExecutedFor. Validates the Bug #29 / #30 / #31 fixes end-to-end against on-chain state, not just calldata shape.
49
+ - New broadcast scenarios for the most-used proposal types: `S55-token-transfer-execute`, `S56-blacklist-execute`, `S57-add-expert-execute`. Same build → create → state pattern.
50
+ - Refreshed `S18-withdraw-treasury-build` to pass the now-required `token` argument; refreshed `S31-reward-multiplier-build` to use Polaris's `nftMultiplier` (replacing retired Glacier address) and PRECISION-scaled multipliers (`1.5x => 1.5e25`) per v0.5.6's stricter validator.
51
+ - Replaced retired Glacier fixture with fresh **Polaris** testnet DAO (LINEAR, 50% quorum, deployed 2026-05-12). Sentinel (validator chamber) unchanged. README updated.
52
+
53
+ ### Swarm tooling
54
+
55
+ - **`scripts/swarm/preflight.ts` now counts deposited tokens alongside the wallet balance.** A wallet with funds locked behind in-flight proposals had `ERC20.balanceOf=0` even though its governance power was intact in UserKeeper; the old check aborted nightly runs on a non-issue. Each token row now also reads `UserKeeper.tokenBalance(user, Personal)` from the parallel DAO and adds the deposited surplus to the threshold check. Falls back to wallet-only when the helper call reverts.
56
+ - **`scripts/swarm/nightly.sh` sanitizes the SUMMARY_LINE before posting to public targets.** The orchestrator's machine-greppable summary line ends with the absolute report path, which leaks the operator's filesystem layout when the repo is public. Local stdout still gets the full line; webhook + GitHub-issue posts get a stripped variant (runId + N/M + mode + chainTag, no path).
57
+
58
+ ### Multi-chain config (chain-mixup guard)
59
+
60
+ - New optional env vars `DEXE_RPC_URL_TESTNET` + `DEXE_RPC_URL_MAINNET` + `DEXE_DEFAULT_CHAIN_ID`. Configure one or both; the MCP can now route reads and broadcasts to whichever chain a tool call requests, without an MCP restart.
61
+ - Write/composite tools accept an optional `chainId` arg: `dexe_tx_send`, `dexe_tx_status`, `dexe_dao_build_deploy`, `dexe_proposal_create`, `dexe_proposal_vote_and_execute`, `dexe_otc_dao_open_sale`, `dexe_otc_buyer_buy`, `dexe_otc_buyer_claim_all`. Omitting the arg uses the default chain. Requesting a chain with no configured RPC fails fast with a clear error before any tx is built or signed.
62
+ - Legacy `DEXE_RPC_URL` + `DEXE_CHAIN_ID` still works and stacks with the new vars — the legacy entry registers as one more chain in the pool. When `DEXE_CHAIN_ID` is omitted, the chain id is best-effort inferred from the URL hostname.
63
+ - New `dexe_get_config` diagnostic tool: returns the resolved chain set, the default chain, signer status, and IPFS/subgraph configuration. Call it at session start to orient before any write.
64
+ - Provider and signer are now per-chain caches (`RpcProvider`, `SignerManager`) so multi-chain usage doesn't churn through new connections.
65
+
66
+ ## 0.5.6
67
+
68
+ Three Stage A mainnet bug fixes — all surfaced on `DexeClientDemo`
69
+ (BSC `0xCAe3…5B41`) and tracked as bugs #29 / #30 / #31.
70
+
71
+ ### Fixed
72
+
73
+ - **Bug #30 — `dexe_proposal_build_withdraw_treasury` emitted wrong
74
+ selector.** Builder targeted `GovPool.withdraw(address,uint256,uint256[])`
75
+ (selector `0xfb8c5ef0`), which is the user-deposit-withdraw function on
76
+ GovPool, not a treasury transfer. `proposal_create` rejected it with
77
+ `Gov: invalid internal data`. Rewritten to emit one external
78
+ `ERC20.transfer(receiver, amount)` action per token and/or one
79
+ `ERC721.transferFrom(govPool, receiver, tokenId)` action per NFT —
80
+ treasury sits in the GovPool address as a regular ERC20/721 balance, so
81
+ withdrawal is just a plain external token call. New schema: drop the
82
+ single `(amount, nftIds)` shape; supply `token`+`amount` and/or
83
+ `nftAddress`+`nftIds`. At least one must be non-empty.
84
+
85
+ - **Bug #29 — `apply_to_dao` / `token_transfer` / `withdraw_treasury` had
86
+ no blacklist precheck.** `ERC20Gov.transfer` reverts on a blacklisted
87
+ recipient, and a proposal that passes voting then fails `execute()` sits
88
+ in `SucceededFor` permanently with no recovery. When `DEXE_RPC_URL` is
89
+ set, the three builders now `isBlacklisted(receiver)` against the token
90
+ before encoding and refuse to build with a clear error if the recipient
91
+ is blacklisted. When the token isn't ERC20Gov (call reverts) or RPC is
92
+ absent, the precheck soft-skips with a note in the result detail —
93
+ build always proceeds. New helper: `src/lib/blacklist.ts`.
94
+
95
+ - **Bug #31 — `dexe_proposal_build_reward_multiplier` mint/change_token
96
+ reverted silently.** `ERC721_MULTIPLIER_ABI` declared `duration` as
97
+ `uint256`, but `ERC721Multiplier.mint(address,uint256,uint64,string)`
98
+ uses `uint64`. ethers derives the selector from the canonical signature,
99
+ so the wrong-typed arg produced a different selector → no-match →
100
+ silent revert with no returndata when GovPool.execute called into the
101
+ multiplier (the contract has no `MAX_MULTIPLIER` check, so the original
102
+ scale-mismatch hypothesis was wrong). Fixed the ABI to `uint64
103
+ duration`. Builder now also rejects `multiplier=0`, multiplier values
104
+ below `PRECISION/100` (likely forgot the 1e25 scale), `duration > 2^64
105
+ − 1`, and `duration=0` for mint. Tool description spells out
106
+ `PRECISION = 1e25` and `duration = seconds (uint64)`.
107
+
108
+ ## 0.5.5
109
+
110
+ Doc + RPC hygiene. Two issues surfaced after publishing 0.5.4:
111
+
112
+ ### Fixed
113
+
114
+ - **Internal RPC URL leaked into examples.** Three files referenced
115
+ `https://mbsc1.dexe.io/rpc`, an internal DeXe endpoint not intended for
116
+ public traffic. Replaced with the canonical public BSC RPC
117
+ `https://bsc-dataseed.binance.org` in:
118
+ - `docs/ENVIRONMENT.md` (3 occurrences — quick-start block, env table
119
+ example, BSC mainnet chain config)
120
+ - `tests/swarm/README.md` (`SWARM_RPC_URL_MAINNET` example)
121
+ - `tests/compat/FORM-GUIDE.md` (network-capture hint)
122
+ - `.env.example` (2 occurrences — `DEXE_RPC_URL` core block,
123
+ `SWARM_RPC_URL_MAINNET` swarm block)
124
+ - `scripts/swarm/test-mainnet-deploy.mjs` + `test-offchain-mainnet.mjs`
125
+ (now read `process.env.DEXE_RPC_URL` first, fall back to public BSC RPC)
126
+ Existing installs that copy-pasted the snippet still work — both URLs
127
+ serve BSC mainnet — but the public one carries no internal-infra hint.
128
+ - **README links broken on npmjs.com.** Relative links like
129
+ `./docs/TOOLS.md` work on GitHub but npm does NOT resolve them against the
130
+ repo URL — npm renders the README at the package home and a relative link
131
+ resolves to a non-existent path on `npmjs.com`. Converted all in-README
132
+ links to absolute GitHub URLs:
133
+ `./docs/X.md` → `https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/X.md`
134
+ Same pattern applied to the swarm-runbook + LICENSE links.
135
+
136
+ ### Scope of exposure
137
+
138
+ Verified via `npm pack --dry-run`: the internal URL was **never shipped in
139
+ any npm tarball**. `package.json`'s `files` array only includes `dist/`,
140
+ `README.md`, `CHANGELOG.md`, `FUTURE.md`, and `.mcp.example.json` — all of
141
+ which used the public BSC RPC. The leak was confined to GitHub-only
142
+ artifacts (`docs/`, `tests/`, gitignored `.env.example` + swarm probe
143
+ scripts). No npm-deprecation needed.
144
+
145
+ ### Notes
146
+
147
+ - Git history retains the original URL — full history rewrite via
148
+ `git filter-repo` was considered and declined: rewrites every commit SHA,
149
+ breaks PR refs and external clones, and the URL is an endpoint, not a
150
+ credential. Forward-fix is sufficient.
151
+
3
152
  ## 0.5.4
4
153
 
5
154
  Off-chain backend + DAO deploy hardening. Two latent bugs surfaced during