dexe-mcp 0.11.1 → 0.15.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/README.md +36 -7
  3. package/dexe-plugin/skills/dexe-create-dao/SKILL.md +99 -0
  4. package/dexe-plugin/skills/dexe-create-proposal/SKILL.md +84 -0
  5. package/dexe-plugin/skills/dexe-otc/SKILL.md +73 -0
  6. package/dexe-plugin/skills/dexe-setup/SKILL.md +108 -0
  7. package/dexe-plugin/skills/dexe-vote-execute/SKILL.md +64 -0
  8. package/dist/cli/init.d.ts +7 -0
  9. package/dist/cli/init.d.ts.map +1 -1
  10. package/dist/cli/init.js +85 -4
  11. package/dist/cli/init.js.map +1 -1
  12. package/dist/cli/skills.d.ts +12 -0
  13. package/dist/cli/skills.d.ts.map +1 -0
  14. package/dist/cli/skills.js +34 -0
  15. package/dist/cli/skills.js.map +1 -0
  16. package/dist/config.d.ts +21 -0
  17. package/dist/config.d.ts.map +1 -1
  18. package/dist/config.js +45 -3
  19. package/dist/config.js.map +1 -1
  20. package/dist/diag/checks.d.ts.map +1 -1
  21. package/dist/diag/checks.js +38 -0
  22. package/dist/diag/checks.js.map +1 -1
  23. package/dist/env/schema.d.ts +21 -0
  24. package/dist/env/schema.d.ts.map +1 -1
  25. package/dist/env/schema.js +21 -0
  26. package/dist/env/schema.js.map +1 -1
  27. package/dist/index.js +30 -3
  28. package/dist/index.js.map +1 -1
  29. package/dist/lib/preflight.d.ts +133 -0
  30. package/dist/lib/preflight.d.ts.map +1 -0
  31. package/dist/lib/preflight.js +239 -0
  32. package/dist/lib/preflight.js.map +1 -0
  33. package/dist/lib/proposalBuilders.d.ts +50 -0
  34. package/dist/lib/proposalBuilders.d.ts.map +1 -0
  35. package/dist/lib/proposalBuilders.js +311 -0
  36. package/dist/lib/proposalBuilders.js.map +1 -0
  37. package/dist/lib/stateStore.d.ts +63 -0
  38. package/dist/lib/stateStore.d.ts.map +1 -0
  39. package/dist/lib/stateStore.js +128 -0
  40. package/dist/lib/stateStore.js.map +1 -0
  41. package/dist/tools/daoCreate.d.ts +6 -0
  42. package/dist/tools/daoCreate.d.ts.map +1 -0
  43. package/dist/tools/daoCreate.js +155 -0
  44. package/dist/tools/daoCreate.js.map +1 -0
  45. package/dist/tools/daoDeploy.d.ts +394 -0
  46. package/dist/tools/daoDeploy.d.ts.map +1 -1
  47. package/dist/tools/daoDeploy.js +393 -422
  48. package/dist/tools/daoDeploy.js.map +1 -1
  49. package/dist/tools/doctor.d.ts.map +1 -1
  50. package/dist/tools/doctor.js +15 -0
  51. package/dist/tools/doctor.js.map +1 -1
  52. package/dist/tools/flow.d.ts +13 -2
  53. package/dist/tools/flow.d.ts.map +1 -1
  54. package/dist/tools/flow.js +97 -16
  55. package/dist/tools/flow.js.map +1 -1
  56. package/dist/tools/gate.d.ts +28 -0
  57. package/dist/tools/gate.d.ts.map +1 -0
  58. package/dist/tools/gate.js +295 -0
  59. package/dist/tools/gate.js.map +1 -0
  60. package/dist/tools/index.d.ts.map +1 -1
  61. package/dist/tools/index.js +14 -1
  62. package/dist/tools/index.js.map +1 -1
  63. package/dist/tools/operationalContext.d.ts +6 -0
  64. package/dist/tools/operationalContext.d.ts.map +1 -0
  65. package/dist/tools/operationalContext.js +122 -0
  66. package/dist/tools/operationalContext.js.map +1 -0
  67. package/dist/tools/proposalBuildMore.d.ts +69 -0
  68. package/dist/tools/proposalBuildMore.d.ts.map +1 -1
  69. package/dist/tools/proposalBuildMore.js +3 -2
  70. package/dist/tools/proposalBuildMore.js.map +1 -1
  71. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,145 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.0 — 2026-07-04
4
+
5
+ ### One-command install — Claude Code plugin + zero-config reads
6
+
7
+ Onboarding overhaul: an average user should install dexe-mcp from inside Claude
8
+ with no terminal, no JSON editing, and no env vars until they actually want to
9
+ write. No new MCP tools (still 156); this is packaging, CLI, and docs.
10
+
11
+ - **Claude Code plugin + marketplace.** New `.claude-plugin/marketplace.json`
12
+ (repo root) and `dexe-plugin/` (`.claude-plugin/plugin.json` + `mcp.json` +
13
+ the shipped skills). Users install in-session:
14
+
15
+ ```
16
+ /plugin marketplace add edward-arinin-web-dev/dexe-mcp
17
+ /plugin install dexe@dexe-mcp
18
+ ```
19
+
20
+ The plugin registers the MCP server (launched via `npx -y dexe-mcp@0.15.0`,
21
+ version pinned) and auto-discovers the governance skills — namespaced
22
+ `dexe:<skill>`. Both manifests pass `claude plugin validate`.
23
+ - **Zero-config reads (server-side public-RPC fallback).** When no RPC is
24
+ configured, `loadConfig()` seeds public BSC endpoints (chains 56 + 97, default
25
+ **56**) so `dao_info` / `read_treasury` / etc. work out of the box — the plugin
26
+ ships **no env**, so there is no `.claude.json`-shadow trap. Public dataseed
27
+ nodes rate-limit and lack archive history: a startup banner + a
28
+ `chain.publicRpcFallback` doctor advisory nudge users to set their own RPC.
29
+ Opt out with `DEXE_DISABLE_PUBLIC_RPC=1`. `DexeConfig` gains
30
+ `usingPublicRpcFallback`. (A private key set without an RPC now signs against
31
+ the public fallback rather than erroring; guards still apply — set your own RPC
32
+ for reliable broadcasting.)
33
+ - **Project `.env` reaches the server (writes path).** `src/index.ts` now loads
34
+ the **project (cwd) `.env` first**, then the package-relative `.env`. This is
35
+ what makes `/dexe-setup` (which edits the project `.env`) reach a server
36
+ launched via `npx` from the plugin, whose package dir sits in the npx cache.
37
+ - **`npx dexe-mcp skills` — skills-only, no env interview.** New non-interactive
38
+ subcommand (`--global` for `~/.claude/skills`), reusing `installSkills()`. And
39
+ `init` now opens with a top-level choice — *just skills* / *full setup* /
40
+ *both* (or `init --skills-only`) — so it never dives into the env wizard
41
+ unasked. Fixes the reported "I only wanted the skills" onboarding surprise.
42
+ - **Skills relocated** to `dexe-plugin/skills/` (single source of truth for both
43
+ the plugin and the CLI copy). `package.json` `files` updated accordingly.
44
+ - **Docs.** README leads with a no-terminal **Install in Claude Code** block;
45
+ new [`docs/INSTALL.md`](docs/INSTALL.md) (non-technical, plugin-first);
46
+ `SETUP.md` / `SKILLS.md` / `ENVIRONMENT.md` updated for the plugin path, the
47
+ `skills` subcommand, the public-RPC fallback, and the project-`.env` load.
48
+
49
+ ## 0.14.0 — 2026-07-04
50
+
51
+ ### Persistent state + `dexe_context`
52
+
53
+ Phase 3 of the reliability/token plan: stop starting every session from zero.
54
+
55
+ - **`dexe_context` (new tool; core profile; +1 → 156 tools).** One read that
56
+ orients an agent: signer + mode, active/configured chains, env readiness, and
57
+ the persisted operational state — DAOs deployed and proposals broadcast in
58
+ prior sessions — plus deposited voting power in the most recent DAO. Server
59
+ `instructions` now say to call it first.
60
+ - **Persistent state store** (`src/lib/stateStore.ts`). Versioned JSON at
61
+ `DEXE_STATE_PATH` (default `~/.dexe-mcp/state.json`), atomic write (temp +
62
+ rename), tolerant load (missing/corrupt/newer → empty, never throws).
63
+ `dexe_dao_create` auto-records the deployed DAO and `dexe_proposal_create`
64
+ auto-records a broadcast proposal — both best-effort (a state-write error
65
+ never breaks a broadcast).
66
+ - **`DEXE_STATE_PATH` env** added to `ENV_SPEC`, `loadConfig()`, `.env.example`,
67
+ and `docs/ENVIRONMENT.md`. `dexe_doctor` gains a writable-path check for it.
68
+ - **Tests** — `tests/lib/stateStore.test.ts` (atomic write, dedupe, corrupt/
69
+ version-mismatch tolerance, wallet labels); `gate.test.ts` updated to 156 and
70
+ asserts `dexe_context` in the default profile.
71
+ - Skills updated to start with `dexe_context`.
72
+
73
+ ## 0.13.0 — 2026-07-04
74
+
75
+ ### Toolset profiles — slim default (BREAKING)
76
+
77
+ Phase 2 of the reliability/token plan: cut the per-session `tools/list` cost by
78
+ gating which tools register.
79
+
80
+ - **`DEXE_TOOLSETS` gating** (`src/tools/gate.ts`). Named profiles — `core`,
81
+ `proposals`, `read`, `vote`, `governor`, `dev`, `full` — select which of the
82
+ 155 tools load. `TOOLSETS` maps each profile to an exact tool-name set; the
83
+ union of the six named sets equals the full surface (asserted in tests), so
84
+ every tool is reachable under some profile. Applied as a one-line proxy wrap
85
+ in `registerAll()` — the 30+ register files are unchanged. A typo/unknown set
86
+ name falls back to `full` (never silently strips).
87
+ - **BREAKING: default is now `core,proposals`** (~71 tools), not all 155.
88
+ Measured `tools/list`: full **205 KB** → default **111 KB (−46%)**; the
89
+ max-slim `DEXE_TOOLSETS=core` is **48 KB (−77%)**, viable because
90
+ `dexe_dao_create` / `dexe_proposal_create` cover the common flows server-side.
91
+ See [MIGRATION.md](docs/MIGRATION.md#012x--0130--slim-default-toolset-breaking).
92
+ - **`DEXE_TOOLSETS` env** added to `ENV_SPEC`, `loadConfig()`, `.env.example`,
93
+ and `docs/ENVIRONMENT.md`. `dexe_doctor` now reports the active profile,
94
+ loaded-tool count, and the `full` restore hint. Startup stderr banner states
95
+ the active profile.
96
+ - **Expanded server `instructions`** (~700 chars): prefer the composite flow
97
+ tools, approve UserKeeper not GovPool, testnet-first deploys, the toolsets
98
+ hint, and the shipped-skills hint.
99
+ - **Tests** — `tests/tools/gate.test.ts`: per-profile resolution, union==155,
100
+ every set-name is a real tool, default subset assertions, and a real
101
+ in-memory `tools/list` size measurement.
102
+ - Note: the plan's "slim `dexe_compile` schema" item was moot — the current
103
+ `dexe_compile` input schema is already a single field (the 11 KB/49-field
104
+ figure was stale). The token win is the gating above.
105
+
106
+ ## 0.12.0 — 2026-07-03
107
+
108
+ ### Flow-first facade + preflight guards + shipped skills
109
+
110
+ Phase 1 of the flow-reliability plan: "create a DAO" / "create proposal X" is now
111
+ **one tool call** with server-side validation, and the recurring failure modes are
112
+ encoded as guards + installable skills instead of re-derived each session.
113
+
114
+ - **`dexe_dao_create` (new composite tool)** — one-call DAO deploy: uploads DAO
115
+ profile metadata to IPFS, builds `PoolFactory.deployGovPool` (reusing the exact
116
+ predicted-address wiring / settings auto-expand / executorDescription upload
117
+ from `dexe_dao_build_deploy`, now extracted to a shared `buildDeployGovPool`),
118
+ pre-flights the four silent-revert modes, then signs+broadcasts (or returns the
119
+ payload). Validate on BSC testnet (chain 97). Tool count 154 → **155**.
120
+ - **`dexe_proposal_create` extended to catalog types** — `proposalType` now
121
+ accepts `token_transfer`, `withdraw_treasury`, `change_voting_settings`,
122
+ `add_expert`, `remove_expert`, `token_distribution`, `token_sale`, and
123
+ `custom_abi` (inputs passed in `params`); the tool builds correct calldata +
124
+ IPFS metadata server-side via a shared builder registry
125
+ (`src/lib/proposalBuilders.ts`, byte-parity-tested). Any other catalog type
126
+ returns an actionable error naming its dedicated `dexe_proposal_build_*` tool.
127
+ - **Preflight guard library** (`src/lib/preflight.ts`) — named checks with
128
+ remediation for the 10 documented failure modes: canonical proposal-metadata
129
+ zod shape, approve-UserKeeper-not-GovPool, deposited-power vs votingPower,
130
+ locked-tokens-between-proposals, deploy cap>minted / LINEAR initData /
131
+ non-zero userKeeper asset / mainnet treasury remainder, single-sourced
132
+ ProposalState ordering, avatar-is-JPEG, off-chain type/quorum, blacklist
133
+ recipient. Wired into `dexe_proposal_create` and `dexe_dao_create`.
134
+ - **Shipped skills** (`skills/` → published in the npm package) —
135
+ `dexe-create-dao`, `dexe-create-proposal`, `dexe-vote-execute`, `dexe-otc`,
136
+ `dexe-setup`: exact tool-sequence recipes with the relevant failure modes and
137
+ the chain-97-first rule. `npx dexe-mcp init` now offers to install them into
138
+ `./.claude/skills` (project) or `~/.claude/skills` (global), idempotently. New
139
+ [`docs/SKILLS.md`](docs/SKILLS.md).
140
+ - **Tests** — `tests/lib/preflight.test.ts` (per-guard) and
141
+ `tests/lib/proposalBuilders.test.ts` (calldata byte-parity + registry coverage).
142
+
3
143
  ## 0.11.1 — 2026-07-03
4
144
 
5
145
  ### OTC date clarity (UTC)
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <a href="https://nodejs.org"><img alt="node" src="https://img.shields.io/node/v/dexe-mcp.svg?style=flat-square&labelColor=0b0f1e&color=E07AFF"></a>
10
10
  <a href="https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/npm/l/dexe-mcp.svg?style=flat-square&labelColor=0b0f1e&color=FFC878"></a>
11
11
  <a href="https://modelcontextprotocol.io"><img alt="MCP-compatible" src="https://img.shields.io/badge/MCP-compatible-9BB4FF?style=flat-square&labelColor=0b0f1e"></a>
12
- <a href="https://github.com/edward-arinin-web-dev/dexe-mcp"><img alt="tools" src="https://img.shields.io/badge/tools-154-7CF2D1?style=flat-square&labelColor=0b0f1e"></a>
12
+ <a href="https://github.com/edward-arinin-web-dev/dexe-mcp"><img alt="tools" src="https://img.shields.io/badge/tools-156-7CF2D1?style=flat-square&labelColor=0b0f1e"></a>
13
13
  <a href="https://github.com/edward-arinin-web-dev/dexe-mcp"><img alt="proposal types" src="https://img.shields.io/badge/proposal--types-33-E07AFF?style=flat-square&labelColor=0b0f1e"></a>
14
14
  </p>
15
15
 
@@ -22,7 +22,8 @@
22
22
  </p>
23
23
 
24
24
  <p align="center">
25
- <a href="#quickstart"><b>Quickstart</b></a> &nbsp;·&nbsp;
25
+ <a href="#install-in-claude-code-no-terminal"><b>Install</b></a> &nbsp;·&nbsp;
26
+ <a href="#quickstart">Quickstart</a> &nbsp;·&nbsp;
26
27
  <a href="#what-you-can-build">What you can build</a> &nbsp;·&nbsp;
27
28
  <a href="#built-for-whats-next">Built for what's next</a> &nbsp;·&nbsp;
28
29
  <a href="#tool-catalog">Tool catalog</a> &nbsp;·&nbsp;
@@ -32,6 +33,27 @@
32
33
 
33
34
  ---
34
35
 
36
+ ## Install in Claude Code (no terminal)
37
+
38
+ Two lines, typed inside Claude Code. No npm, no JSON to edit, no keys:
39
+
40
+ ```
41
+ /plugin marketplace add edward-arinin-web-dev/dexe-mcp
42
+ /plugin install dexe@dexe-mcp
43
+ ```
44
+
45
+ Then just ask:
46
+
47
+ > *"Show the treasury of `0x…` on BSC."*
48
+
49
+ Reads work with **zero setup** — the server falls back to public BSC RPC out of the box, and the governance skills (create DAO, create proposal, vote & execute, OTC) install with the plugin.
50
+
51
+ **Want to create DAOs or proposals, or broadcast transactions?** Type **`/dexe-setup`** and Claude walks you through adding your keys (a Pinata token for IPFS, a wallet for signing) — one guided step, nothing to hand-edit.
52
+
53
+ > Using **Cursor, ChatGPT, or another MCP client**, or prefer the terminal? → [**docs/INSTALL.md**](./docs/INSTALL.md)
54
+
55
+ ---
56
+
35
57
  ## The shift
36
58
 
37
59
  For a decade, DAOs lived behind dashboards. Every action was a click. Every read was a tab. Every coordination loop needed a human at the keyboard.
@@ -40,7 +62,7 @@ That era is ending.
40
62
 
41
63
  LLMs can now reason about voting power, weigh proposals against a mandate, draft calldata, simulate execution, and ask your wallet to sign — **continuously, across every DAO you care about, all at once.** What was a UI is becoming a conversation. What was a treasurer's spreadsheet is becoming an always-on agent.
42
64
 
43
- **`dexe-mcp` is the substrate that makes it real for the DeXe stack — and now for external OpenZeppelin Governor DAOs as well.** One MCP server. 154 typed tools across 19 groups. Every flow the DeXe frontend exposes — plus a generic `dexe_gov_*` surface targeting Uniswap, Compound, and Optimism.
65
+ **`dexe-mcp` is the substrate that makes it real for the DeXe stack — and now for external OpenZeppelin Governor DAOs as well.** One MCP server. 156 typed tools across 19 groups. Every flow the DeXe frontend exposes — plus a generic `dexe_gov_*` surface targeting Uniswap, Compound, and Optimism.
44
66
 
45
67
  | | What you get |
46
68
  |-----|------|
@@ -87,6 +109,8 @@ The next generation of DAOs will be **operated by language, not by clicks.**
87
109
 
88
110
  ## Quickstart
89
111
 
112
+ > **In Claude Code?** Skip this — use the [two-line plugin install](#install-in-claude-code-no-terminal) above. The steps below are for **other MCP clients** (Cursor, ChatGPT, custom agents) and terminal/manual setups. Reads need no env at all; env is only for IPFS uploads and broadcasting.
113
+
90
114
  **Fastest path — wizard + diagnostic:**
91
115
 
92
116
  ```bash
@@ -194,7 +218,8 @@ All optional. Tools that need a missing variable fail with a clear, actionable m
194
218
 
195
219
  Full docs in [`docs/`](https://github.com/edward-arinin-web-dev/dexe-mcp/tree/main/docs):
196
220
 
197
- - [**`docs/TOOLS.md`**](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/TOOLS.md) — complete catalog of all 154 tools, grouped, with one-line descriptions and required envs.
221
+ - [**`docs/TOOLS.md`**](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/TOOLS.md) — complete catalog of all 156 tools, grouped, with one-line descriptions and required envs.
222
+ - [**`docs/SKILLS.md`**](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/SKILLS.md) — shipped Claude Code skills (create-dao / create-proposal / vote-execute / otc / setup) and how `npx dexe-mcp init` installs them.
198
223
  - [**`docs/GOVERNOR.md`**](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/GOVERNOR.md) — external OpenZeppelin / Bravo Governor surface (Uniswap, Compound, Optimism). Family branching, fixture map, paste-able JSON examples, Tally parity harness.
199
224
  - [**`docs/WALLETCONNECT.md`**](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/WALLETCONNECT.md) — `walletconnect` signer mode: phone-approved broadcast with no hot key. Phase A (config) + Phase B (live relay, `dexe_wc_connect` / `dexe_wc_disconnect`, per-tx phone approval) shipped in v0.7.0, validated end-to-end with a live MetaMask-mobile round-trip on BSC testnet.
200
225
  - [**`docs/USAGE.md`**](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/USAGE.md) — 10 worked examples (deploy DAO, create/vote/execute proposals, delegate, validator chamber, decode calldata, off-chain proposals, multicall batching). Copy-pasteable JSON.
@@ -207,7 +232,11 @@ Full docs in [`docs/`](https://github.com/edward-arinin-web-dev/dexe-mcp/tree/ma
207
232
 
208
233
  ## Tool catalog
209
234
 
210
- **154 tools, 19 groups.** Run `dexe_proposal_catalog` at runtime for the live proposal-type map. Full per-tool reference → [`docs/TOOLS.md`](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/TOOLS.md).
235
+ **156 tools, 19 groups.** Run `dexe_proposal_catalog` at runtime for the live proposal-type map. Full per-tool reference → [`docs/TOOLS.md`](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/TOOLS.md).
236
+
237
+ > **Toolset profiles (v0.13.0):** a default session loads a slim **~72 tools** (`DEXE_TOOLSETS=core,proposals`), not all 156 — cutting `tools/list` ~46%. Add profiles (`read`, `vote`, `governor`, `dev`) or set `DEXE_TOOLSETS=full` to restore everything; `DEXE_TOOLSETS=core` is the deepest cut (~76%). `dexe_doctor` shows the active profile. See [TOOLS.md § Toolset profiles](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/TOOLS.md#toolset-profiles).
238
+ >
239
+ > **Persistent context (v0.14.0):** `dexe_context` (call first) returns your signer, active chain, env readiness, and the DAOs/proposals recorded in prior sessions (state at `~/.dexe-mcp/state.json`, override `DEXE_STATE_PATH`).
211
240
 
212
241
  | Group | # | What it gives you |
213
242
  |-------|---|------|
@@ -215,13 +244,13 @@ Full docs in [`docs/`](https://github.com/edward-arinin-web-dev/dexe-mcp/tree/ma
215
244
  | **Contract introspection** | 10 | Ask the protocol about itself — list contracts, fetch ABIs, look up selectors, read NatSpec, view source, decode arbitrary calldata or full proposal payloads. The agent's reverse-engineer toolkit. |
216
245
  | **DAO reads** | 20 | Everything you'd see on a DAO dashboard, returned as JSON — `dao_info`, predicted helper addresses, proposal state/list/voters, voting power, treasury, settings, validators, staking, distributions, privacy policy, plus `dexe_proposal_risk_assess` (treasury-safety risk readout). |
217
246
  | **IPFS** | 9 | Pinata uploads for files / avatars / DAO + proposal metadata, smart metadata updates, deterministic identicon generation, gateway-fallback fetch, CID computation without uploading. |
218
- | **DAO deploy** | 1 | `dexe_dao_build_deploy` — encodes the full nested `PoolFactory.deployGovPool` struct with predicted helper addresses pre-wired. From idea to a live DAO in one signed tx. |
247
+ | **DAO deploy** | 2 | `dexe_dao_create` — one-call composite: DAO profile → IPFS → deploy with the four revert-guards pre-flighted, signs when configured. `dexe_dao_build_deploy` — the lower-level encoder for the full nested `PoolFactory.deployGovPool` struct with predicted helper addresses pre-wired. |
219
248
  | **Proposal catalog + primitives** | 5 | `dexe_proposal_catalog` enumerates **all 33** proposal types with metadata + gating. Primitives `_build_external`, `_build_internal`, `_build_custom_abi`, `_build_offchain` cover anything not in a named wrapper. |
220
249
  | **External proposal wrappers** | 20 | Named builders for every common action: token transfer / distribution / sale (single + multi-tier), treasury withdraw, validators, experts, staking tier, math model, blacklist, reward multiplier, apply to DAO, modify profile, change voting settings, new proposal type, whitelist, and more. |
221
250
  | **Internal validator wrappers** | 4 | Validator-chamber proposals: `_change_validator_balances`, `_change_validator_settings`, `_monthly_withdraw`, `_offchain_internal_proposal`. |
222
251
  | **Off-chain backend** | 8 | Full DeXe-backend integration — nonce + SIWE login, off-chain proposal creation (single-option / multi-option / for-against / settings), off-chain vote + cancel. |
223
252
  | **Vote / stake / delegate / execute / claim** | 26 | Every direct EOA write on `GovPool` and `Validators` — deposit, vote, delegate, undelegate, execute, claim rewards, micropool rewards, staking flows, token-sale buy/claim/vesting, distribution claim, NFT multiplier lock/unlock, privacy policy signing, multicall. |
224
- | **Composite flows + diagnostics** | 6 | High-level flows for power users, plus server self-check: `_proposal_create`, `_proposal_vote_and_execute`, `_tx_send`, `_tx_status`, `_get_config`, `_doctor`. Signing tools opt-in via `DEXE_PRIVATE_KEY`. |
253
+ | **Composite flows + diagnostics** | 7 | High-level flows + orientation: `_context` (call first — signer/chain/known-DAOs from prior sessions), `_proposal_create`, `_proposal_vote_and_execute`, `_tx_send`, `_tx_status`, `_get_config`, `_doctor`. Signing tools opt-in via `DEXE_PRIVATE_KEY`. |
225
254
  | **Subgraph reads** | 7 | The Graph queries: DAO list, members, experts, validator list, user activity, delegation map, OTC sale tiers. Decentralized-network endpoints + RPC fallback. |
226
255
  | **Merkle utility** | 2 | `dexe_merkle_build`, `dexe_merkle_proof` — OZ `StandardMerkleTree`-compatible. For whitelisted sales and airdrops. |
227
256
  | **OTC composites** | 4 | Full project-owner + buyer flows over `TokenSaleProposal`: open multi-tier sale, check buyer status, buy native or with merkle proof, claim vested payouts. See [`docs/OTC.md`](https://github.com/edward-arinin-web-dev/dexe-mcp/blob/main/docs/OTC.md). |
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: dexe-create-dao
3
+ description: |
4
+ Deploy a new DeXe DAO with the one-call `dexe_dao_create` composite. Covers the
5
+ exact param recipe, the decimal conventions, and the four deploy gotchas that
6
+ silently revert (cap>minted, LINEAR initData, non-zero userKeeper asset, mainnet
7
+ treasury remainder). Use when the user says "create/deploy a DAO".
8
+ ---
9
+
10
+ # dexe-create-dao
11
+
12
+ Deploy a DeXe governance DAO in **one tool call** — `dexe_dao_create` handles
13
+ avatar → DAO IPFS metadata → `PoolFactory.deployGovPool` (predicted-address
14
+ wiring, 1→5 settings auto-expand, executorDescription upload) → broadcast.
15
+
16
+ ## Golden rule: testnet first
17
+
18
+ **Validate on BSC testnet (chain 97).** Mainnet `deployGovPool` is broken
19
+ upstream (`require(false)`). Never spend mainnet BNB on a deploy without the
20
+ user explicitly asking. Pass `chainId: 97`.
21
+
22
+ ## Recipe
23
+
24
+ 0. **Orient:** call `dexe_context` first — it shows the signer, active chain,
25
+ env readiness, and DAOs you already deployed (so you don't re-create one).
26
+ 1. **Confirm chain + signer:** `dexe_get_config` (or the `dexe_context` output).
27
+ Ensure the active/target chain is 97 and `DEXE_PINATA_JWT` is set (required
28
+ for metadata upload).
29
+ 2. **(Optional) avatar:** `dexe_dao_generate_avatar` or `dexe_ipfs_upload_avatar`
30
+ → take the returned `cid` as `avatarCID`. Must be a **real JPEG**, not SVG
31
+ bytes named `.jpeg` (the frontend gateway rejects the mismatch).
32
+ 3. **Create:** call `dexe_dao_create` once. `deployer` defaults to the signer.
33
+
34
+ ```jsonc
35
+ dexe_dao_create({
36
+ chainId: 97,
37
+ daoName: "Aurora Collective",
38
+ daoDescription: "A community treasury DAO.", // markdown → slate, uploaded for you
39
+ websiteUrl: "https://aurora.example",
40
+ socialLinks: [["twitter", "https://x.com/aurora"]],
41
+ avatarCID: "bafy…", // optional
42
+ params: {
43
+ settingsParams: {
44
+ proposalSettings: [{ // pass ONE → auto-expands to 5
45
+ earlyCompletion: true,
46
+ delegatedVotingAllowed: false, // INVERTED: false = delegation ALLOWED
47
+ validatorsVote: false,
48
+ duration: "86400", // seconds (1 day)
49
+ durationValidators: "86400",
50
+ executionDelay: "0",
51
+ quorum: "500000000000000000000000000", // 25-dec wei = 50%
52
+ quorumValidators: "500000000000000000000000000",
53
+ minVotesForVoting: "1000000000000000000", // 18-dec wei = 1 token
54
+ minVotesForCreating: "1000000000000000000",
55
+ rewardsInfo: { rewardToken: "0x0000000000000000000000000000000000000000",
56
+ creationReward: "0", executionReward: "0", voteRewardsCoefficient: "0" },
57
+ executorDescription: "" // auto-uploaded to IPFS
58
+ }]
59
+ },
60
+ userKeeperParams: { tokenAddress: "0x0000000000000000000000000000000000000000",
61
+ nftAddress: "0x0000000000000000000000000000000000000000",
62
+ individualPower: "0", nftsTotalSupply: "0" },
63
+ tokenParams: { // non-empty name => create a gov token
64
+ name: "Aurora", symbol: "AUR",
65
+ users: ["0xYourAddr"],
66
+ cap: "0", // 0 = uncapped (or > mintedTotal)
67
+ mintedTotal: "1000000000000000000000", // 1000 tokens (18-dec)
68
+ amounts: ["1000000000000000000000"] // MUST sum to mintedTotal on mainnet
69
+ },
70
+ votePowerParams: { voteType: "LINEAR_VOTES" } // initData auto-encoded — do NOT pass it
71
+ }
72
+ })
73
+ ```
74
+
75
+ ## Deploy gotchas (the tool pre-flights these — heed the errors)
76
+
77
+ 1. **cap > mintedTotal** — or `cap = 0` (uncapped). `cap == mintedTotal` reverts
78
+ ERC20Gov init silently (bug #28).
79
+ 2. **LINEAR initData** — the tool auto-encodes `__LinearPower_init()`
80
+ (`0x892aea1f`). Never pass `initData` for LINEAR/POLYNOMIAL; only CUSTOM_VOTES
81
+ takes a manual `initData`.
82
+ 3. **Non-zero governance asset** — if not creating a token (`tokenParams.name`
83
+ empty), set `userKeeperParams.tokenAddress` or `.nftAddress`.
84
+ 4. **Treasury remainder (mainnet)** — `mintedTotal` must equal `sum(amounts)`;
85
+ a remainder reverts on chain 56 (bug #32). Distribute the whole mint.
86
+
87
+ ## Decimal conventions (must match the frontend)
88
+
89
+ - `quorum`, `quorumValidators`, `voteRewardsCoefficient`: **25-dec** wei (50% = `5e26`).
90
+ - `minVotes*`, `cap`, `mintedTotal`, `amounts`, `individualPower`, rewards: **18-dec** wei.
91
+ - `duration*`, `executionDelay`: plain **seconds** as string.
92
+ - `delegatedVotingAllowed` is **inverted**: `true` DISABLES delegation.
93
+
94
+ ## After deploy
95
+
96
+ The result includes `predictedGovPool` — that is the DAO's GovPool address once
97
+ the tx confirms. Use it for `dexe_proposal_create` / `dexe_proposal_vote_and_execute`.
98
+
99
+ Related: [[dexe-create-proposal]], [[dexe-vote-execute]].
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: dexe-create-proposal
3
+ description: |
4
+ Create any DeXe governance proposal with the one-call `dexe_proposal_create`
5
+ composite — it runs approve→deposit→createProposalAndVote and uploads correct
6
+ IPFS metadata for you. Covers every wired proposalType + params recipe and the
7
+ metadata/ABI/blacklist failure modes. Use when the user says "create a proposal",
8
+ "transfer treasury", "add an expert", "change voting settings", "start a token sale".
9
+ ---
10
+
11
+ # dexe-create-proposal
12
+
13
+ `dexe_proposal_create` builds a governance proposal in **one call**: it checks
14
+ token balance, approves the **UserKeeper** (not GovPool), deposits, uploads IPFS
15
+ metadata with the correct `{proposalName, proposalDescription, category, isMeta,
16
+ changes}` shape, and calls `createProposalAndVote`. With `DEXE_PRIVATE_KEY` it
17
+ signs+broadcasts; otherwise it returns ordered `TxPayload`s.
18
+
19
+ Call **`dexe_context`** first — it returns the signer, active chain, and the
20
+ DAOs/proposals from prior sessions (so you already have the `govPool` to target).
21
+
22
+ **Do not hand-sequence** approve/deposit/create, and do not hand-build the IPFS
23
+ metadata — the composite does both correctly. **Do not guess ABIs/selectors**;
24
+ the wired builders encode canonical calldata. Only reach for `dexe_get_methods`
25
+ when composing a truly custom call.
26
+
27
+ ## Pick a proposalType
28
+
29
+ Pass `proposalType` + the type's inputs in `params`:
30
+
31
+ | proposalType | params |
32
+ |---|---|
33
+ | `token_transfer` | `{ token, recipient, amount, isNative? }` |
34
+ | `withdraw_treasury` | `{ receiver, token?, amount?, nftAddress?, nftIds? }` (emits external `token.transfer`) |
35
+ | `change_voting_settings` | `{ govSettings, settings:[…], settingsIds? }` (empty ids ⇒ addSettings) |
36
+ | `add_expert` | `{ expertNftContract, scope:"local"\|"global", nominatedUser, uri? }` |
37
+ | `remove_expert` | `{ expertNftContract, scope, nominatedUser }` |
38
+ | `token_distribution` | `{ distributionProposal, proposalId, token, amount, isNative? }` |
39
+ | `token_sale` | `{ tokenSaleProposal, tiers:[…], latestTierId? }` |
40
+ | `custom_abi` | `{ target, signature, method, args?, value? }` |
41
+ | `modify_dao_profile` | top-level `newDaoName/newDaoDescription/newAvatarCID/newWebsiteUrl/newSocialLinks` |
42
+ | `custom` | top-level `actionsOnFor:[{executor,value,data}]` (+ optional `category`) |
43
+
44
+ Any other catalog type → the tool errors and names the dedicated
45
+ `dexe_proposal_build_*` tool. Discover all 33 types with `dexe_proposal_catalog`.
46
+
47
+ ## Example: transfer treasury tokens
48
+
49
+ ```jsonc
50
+ dexe_proposal_create({
51
+ govPool: "0x…",
52
+ chainId: 97,
53
+ proposalType: "token_transfer",
54
+ title: "Pay contributor grant",
55
+ description: "Q3 grant to @alice.",
56
+ params: { token: "0xGovToken", recipient: "0xAlice", amount: "1000000000000000000" }
57
+ })
58
+ ```
59
+
60
+ ## Failure modes this guards against
61
+
62
+ 1. **Sequence** — the composite runs approve→deposit→create; never do it by hand.
63
+ 2. **Metadata shape** — auto-built + preflight-validated (`{proposalName,
64
+ proposalDescription, category, isMeta:false, changes:{proposedChanges,
65
+ currentChanges}}`). Wrong shape breaks the frontend indexer/diff.
66
+ 3. **ABI/selector guessing** — wired builders use canonical signatures; tuple
67
+ field order is easy to get wrong by hand.
68
+ 4. **votingPower vs tokenBalance** — deposited power is
69
+ `tokenBalance(user,0).balance − ownedBalance`, not `votingPower()` (which is 0
70
+ without a deposit). The composite computes it.
71
+ 6. **Approve target** — the composite approves the **UserKeeper** (which does
72
+ `transferFrom`), never GovPool.
73
+ 8. **withdraw_treasury** emits an external `token.transfer`, never
74
+ `GovPool.withdraw` ("Gov: invalid internal data").
75
+ 10. **Blacklisted recipient** — token transfers to a blacklisted address are
76
+ refused up front (they'd stick the proposal in `SucceededFor` forever).
77
+
78
+ ## No signer? Preview first
79
+
80
+ Pass `dryRun: true` to get the ordered `TxPayload`s without broadcasting (also
81
+ the default behavior when no signer is configured). Then broadcast via
82
+ `dexe_tx_send` or a connected wallet.
83
+
84
+ Next step after it passes: [[dexe-vote-execute]].
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: dexe-otc
3
+ description: |
4
+ Run a DeXe OTC token sale end-to-end — open a multi-tier TokenSaleProposal,
5
+ vote+execute it, then buyers check status / buy / claim. Covers the five
6
+ dexe_otc_* composites plus the PRECISION-1e25 rate, native-BNB sentinel, and
7
+ claim-timing gotchas. Use when the user mentions "OTC", "token sale", "sell DAO
8
+ tokens", "buy from a tier", "claim vested tokens".
9
+ ---
10
+
11
+ # dexe-otc
12
+
13
+ An OTC DAO sells its own token via on-chain `TokenSaleProposal` tiers. Each step
14
+ is one MCP call; calldata auto-broadcasts when `DEXE_PRIVATE_KEY` is set.
15
+ Validate on **BSC testnet (chain 97)** first. Full recipe + runnable proof:
16
+ `docs/OTC.md` and `scripts/lifecycle-otc.mjs`.
17
+
18
+ ## The five composites
19
+
20
+ | Tool | Role |
21
+ |---|---|
22
+ | `dexe_otc_dao_open_sale` | multi-tier `createTiers` envelope + IPFS metadata + deposit + `createProposalAndVote`. `buildOnly:true` returns just the envelope. |
23
+ | `dexe_otc_list_sales_for_dao` | list a DAO's tiers (prices, `totalSold`, `isOff`, UTC times). |
24
+ | `dexe_otc_buyer_status` | render-ready buyer view: prices, claimable, vesting, auto-merkle proof. |
25
+ | `dexe_otc_buyer_buy` | preflight balance/allowance + approve + `buy()`; native path uses the sentinel + `value`. |
26
+ | `dexe_otc_buyer_claim_all` | claims tiers with `canClaim && !isClaimed`, withdraws vested; `noop` when nothing pending. |
27
+
28
+ ## Owner flow
29
+
30
+ 1. `dexe_dao_predict_addresses` → get `govPool` / `govToken` / `govTokenSale`.
31
+ 2. Deploy with treasury pre-seeded (mint to the predicted `govPool` via
32
+ `tokenParams.users[]`) — see [[dexe-create-dao]].
33
+ 3. `dexe_otc_dao_open_sale` with tiers (schema below).
34
+ 4. Poll `dexe_proposal_state` until `SucceededFor` (index 4; it briefly sits in
35
+ `Locked`=6), then `dexe_vote_build_execute` → broadcast.
36
+
37
+ ## Buyer flow
38
+
39
+ `dexe_otc_buyer_status` → `dexe_otc_buyer_buy` → (after the sale window closes)
40
+ `dexe_otc_buyer_claim_all`.
41
+
42
+ ## Critical gotchas
43
+
44
+ - **Exchange rate is PRECISION 1e25**, not 1e18. 1:1 = `"10000000000000000000000000"`.
45
+ - **Native BNB = `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`** (ETHEREUM_ADDRESS),
46
+ never `0x0…0` — a zero-address purchase token makes the tier unbuyable. Buy
47
+ tools accept `0x0` as an alias but emit the sentinel.
48
+ - **`canClaim` needs `block.timestamp ≥ saleEndTime + claimLockDuration`** — buyers
49
+ wait for the window to close even when `claimLockDuration:0`.
50
+ - **`maxAllocationPerUser == 0` means unlimited**, not zero — set a real cap.
51
+ - **Treasury must hold the sale token before the sale opens** — pre-seed at deploy.
52
+ - **`vestingPercentage` is a human percent 0–100** (auto-scaled by 1e25).
53
+ - **Merkle tiers** need the whitelist JSON on IPFS; `open_sale` auto-uploads when
54
+ `uri` is empty (needs `DEXE_PINATA_JWT`). Roots via `dexe_merkle_build`.
55
+
56
+ ## Tier schema (abridged)
57
+
58
+ ```jsonc
59
+ {
60
+ "name": "Public Tier 1", "description": "",
61
+ "totalTokenProvided": "<wei>",
62
+ "saleStartTime": "<unix sec>", "saleEndTime": "<unix sec>", "claimLockDuration": "0",
63
+ "saleTokenAddress": "0x…",
64
+ "purchaseTokenAddresses": ["0xEeee…EEeE"], // native, or ERC20 addresses
65
+ "exchangeRates": ["10000000000000000000000000"],
66
+ "minAllocationPerUser": "0", "maxAllocationPerUser": "<wei, non-zero>",
67
+ "vestingSettings": { "vestingPercentage": "0", "vestingDuration": "0", "cliffPeriod": "0", "unlockStep": "0" },
68
+ "participation": [] // AND-list; empty = open tier
69
+ }
70
+ ```
71
+
72
+ Do not modify OTC tool behavior lightly — the v0.11.x OTC surface is validated
73
+ E2E on mainnet. See `docs/OTC.md` for the exhaustive reference.
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: dexe-setup
3
+ description: |
4
+ Onboard a user to dexe-mcp. Runs `dexe_doctor`, parses the report, asks the
5
+ user only for what is missing, edits `.env` (NEVER `.claude.json`), and
6
+ tells them to restart Claude Code. Triggered by `/dexe-setup`, or
7
+ proactively when the user reports an env-related MCP tool failure
8
+ ("DEXE_PINATA_JWT not set", "RPC unreachable", "subgraph 401", etc.).
9
+ ---
10
+
11
+ # dexe-setup
12
+
13
+ ## What this does
14
+
15
+ Iterative env-setup loop for `dexe-mcp`. Replaces the brittle workflow where
16
+ Claude guesses which file to edit and which keys are needed. Drives entirely
17
+ from the `dexe_doctor` tool — no guessing.
18
+
19
+ ## When to invoke
20
+
21
+ - The user types `/dexe-setup`.
22
+ - The user reports any of:
23
+ - "dexe-mcp not working", "tools failing", "RPC error", "missing env"
24
+ - A specific MCP tool error mentioning a `DEXE_*` env var
25
+ - "How do I configure dexe-mcp?"
26
+ - You see a tool result containing `"Missing required env: DEXE_*"` or
27
+ `"DEXE_* is not set"` — invoke proactively.
28
+
29
+ ## Hard rules (do not violate)
30
+
31
+ 1. **Never write `DEXE_*` values to `.claude.json`.** The MCP host's env block
32
+ SHADOWS `.env` silently. Edits go in `.env` at the dexe-mcp repo root.
33
+ 2. **Never write `DEXE_PRIVATE_KEY` without explicit user opt-in.** Default
34
+ to readonly mode. If the user says "I want to broadcast", first suggest
35
+ WalletConnect (`DEXE_WALLETCONNECT_PROJECT_ID`); only fall back to
36
+ `DEXE_PRIVATE_KEY` if the user insists, and warn them that the key
37
+ lives in plaintext on disk.
38
+ 3. **Always tell the user to restart Claude Code after editing `.env`.**
39
+ `process.loadEnvFile()` runs once at startup; mid-session edits do
40
+ nothing until restart.
41
+ 4. **Cap the loop at 3 iterations.** If `dexe_doctor` still shows failures
42
+ after three doctor → fix → restart cycles, stop and present the full
43
+ report to the user — the remaining issues need manual investigation.
44
+
45
+ ## Algorithm
46
+
47
+ 1. Call `dexe_doctor` (no input).
48
+ 2. Read the `summary` and `checks` arrays from the structured response.
49
+ - If `summary.status === "pass"`, congratulate the user — no work to do.
50
+ - If only `warnings`, surface them but don't block.
51
+ 3. For every `fail`:
52
+ - If it is an env presence/validation issue: collect the env key.
53
+ - If it is a network reachability issue (RPC unreachable, Pinata 401):
54
+ use the `remediation` field verbatim; ask the user for a replacement
55
+ value.
56
+ 4. Batch the questions by category (RPC, IPFS, subgraph, signer) using
57
+ `AskUserQuestion`. One question per category, not one per key.
58
+ 5. Locate the `.env` file. The startup banner in the doctor response shows
59
+ `environment.envFile`; if absent, look at the repo root (where
60
+ `package.json` lives — usually `D:\dev\dexe-mcp\.env`).
61
+ 6. Edit `.env` with the Edit tool. For each provided value:
62
+ - If the key already exists, replace its line.
63
+ - Otherwise, append `KEY=value` at the bottom (preserve trailing newline).
64
+ 7. Tell the user, verbatim:
65
+ > Edits saved to `.env`. **Restart Claude Code** so the new values load
66
+ > (`Ctrl+R` rebuilds the session, or quit and relaunch). Then I will
67
+ > re-run `dexe_doctor` to confirm.
68
+ 8. After restart, call `dexe_doctor` again. If still failing, go to step 3.
69
+ Iterate at most 3 times.
70
+ 9. If after 3 iterations there are still failures, present the full
71
+ `checks` array and tell the user the remaining issues need manual
72
+ investigation (likely: bad credentials, account suspended, paid plan
73
+ required, or a corporate proxy blocking the relevant host).
74
+
75
+ ## Signer mode escalation
76
+
77
+ If a user wants broadcast capability, walk this ladder (top = safest):
78
+
79
+ 1. **WalletConnect (`DEXE_WALLETCONNECT_PROJECT_ID`).** Key stays on phone.
80
+ Every tx is approved manually.
81
+ 2. **Safe multisig (`DEXE_SAFE_TX_SERVICE_URL`).** Proposes tx to a Safe;
82
+ owners co-sign separately.
83
+ 3. **Hot key (`DEXE_PRIVATE_KEY`).** Plaintext on disk. Convenient for CI
84
+ bots, dangerous for humans. Show this warning before writing:
85
+ > Setting `DEXE_PRIVATE_KEY` stores your key in plaintext at `.env`.
86
+ > Anyone who reads the file can drain that wallet. Are you sure you
87
+ > don't want WalletConnect (above) or a Safe multisig instead?
88
+ 4. Refuse to proceed past step 3 without an explicit "yes" confirming
89
+ the user understands the trade-off.
90
+
91
+ ## .env precedence trap
92
+
93
+ If `dexe_doctor` returns a check named `env.<KEY>` with the message
94
+ "shadowed by host env block", the user has the same key defined in BOTH
95
+ `.env` AND `.claude.json`. The host wins. Tell them to either:
96
+ - remove the key from `.claude.json` `env` block (use `.env`), OR
97
+ - update it in `.claude.json` instead of `.env`.
98
+
99
+ Whichever they pick, restart Claude Code after.
100
+
101
+ ## Useful tools (reference)
102
+
103
+ - `dexe_doctor` — diagnostic (read-only, safe to call repeatedly).
104
+ - `dexe_get_config` — current chain/signer state (lower detail than doctor).
105
+ - `npx dexe-mcp doctor` — CLI form of the same diagnostic. Useful when the
106
+ MCP server itself failed to start.
107
+ - `npx dexe-mcp init` — fresh-start wizard. Overwrites `.env`. Use for new
108
+ installations, not for fixing an existing setup.