dexe-mcp 0.1.3 → 0.2.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/.mcp.example.json +12 -2
- package/CHANGELOG.md +48 -0
- package/FUTURE.md +26 -5
- package/README.md +80 -195
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +10 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -1
- package/dist/config.js.map +1 -1
- package/dist/hardhat.d.ts.map +1 -1
- package/dist/hardhat.js +10 -5
- package/dist/hardhat.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/addresses.d.ts +57 -0
- package/dist/lib/addresses.d.ts.map +1 -0
- package/dist/lib/addresses.js +83 -0
- package/dist/lib/addresses.js.map +1 -0
- package/dist/lib/calldata.d.ts +32 -0
- package/dist/lib/calldata.d.ts.map +1 -0
- package/dist/lib/calldata.js +28 -0
- package/dist/lib/calldata.js.map +1 -0
- package/dist/lib/govEnums.d.ts +12 -0
- package/dist/lib/govEnums.d.ts.map +1 -0
- package/dist/lib/govEnums.js +35 -0
- package/dist/lib/govEnums.js.map +1 -0
- package/dist/lib/ipfs.d.ts +60 -0
- package/dist/lib/ipfs.d.ts.map +1 -0
- package/dist/lib/ipfs.js +167 -0
- package/dist/lib/ipfs.js.map +1 -0
- package/dist/lib/multicall.d.ts +33 -0
- package/dist/lib/multicall.d.ts.map +1 -0
- package/dist/lib/multicall.js +46 -0
- package/dist/lib/multicall.js.map +1 -0
- package/dist/lib/proposalCatalog.d.ts +45 -0
- package/dist/lib/proposalCatalog.d.ts.map +1 -0
- package/dist/lib/proposalCatalog.js +416 -0
- package/dist/lib/proposalCatalog.js.map +1 -0
- package/dist/lib/subgraph.d.ts +15 -0
- package/dist/lib/subgraph.d.ts.map +1 -0
- package/dist/lib/subgraph.js +37 -0
- package/dist/lib/subgraph.js.map +1 -0
- package/dist/runtime.d.ts +51 -13
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +149 -26
- package/dist/runtime.js.map +1 -1
- package/dist/tools/dao.d.ts +4 -0
- package/dist/tools/dao.d.ts.map +1 -0
- package/dist/tools/dao.js +242 -0
- package/dist/tools/dao.js.map +1 -0
- package/dist/tools/daoDeploy.d.ts +4 -0
- package/dist/tools/daoDeploy.d.ts.map +1 -0
- package/dist/tools/daoDeploy.js +323 -0
- package/dist/tools/daoDeploy.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +24 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/ipfs.d.ts +6 -0
- package/dist/tools/ipfs.d.ts.map +1 -0
- package/dist/tools/ipfs.js +310 -0
- package/dist/tools/ipfs.js.map +1 -0
- package/dist/tools/proposal.d.ts +4 -0
- package/dist/tools/proposal.d.ts.map +1 -0
- package/dist/tools/proposal.js +199 -0
- package/dist/tools/proposal.js.map +1 -0
- package/dist/tools/proposalBuild.d.ts +4 -0
- package/dist/tools/proposalBuild.d.ts.map +1 -0
- package/dist/tools/proposalBuild.js +357 -0
- package/dist/tools/proposalBuild.js.map +1 -0
- package/dist/tools/proposalBuildComplex.d.ts +4 -0
- package/dist/tools/proposalBuildComplex.d.ts.map +1 -0
- package/dist/tools/proposalBuildComplex.js +700 -0
- package/dist/tools/proposalBuildComplex.js.map +1 -0
- package/dist/tools/proposalBuildInternal.d.ts +4 -0
- package/dist/tools/proposalBuildInternal.d.ts.map +1 -0
- package/dist/tools/proposalBuildInternal.js +211 -0
- package/dist/tools/proposalBuildInternal.js.map +1 -0
- package/dist/tools/proposalBuildMore.d.ts +4 -0
- package/dist/tools/proposalBuildMore.d.ts.map +1 -0
- package/dist/tools/proposalBuildMore.js +436 -0
- package/dist/tools/proposalBuildMore.js.map +1 -0
- package/dist/tools/proposalBuildOffchain.d.ts +4 -0
- package/dist/tools/proposalBuildOffchain.d.ts.map +1 -0
- package/dist/tools/proposalBuildOffchain.js +386 -0
- package/dist/tools/proposalBuildOffchain.js.map +1 -0
- package/dist/tools/read.d.ts +4 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/read.js +353 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/vote.d.ts +4 -0
- package/dist/tools/vote.d.ts.map +1 -0
- package/dist/tools/vote.js +196 -0
- package/dist/tools/vote.js.map +1 -0
- package/dist/tools/voteBuild.d.ts +4 -0
- package/dist/tools/voteBuild.d.ts.map +1 -0
- package/dist/tools/voteBuild.js +563 -0
- package/dist/tools/voteBuild.js.map +1 -0
- package/package.json +9 -4
- package/PLAN.md +0 -132
package/.mcp.example.json
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_comment": "Mac/Linux: use `dexe-mcp` directly. Windows:
|
|
2
|
+
"_comment": "Mac/Linux: use `dexe-mcp` directly. Windows: use the absolute-path form (node.exe + dist/index.js). See README.md. Env vars are all optional — tools that need them fail with a clear message.",
|
|
3
3
|
"mcpServers": {
|
|
4
4
|
"dexe": {
|
|
5
|
-
"command": "dexe-mcp"
|
|
5
|
+
"command": "dexe-mcp",
|
|
6
|
+
"env": {
|
|
7
|
+
"DEXE_PROTOCOL_PATH": "/absolute/path/to/DeXe-Protocol",
|
|
8
|
+
"DEXE_RPC_URL": "https://bsc-dataseed.binance.org",
|
|
9
|
+
"DEXE_CHAIN_ID": "56",
|
|
10
|
+
"DEXE_PINATA_JWT": "<your Pinata JWT>",
|
|
11
|
+
"DEXE_IPFS_GATEWAY": "https://<your-subdomain>.mypinata.cloud",
|
|
12
|
+
"DEXE_IPFS_GATEWAYS_FALLBACK": "https://dweb.link,https://ipfs.io",
|
|
13
|
+
"DEXE_SUBGRAPH_INTERACTIONS_URL": "https://api.studio.thegraph.com/query/.../dao-interactions/...",
|
|
14
|
+
"DEXE_BACKEND_API_URL": "https://api.dexe.io"
|
|
15
|
+
}
|
|
6
16
|
}
|
|
7
17
|
}
|
|
8
18
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
The big one — dexe-mcp expands from 15 dev-tooling tools to **83 tools** covering the full DeXe DAO lifecycle. AI agents can now create DAOs, build any of the 33 proposal types the DeXe frontend exposes, upload metadata to IPFS, stake/delegate/vote/execute/claim — all end-to-end.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
**Foundations + reads (13 tools)** — `dexe_dao_info`, `dexe_dao_predict_addresses`, `dexe_dao_registry_lookup`, `dexe_proposal_state`, `dexe_proposal_list`, `dexe_proposal_voters`, `dexe_vote_user_power`, `dexe_vote_get_votes`, `dexe_read_multicall`, `dexe_read_treasury`, `dexe_read_validators`, `dexe_read_settings`, `dexe_read_expert_status`. Backed by an `AddressBook` that resolves contracts via `ContractsRegistry`, a Multicall3 batch helper, a canonical `TxPayload` shape, enum mirrors for `ProposalState` / `VoteType`, and a minimal subgraph GraphQL client.
|
|
10
|
+
|
|
11
|
+
**IPFS (6 tools)** — `dexe_ipfs_upload_proposal_metadata`, `_upload_dao_metadata`, `_upload_file`, `_fetch`, `_cid_info`, `_cid_for_json`. Backed by a Pinata client and local CID computation via `multiformats`. Public gateways (dweb.link, ipfs.io, cf-ipfs, 4everland) are unreliable and NOT defaulted. Users must set `DEXE_IPFS_GATEWAY` to a dedicated gateway (the one Pinata provides alongside the JWT is recommended). Public gateways are opt-in via `DEXE_IPFS_GATEWAYS_FALLBACK` (comma-separated, tried sequentially — no parallel races).
|
|
12
|
+
|
|
13
|
+
**Proposals — all 33 types (35 tools)**
|
|
14
|
+
- `dexe_proposal_catalog` — enumerate every proposal type the DeXe UI exposes (24 external, 4 internal, 5 off-chain), with metadata shape, gating, and linked MCP builder.
|
|
15
|
+
- Primitives: `dexe_proposal_build_external` (+ `createProposalAndVote`), `dexe_proposal_build_internal`, `dexe_proposal_build_custom_abi`, `dexe_proposal_build_offchain`.
|
|
16
|
+
- External wrappers (each returns `{ metadata, actions: Action[] }`): `token_transfer`, `token_distribution`, `token_sale`, `token_sale_recover`, `change_voting_settings`, `manage_validators`, `add_expert`, `remove_expert`, `withdraw_treasury`, `delegate_to_expert`, `revoke_from_expert`, `create_staking_tier`, `change_math_model`, `modify_dao_profile`, `blacklist`, `reward_multiplier`, `apply_to_dao`, `new_proposal_type` (also covers *Enable Staking*).
|
|
17
|
+
- Internal validator wrappers (each returns `{ metadata, proposalType, data }`): `change_validator_balances` (type 0), `change_validator_settings` (type 1), `monthly_withdraw` (type 2), `offchain_internal_proposal` (type 3).
|
|
18
|
+
- Off-chain backend proposals: `offchain_single_option`, `offchain_multi_option`, `offchain_for_against`, `offchain_settings`. Plus `dexe_auth_request_nonce` + `dexe_auth_login_request` for the 2-step Bearer flow, and `dexe_offchain_build_vote` / `dexe_offchain_build_cancel_vote`.
|
|
19
|
+
- **Write model is calldata-only.** No signer, no private keys. Every write tool emits a signable payload the agent's wallet submits.
|
|
20
|
+
|
|
21
|
+
**Vote / stake / execute / claim writes (14 tools)** — `erc20_approve`, `deposit` (payable for native-staking DAOs), `withdraw`, `delegate`, `undelegate`, `vote`, `cancel_vote`, `validator_vote`, `validator_cancel_vote`, `move_to_validators`, `execute`, `claim_rewards`, `claim_micropool_rewards`, plus `multicall` to batch any of the above into one atomic tx. Arg-order gotchas captured in code comments (e.g. `GovPool.vote(pid, isFor, amount, nftIds)` vs `GovValidators.voteInternalProposal(pid, amount, isFor)`).
|
|
22
|
+
|
|
23
|
+
**DAO deploy (1 tool)** — `dexe_dao_build_deploy` encodes `PoolFactory.deployGovPool(GovPoolDeployParams)` with the full nested struct (settings / validators / userKeeper / token / votePower / verifier / BABT flag / descriptionURL / name). Auto-resolves PoolFactory via `ContractsRegistry` if omitted. When `deployer` + RPC are available, also returns the predicted GovPool address so agents can wire follow-up txs before the DAO exists. Encodes against the compiled `PoolFactory.json` artifact when present (strict parity); falls back to a hand-rolled tuple signature derived from `IPoolFactory.sol` otherwise.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- `src/config.ts` adds `DEXE_CHAIN_ID` (default 56), `DEXE_CONTRACTS_REGISTRY` override, `DEXE_PINATA_JWT`, three subgraph URL overrides, `DEXE_BACKEND_API_URL`.
|
|
28
|
+
- `package.json` description rewritten to reflect full DAO-ops scope. New dep: `multiformats` (Protocol Labs, for local CID computation).
|
|
29
|
+
- `README.md` reorganized around the eight tool groups; added the full env-var matrix.
|
|
30
|
+
|
|
31
|
+
### Notes
|
|
32
|
+
|
|
33
|
+
- **No breaking changes.** All v0.1.x tools remain. The write contract is new-world: `TxPayload` for single-tx builders, `Action[]` for proposal wrappers — never a singular `action` field.
|
|
34
|
+
- **Deferred to future work** (`FUTURE.md`): Hardhat-fork simulation (`dexe_simulate_vote`), signer-aware send mode, additional IPFS pinning providers (Storacha, Lighthouse), and alternate subgraphs.
|
|
35
|
+
|
|
36
|
+
## 0.1.5
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- **`'npx' is not recognized`** from inside `npm run compile` (and other npm scripts that internally call `npx hardhat …`) on stripped-Node Windows installs. v0.1.4 got `npm` itself spawning cleanly, but DeXe-Protocol's `compile` script is literally `npx hardhat compile --force`, and when npm spawned that child, `cmd.exe` couldn't find `npx.cmd` on PATH — the stripped `C:\Program Files\nodejs\` has `node.exe` only. Root cause: we weren't propagating the resolved Node's shim directory into the child's `PATH`.
|
|
40
|
+
- New `deriveNodeBinDir()` + `envWithNodeBinDir()` helpers in `src/runtime.ts` derive the directory containing `npm.cmd`/`npx.cmd` (Windows) or `bin/npm`/`bin/npx` (Unix) from the resolved `npm-cli.js` path, and prepend it to `PATH` on every child spawn (`bootstrap` npm install, `runNpmScript`, `runHardhat`). Child shells launched by npm scripts can now resolve `npx` / `npm` / any locally-installed binary as expected.
|
|
41
|
+
- `npmCommand()` now returns a `binDir` field alongside `command` / `prefixArgs` / `needsShell`. Bootstrap logs the prepended directory on first run so it's visible which Node install is contributing the shims.
|
|
42
|
+
|
|
43
|
+
## 0.1.4
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- **`spawn EINVAL` during first-run `npm install`** on Windows hosts where `process.execPath` points at a Node install that does not bundle npm (e.g. a bare `node.exe` dropped under `C:\Program Files\nodejs\` without the rest of the toolchain). Two root causes addressed:
|
|
47
|
+
1. `resolveNpmCli()` now searches a broader set of locations for a usable `npm-cli.js` — including `%APPDATA%\nvm\v*\node_modules\npm\bin\npm-cli.js` (nvm-windows), `%APPDATA%\npm\node_modules\npm\bin\npm-cli.js` (per-user npm prefix), `C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js` (stock Windows installer), `~/.nvm/versions/node/v*/lib/node_modules/npm/bin/npm-cli.js` (nvm Unix), and Homebrew paths. Because `npm-cli.js` is plain JavaScript, *any* modern `node` can execute any of these, so the MCP process's own Node is free to "borrow" npm from a completely different Node install.
|
|
48
|
+
2. When no `npm-cli.js` is found anywhere and we fall back to spawning `npm.cmd` directly, `execFile` / `execa` now pass `{ shell: true }` — without it, Node refuses to spawn `.cmd` / `.bat` files (CVE-2024-27980 mitigation) and throws `spawn EINVAL`.
|
|
49
|
+
- Progress logging on first bootstrap now prints the resolved `npm-cli.js` path (or "shell-resolved" fallback), so "which npm is about to run" is visible in stderr.
|
|
50
|
+
|
|
3
51
|
## 0.1.3
|
|
4
52
|
|
|
5
53
|
### Docs
|
package/FUTURE.md
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
# Future work
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Deliberately deferred out of v0.2.0. Kept here so we don't re-litigate during planning.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Signer-aware send mode
|
|
6
|
+
|
|
7
|
+
Every v0.2.0 write tool returns calldata (`TxPayload`). Actually *sending* the tx — reading a `PRIVATE_KEY` or opening a local keystore and submitting via ethers `Wallet.sendTransaction` — is deferred. Reason: scope + security posture. We don't want private keys anywhere near the MCP process by default. If re-opened, expose as an opt-in mode gated on an explicit `DEXE_SIGNING_MODE=enabled` env var with loud warnings in tool output.
|
|
8
|
+
|
|
9
|
+
## `dexe_simulate_vote` + Hardhat fork management
|
|
10
|
+
|
|
11
|
+
Spawn a managed `hardhat node --fork $DEXE_RPC_URL` child process owned by the MCP, impersonate a voter, submit the `vote` calldata against the fork, and report success/revert with gas used. Would live in `src/fork.ts`.
|
|
12
|
+
|
|
13
|
+
## Additional IPFS pinning providers
|
|
14
|
+
|
|
15
|
+
v0.2.0 ships Pinata only. Reasonable candidates if we need a second:
|
|
16
|
+
- **Lighthouse.storage** — one-time payment, permanent Filecoin storage. Best long-term fit for DAO metadata that must never disappear. User has flagged interest.
|
|
17
|
+
- **Storacha / web3.storage** — UCAN-based, Filecoin-backed, free tier.
|
|
18
|
+
- **Filebase** — S3-compatible, Filecoin-backed.
|
|
19
|
+
|
|
20
|
+
Design: extend `src/lib/ipfs.ts` with an `IpfsUploader` interface, factor Pinata into an adapter, add new adapters behind `DEXE_IPFS_PROVIDER`.
|
|
21
|
+
|
|
22
|
+
## Additional subgraphs
|
|
23
|
+
|
|
24
|
+
We wire `DEXE_SUBGRAPH_INTERACTIONS_URL` (voter lists) and reserved slots for pools/validators subgraphs. Fleshing out list/search tools that use those other subgraphs is deferred — driven by user demand.
|
|
25
|
+
|
|
26
|
+
## `dexe_get_storage_layout`
|
|
6
27
|
|
|
7
28
|
The current `DeXe-Protocol/hardhat.config.js` does not include `storageLayout` in `outputSelection`, so build-info files don't contain the data this tool would read.
|
|
8
29
|
|
|
@@ -25,13 +46,13 @@ solidity: {
|
|
|
25
46
|
|
|
26
47
|
Then the tool becomes a short handler reading `output.contracts[file][name].storageLayout` from the matching build-info JSON.
|
|
27
48
|
|
|
28
|
-
##
|
|
49
|
+
## Fixture tests for write builders
|
|
29
50
|
|
|
30
|
-
|
|
51
|
+
Phase 3 and 4 wrappers were verified against the DeXe frontend encodings but don't yet have byte-for-byte golden-file tests. For every `*_build_*` tool, capture the hex calldata from the frontend on identical inputs and snapshot it.
|
|
31
52
|
|
|
32
53
|
## Other ideas surfaced during design
|
|
33
54
|
|
|
34
55
|
- **TypeChain integration** — the protocol already emits ethers-v5 TypeChain bindings. We intentionally parse ABI JSON directly (dexe-mcp uses ethers v6). Revisit if/when DeXe-Protocol moves to ethers v6.
|
|
35
|
-
- **Custom `hardhat-migrate` wrappers** — out of scope per user decision (deployment tooling excluded).
|
|
56
|
+
- **Custom `hardhat-migrate` wrappers** — out of scope per user decision (deployment tooling excluded from the dev-tool surface).
|
|
36
57
|
- **Gas reporter parsing** — the `hardhat-gas-reporter` plugin is already wired in the protocol; `dexe_test` could optionally parse its output for per-function gas numbers.
|
|
37
58
|
- **Foundry fallback** — the repo is pure Hardhat today. Skip unless a Foundry config is added upstream.
|
package/README.md
CHANGED
|
@@ -2,51 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
MCP server
|
|
5
|
+
MCP server that gives AI agents **full DeXe Protocol DAO operations coverage** — deploy DAOs, build any of the 33 proposal types the DeXe UI exposes, upload metadata to IPFS, stake/delegate/vote/execute/claim. Plus dev tooling: build/test/lint, contract introspection, ABI-aware calldata decoding.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- **Node.js >= 20** with a working `npm`. Verify before continuing:
|
|
7
|
+
**Writes return calldata.** No signer ever lives in the MCP — every write tool emits a ready-to-sign `{ to, data, value, chainId, description }` payload that the agent's wallet (MetaMask, Safe, hardware, etc.) signs and submits. No `PRIVATE_KEY` env var, ever.
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
node --version # should print v20.x or higher
|
|
13
|
-
npm --version # MUST print a version, not "command not found"
|
|
14
|
-
```
|
|
9
|
+
**83 tools** across 8 groups. Call `dexe_proposal_catalog` at runtime for the full proposal-type map, or browse the [catalog](#tool-catalog) below.
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
## Prerequisites
|
|
17
12
|
|
|
18
|
-
- **
|
|
13
|
+
- **Node.js ≥ 20** with a working `npm` (`node --version` and `npm --version` must both succeed).
|
|
14
|
+
- **Git** — only needed the first time a build tool runs, to clone DeXe-Protocol. Skippable if you point `DEXE_PROTOCOL_PATH` at an existing checkout.
|
|
19
15
|
|
|
20
16
|
## Install
|
|
21
17
|
|
|
22
|
-
### 1. Install the package globally
|
|
23
|
-
|
|
24
18
|
```bash
|
|
25
19
|
npm install -g dexe-mcp
|
|
26
20
|
```
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm root -g
|
|
32
|
-
# Mac/Linux: /usr/local/lib/node_modules (or ~/.nvm/versions/node/vXX.X.X/lib/node_modules)
|
|
33
|
-
# Windows: C:\Users\<you>\AppData\Roaming\nvm\<version>\node_modules
|
|
34
|
-
# (or C:\Users\<you>\AppData\Roaming\npm\node_modules for non-nvm)
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Note the output — you'll need it for the Windows install step below. The package lives at `<npm-root>/dexe-mcp/dist/index.js`.
|
|
38
|
-
|
|
39
|
-
### 2. Register the MCP server
|
|
40
|
-
|
|
41
|
-
#### Mac / Linux
|
|
42
|
-
|
|
43
|
-
Bare command works because Unix `exec` resolves PATH directly:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
claude mcp add dexe -- dexe-mcp
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Or in JSON (`.mcp.json`, `claude_desktop_config.json`, etc.):
|
|
22
|
+
Register the server with your MCP client (`.mcp.json`, `claude_desktop_config.json`, etc.):
|
|
50
23
|
|
|
51
24
|
```json
|
|
52
25
|
{
|
|
@@ -58,207 +31,123 @@ Or in JSON (`.mcp.json`, `claude_desktop_config.json`, etc.):
|
|
|
58
31
|
}
|
|
59
32
|
```
|
|
60
33
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
On Windows, `dexe-mcp` is installed as a `.cmd` shim that many MCP clients (including Claude Code as of this writing) fail to spawn cleanly over stdio. The **absolute-path** form bypasses shim resolution entirely and is the known-good recipe:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
claude mcp add dexe -- "C:\Program Files\nodejs\node.exe" "C:\Users\<you>\AppData\Roaming\nvm\<version>\node_modules\dexe-mcp\dist\index.js"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Substitute `<you>` and `<version>` (or use whatever `npm root -g` printed above). In JSON:
|
|
70
|
-
|
|
71
|
-
```json
|
|
72
|
-
{
|
|
73
|
-
"mcpServers": {
|
|
74
|
-
"dexe": {
|
|
75
|
-
"command": "C:/Program Files/nodejs/node.exe",
|
|
76
|
-
"args": ["C:/Users/<you>/AppData/Roaming/nvm/<version>/node_modules/dexe-mcp/dist/index.js"]
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
This works because:
|
|
83
|
-
- No PATH dependency — every argument is an absolute path
|
|
84
|
-
- No `.cmd` / `.ps1` shim in the chain, so `CreateProcess` semantics don't trip over missing extensions
|
|
85
|
-
- `dexe-mcp` internally invokes `npm`/`hardhat` via `process.execPath`, so it uses whichever Node you pointed at and does not need npm on the spawned process PATH
|
|
86
|
-
|
|
87
|
-
<details>
|
|
88
|
-
<summary>Alternative: <code>cmd /c dexe-mcp</code> (not recommended — often unreliable with Claude Code)</summary>
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"mcpServers": {
|
|
93
|
-
"dexe": {
|
|
94
|
-
"command": "cmd",
|
|
95
|
-
"args": ["/c", "dexe-mcp"]
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Use only if the absolute-path form is inconvenient. End-to-end testing showed this can pass a direct stdio check but fail to complete the MCP handshake when spawned by Claude Code.
|
|
102
|
-
</details>
|
|
103
|
-
|
|
104
|
-
### 3. Verify the install (optional but recommended)
|
|
105
|
-
|
|
106
|
-
Before wiring the server into your MCP client, confirm the binary can actually speak MCP over stdio. On any OS:
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
# Send a minimal initialize request, expect a capabilities JSON back.
|
|
110
|
-
echo "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"t\",\"version\":\"1\"}}}" | dexe-mcp
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
On Windows if the above hangs, try instead:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
echo {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1"}}} | node "C:\Users\<you>\AppData\Roaming\nvm\<version>\node_modules\dexe-mcp\dist\index.js"
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
A healthy response starts with a single stderr line (`[dexe-mcp] connected on stdio. …`) and a stdout JSON blob containing `"serverInfo":{"name":"dexe-mcp"}`. If you see that, the server is fine and any "failed to connect" from your MCP client is purely a client-side spawn/config problem, not a bug in dexe-mcp.
|
|
120
|
-
|
|
121
|
-
### 4. Restart your MCP client
|
|
122
|
-
|
|
123
|
-
On the first build-tool call (e.g. `dexe_compile`), `dexe-mcp` will automatically:
|
|
124
|
-
|
|
125
|
-
1. Shallow-clone `dexe-network/DeXe-Protocol` into a platform cache directory (~200 MB)
|
|
126
|
-
2. Run `npm install` in that checkout (a few minutes, one time)
|
|
127
|
-
|
|
128
|
-
The MCP server itself starts instantly — the heavy work is deferred until you actually need it. Cache locations:
|
|
129
|
-
|
|
130
|
-
| OS | Path |
|
|
131
|
-
|----|------|
|
|
132
|
-
| Windows | `%LOCALAPPDATA%\dexe-mcp\DeXe-Protocol` |
|
|
133
|
-
| macOS | `~/Library/Caches/dexe-mcp/DeXe-Protocol` |
|
|
134
|
-
| Linux | `$XDG_CACHE_HOME/dexe-mcp/DeXe-Protocol` (or `~/.cache/dexe-mcp/DeXe-Protocol`) |
|
|
135
|
-
|
|
136
|
-
### Advanced: existing DeXe-Protocol checkout
|
|
137
|
-
|
|
138
|
-
If you already have a DeXe-Protocol clone you want to reuse (and have run `npm install` there at least once), set `DEXE_PROTOCOL_PATH`:
|
|
34
|
+
If your client can't spawn the bare `dexe-mcp` command directly (a known issue with some MCP clients on Windows when PATH-shim resolution is involved), point it at the installed script via Node:
|
|
139
35
|
|
|
140
36
|
```json
|
|
141
37
|
{
|
|
142
38
|
"mcpServers": {
|
|
143
39
|
"dexe": {
|
|
144
|
-
"command": "
|
|
145
|
-
"
|
|
146
|
-
"DEXE_PROTOCOL_PATH": "/absolute/path/to/your/DeXe-Protocol"
|
|
147
|
-
}
|
|
40
|
+
"command": "node",
|
|
41
|
+
"args": ["<output of `npm root -g`>/dexe-mcp/dist/index.js"]
|
|
148
42
|
}
|
|
149
43
|
}
|
|
150
44
|
}
|
|
151
45
|
```
|
|
152
46
|
|
|
153
|
-
|
|
47
|
+
Run `npm root -g` to resolve the path on your machine. Restart the MCP client and the `dexe_*` tools will appear.
|
|
154
48
|
|
|
155
|
-
|
|
49
|
+
## First run
|
|
156
50
|
|
|
157
|
-
|
|
51
|
+
The MCP server starts instantly. On the first build-tool call (`dexe_compile` / `dexe_test` / `dexe_lint`), dexe-mcp will automatically shallow-clone DeXe-Protocol into a platform cache directory and run `npm install` there once. If you prefer to reuse an existing checkout, set `DEXE_PROTOCOL_PATH` in the MCP `env` block and nothing will be cloned.
|
|
158
52
|
|
|
159
|
-
|
|
160
|
-
git clone https://github.com/edward-arinin-web-dev/dexe-mcp.git
|
|
161
|
-
cd dexe-mcp
|
|
162
|
-
npm install
|
|
163
|
-
npm run build
|
|
164
|
-
```
|
|
53
|
+
Most tools don't need the protocol checkout at all — read/proposal/vote/deploy builders only need an RPC URL. Only the dev-tooling group (`dexe_compile`, `dexe_test`, `dexe_coverage`, `dexe_lint`, and the introspection tools) depends on artifacts.
|
|
165
54
|
|
|
166
|
-
|
|
167
|
-
{
|
|
168
|
-
"mcpServers": {
|
|
169
|
-
"dexe": {
|
|
170
|
-
"command": "node",
|
|
171
|
-
"args": ["/absolute/path/to/dexe-mcp/dist/index.js"],
|
|
172
|
-
"env": {
|
|
173
|
-
"DEXE_PROTOCOL_PATH": "/absolute/path/to/DeXe-Protocol"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## First run
|
|
55
|
+
## Environment variables
|
|
181
56
|
|
|
182
|
-
|
|
57
|
+
All optional. Tools that need a missing variable fail with a clear message pointing at exactly what to set.
|
|
58
|
+
|
|
59
|
+
| Variable | Required for | Purpose |
|
|
60
|
+
|----------|--------------|---------|
|
|
61
|
+
| `DEXE_PROTOCOL_PATH` | dev tooling (optional) | Use an existing DeXe-Protocol checkout; disables auto clone/install |
|
|
62
|
+
| `DEXE_RPC_URL` | reads / predict / deploy | JSON-RPC endpoint (BSC or any EVM chain where DeXe is deployed) |
|
|
63
|
+
| `DEXE_CHAIN_ID` | reads | Defaults to `56` (BSC mainnet). Override for other chains |
|
|
64
|
+
| `DEXE_CONTRACTS_REGISTRY` | reads (optional) | Override the ContractsRegistry root; defaults to the known per-chain address |
|
|
65
|
+
| `DEXE_PINATA_JWT` | IPFS uploads | Pinata JWT for pinning proposal/DAO metadata |
|
|
66
|
+
| `DEXE_IPFS_GATEWAY` | IPFS fetch | **Dedicated** gateway URL (Pinata provides one alongside your JWT; Filebase / Quicknode / self-hosted also work). Public gateways are unreliable and NOT defaulted |
|
|
67
|
+
| `DEXE_IPFS_GATEWAYS_FALLBACK` | IPFS fetch (optional) | Comma-separated public gateways tried sequentially after the primary |
|
|
68
|
+
| `DEXE_SUBGRAPH_INTERACTIONS_URL` | `dexe_proposal_voters` | The Graph endpoint for the DeXe interactions subgraph |
|
|
69
|
+
| `DEXE_SUBGRAPH_POOLS_URL`, `DEXE_SUBGRAPH_VALIDATORS_URL` | reserved | Additional subgraph endpoints for future tools |
|
|
70
|
+
| `DEXE_BACKEND_API_URL` | off-chain proposals | DeXe backend (e.g. `https://api.dexe.io`) |
|
|
183
71
|
|
|
184
72
|
## Tool catalog
|
|
185
73
|
|
|
186
|
-
###
|
|
74
|
+
### Dev tooling (compile / test / introspect / decode)
|
|
187
75
|
|
|
188
76
|
| Tool | Description |
|
|
189
77
|
|------|-------------|
|
|
190
|
-
| `dexe_compile`
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `dexe_lint` | Lint Solidity sources with solhint |
|
|
78
|
+
| `dexe_compile`, `dexe_test`, `dexe_coverage`, `dexe_lint` | Hardhat wrappers |
|
|
79
|
+
| `dexe_list_contracts`, `dexe_get_abi`, `dexe_get_methods`, `dexe_get_selectors`, `dexe_find_selector`, `dexe_get_natspec`, `dexe_get_source` | Contract introspection from compiled artifacts |
|
|
80
|
+
| `dexe_decode_calldata`, `dexe_decode_proposal`, `dexe_list_gov_contract_types` | ABI-aware calldata / proposal decoding |
|
|
194
81
|
|
|
195
|
-
###
|
|
82
|
+
### DAO reads (on-chain state via multicall + subgraph)
|
|
196
83
|
|
|
197
84
|
| Tool | Description |
|
|
198
85
|
|------|-------------|
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
86
|
+
| `dexe_dao_info` | DAO overview — helpers, NFT contracts, validator count |
|
|
87
|
+
| `dexe_dao_predict_addresses` | Predict CREATE2 addresses for a future DAO |
|
|
88
|
+
| `dexe_dao_registry_lookup` | Is this address a registered GovPool? |
|
|
89
|
+
| `dexe_proposal_state`, `dexe_proposal_list`, `dexe_proposal_voters` | Proposal reads (voters via subgraph) |
|
|
90
|
+
| `dexe_vote_user_power`, `dexe_vote_get_votes` | User staking + per-proposal vote info |
|
|
91
|
+
| `dexe_read_multicall` | Generic Multicall3 batched `eth_call` |
|
|
92
|
+
| `dexe_read_treasury`, `dexe_read_validators`, `dexe_read_settings`, `dexe_read_expert_status` | Canned live reads |
|
|
93
|
+
| `dexe_read_gov_state` | Aggregate gov-pool state (legacy helper) |
|
|
206
94
|
|
|
207
|
-
###
|
|
95
|
+
### IPFS
|
|
208
96
|
|
|
209
97
|
| Tool | Description |
|
|
210
98
|
|------|-------------|
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
|
|
216
|
-
## Environment variables
|
|
217
|
-
|
|
218
|
-
| Variable | Required | Purpose |
|
|
219
|
-
|----------|----------|---------|
|
|
220
|
-
| `DEXE_PROTOCOL_PATH` | no | Use an existing DeXe-Protocol checkout; disables auto clone/install |
|
|
221
|
-
| `DEXE_RPC_URL` | no | JSON-RPC endpoint for `dexe_decode_proposal` and `dexe_read_gov_state` |
|
|
222
|
-
| `DEXE_FORK_BLOCK` | no | Pin the fork to a specific block (Phase B) |
|
|
223
|
-
|
|
224
|
-
## Troubleshooting
|
|
225
|
-
|
|
226
|
-
### "`git` is not on PATH"
|
|
99
|
+
| `dexe_ipfs_upload_proposal_metadata`, `dexe_ipfs_upload_dao_metadata`, `dexe_ipfs_upload_file` | Pinata uploads (requires `DEXE_PINATA_JWT`) |
|
|
100
|
+
| `dexe_ipfs_fetch` | Fetch by CID via configured dedicated gateway |
|
|
101
|
+
| `dexe_ipfs_cid_info` | Parse CID + v0↔v1 conversion + gateway URLs |
|
|
102
|
+
| `dexe_ipfs_cid_for_json` | Compute CIDv1 locally (no network) for dry-run flows |
|
|
227
103
|
|
|
228
|
-
|
|
104
|
+
### DAO deploy
|
|
229
105
|
|
|
230
|
-
|
|
106
|
+
| Tool | Description |
|
|
107
|
+
|------|-------------|
|
|
108
|
+
| `dexe_dao_build_deploy` | Encode `PoolFactory.deployGovPool(GovPoolDeployParams)` with full nested-struct input (settings / validators / userKeeper / token / votePower / verifier / BABT flag / descriptionURL / name). Auto-resolves PoolFactory via registry; optionally returns the predicted GovPool address |
|
|
231
109
|
|
|
232
|
-
|
|
110
|
+
### Proposals — primitives + catalog
|
|
233
111
|
|
|
234
|
-
|
|
112
|
+
| Tool | Description |
|
|
113
|
+
|------|-------------|
|
|
114
|
+
| `dexe_proposal_catalog` | Enumerate **all 33** proposal types with schemas, gating, metadata shape, and the MCP tool that handles each |
|
|
115
|
+
| `dexe_proposal_build_external` | Raw `GovPool.createProposal(url, actionsFor, actionsAgainst)` (+ `createProposalAndVote` variant) |
|
|
116
|
+
| `dexe_proposal_build_internal` | Raw `GovValidators.createInternalProposal(type, url, data)` |
|
|
117
|
+
| `dexe_proposal_build_custom_abi` | Encode any ABI call → one `ProposalAction` |
|
|
118
|
+
| `dexe_proposal_build_offchain` | Generic DeXe backend HTTP request builder |
|
|
235
119
|
|
|
236
|
-
|
|
120
|
+
### Proposal wrappers — external (on-chain)
|
|
237
121
|
|
|
238
|
-
|
|
122
|
+
Each returns `{ metadata, actions[] }` — upload the metadata via `dexe_ipfs_upload_proposal_metadata`, then feed actions into `dexe_proposal_build_external`:
|
|
239
123
|
|
|
240
|
-
|
|
241
|
-
claude mcp remove dexe
|
|
242
|
-
claude mcp add dexe -- "C:\Program Files\nodejs\node.exe" "C:\Users\<you>\AppData\Roaming\nvm\<version>\node_modules\dexe-mcp\dist\index.js"
|
|
243
|
-
```
|
|
124
|
+
`dexe_proposal_build_token_transfer`, `_token_distribution`, `_token_sale`, `_token_sale_recover`, `_change_voting_settings`, `_manage_validators`, `_add_expert`, `_remove_expert`, `_withdraw_treasury`, `_delegate_to_expert`, `_revoke_from_expert`, `_create_staking_tier`, `_change_math_model`, `_modify_dao_profile`, `_blacklist`, `_reward_multiplier`, `_apply_to_dao`, `_new_proposal_type` (also covers *Enable Staking*).
|
|
244
125
|
|
|
245
|
-
|
|
126
|
+
### Proposal wrappers — internal validator
|
|
246
127
|
|
|
247
|
-
|
|
128
|
+
Return `{ metadata, proposalType, data }` — compose with `dexe_proposal_build_internal`:
|
|
248
129
|
|
|
249
|
-
|
|
130
|
+
`dexe_proposal_build_change_validator_balances` (type 0), `_change_validator_settings` (type 1), `_monthly_withdraw` (type 2), `_offchain_internal_proposal` (type 3).
|
|
250
131
|
|
|
251
|
-
###
|
|
132
|
+
### Proposal wrappers — off-chain (DeXe backend)
|
|
252
133
|
|
|
253
|
-
|
|
134
|
+
`dexe_proposal_build_offchain_single_option`, `_offchain_multi_option`, `_offchain_for_against`, `_offchain_settings`.
|
|
254
135
|
|
|
255
|
-
|
|
136
|
+
Plus auth + vote helpers: `dexe_auth_request_nonce`, `dexe_auth_login_request`, `dexe_offchain_build_vote`, `dexe_offchain_build_cancel_vote`.
|
|
256
137
|
|
|
257
|
-
|
|
138
|
+
### Vote / stake / execute / claim (direct EOA writes)
|
|
258
139
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
140
|
+
| Tool | Description |
|
|
141
|
+
|------|-------------|
|
|
142
|
+
| `dexe_vote_build_erc20_approve` | ERC20 approve — prepend before `deposit` for ERC20-staking DAOs |
|
|
143
|
+
| `dexe_vote_build_deposit` | `GovPool.deposit(amount, nftIds)` — payable for native-coin DAOs |
|
|
144
|
+
| `dexe_vote_build_withdraw` | `GovPool.withdraw(receiver, amount, nftIds)` |
|
|
145
|
+
| `dexe_vote_build_delegate`, `_undelegate` | User-level delegation on `GovPool` |
|
|
146
|
+
| `dexe_vote_build_vote`, `_cancel_vote` | `GovPool.vote(pid, isFor, amount, nftIds)` / `cancelVote` |
|
|
147
|
+
| `dexe_vote_build_validator_vote`, `_validator_cancel_vote` | Validator voting (internal/external scope) |
|
|
148
|
+
| `dexe_vote_build_move_to_validators`, `_execute` | Proposal lifecycle |
|
|
149
|
+
| `dexe_vote_build_claim_rewards`, `_claim_micropool_rewards` | Reward claiming |
|
|
150
|
+
| `dexe_vote_build_multicall` | Atomic `GovPool.multicall(bytes[])` — batch any of the above into one tx |
|
|
262
151
|
|
|
263
152
|
## Contributing
|
|
264
153
|
|
|
@@ -271,10 +160,6 @@ npm run typecheck
|
|
|
271
160
|
npm run dev # watch mode
|
|
272
161
|
```
|
|
273
162
|
|
|
274
|
-
## Roadmap
|
|
275
|
-
|
|
276
|
-
Phase B (`dexe_simulate_vote` + Hardhat fork management) is planned for v0.2.0. See [FUTURE.md](./FUTURE.md) for all deferred features.
|
|
277
|
-
|
|
278
163
|
## License
|
|
279
164
|
|
|
280
165
|
MIT. See [LICENSE](./LICENSE).
|
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAO1D;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAO1D;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiG1E"}
|
package/dist/bootstrap.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join } from "node:path";
|
|
|
3
3
|
import { homedir, platform } from "node:os";
|
|
4
4
|
import { execFile } from "node:child_process";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
|
-
import { hasGit, npmCommand } from "./runtime.js";
|
|
6
|
+
import { envWithNodeBinDir, hasGit, npmCommand } from "./runtime.js";
|
|
7
7
|
const execFileAsync = promisify(execFile);
|
|
8
8
|
const REPO_URL = "https://github.com/dexe-network/DeXe-Protocol.git";
|
|
9
9
|
const CACHE_DIR_NAME = "dexe-mcp";
|
|
@@ -117,11 +117,20 @@ export async function ensureBuildReady(protocolPath) {
|
|
|
117
117
|
if (!existsSync(join(protocolPath, "node_modules"))) {
|
|
118
118
|
log("Installing DeXe-Protocol npm dependencies (first run only) — this takes a few minutes …");
|
|
119
119
|
const npm = npmCommand();
|
|
120
|
+
log(npm.prefixArgs.length > 0
|
|
121
|
+
? `Using npm-cli.js at ${npm.prefixArgs[0]}`
|
|
122
|
+
: `Using ${npm.command} from PATH (shell-resolved)`);
|
|
123
|
+
if (npm.binDir)
|
|
124
|
+
log(`Prepending ${npm.binDir} to child PATH for npx/npm resolution`);
|
|
120
125
|
try {
|
|
121
126
|
await execFileAsync(npm.command, [...npm.prefixArgs, "install", "--no-audit", "--no-fund"], {
|
|
122
127
|
cwd: protocolPath,
|
|
123
128
|
windowsHide: true,
|
|
124
129
|
maxBuffer: 64 * 1024 * 1024,
|
|
130
|
+
// Windows `.cmd` shims cannot be invoked via execFile without
|
|
131
|
+
// shell:true as of Node's CVE-2024-27980 mitigation.
|
|
132
|
+
shell: npm.needsShell,
|
|
133
|
+
env: envWithNodeBinDir(npm.binDir),
|
|
125
134
|
});
|
|
126
135
|
}
|
|
127
136
|
catch (err) {
|
package/dist/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CA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oBACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBAC7D,MAAM,IAAI,KAAK,CACb,iCAAiC,YAAY,KAAK;wBAChD,uEAAuE;wBACvE,+DAA+D,GAAG,EAAE,CACvE,CAAC;gBACJ,CAAC;gBACD,GAAG,CAAC,yBAAyB,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -3,6 +3,16 @@ export interface DexeConfig {
|
|
|
3
3
|
protocolPath: string;
|
|
4
4
|
/** Optional JSON-RPC endpoint for on-chain gov tools. */
|
|
5
5
|
rpcUrl?: string;
|
|
6
|
+
/** Chain id the RPC points at. Defaults to 56 (BSC mainnet, DeXe home). */
|
|
7
|
+
chainId: number;
|
|
8
|
+
/** Override for `ContractsRegistry` root address. */
|
|
9
|
+
registryOverride?: string;
|
|
10
|
+
/** Pinata JWT for IPFS uploads (reads work without it via gateway). */
|
|
11
|
+
pinataJwt?: string;
|
|
12
|
+
/** GraphQL endpoint URLs for The Graph subgraphs. */
|
|
13
|
+
subgraphPoolsUrl?: string;
|
|
14
|
+
subgraphValidatorsUrl?: string;
|
|
15
|
+
subgraphInteractionsUrl?: string;
|
|
6
16
|
/** Optional fork block pin (Phase B). */
|
|
7
17
|
forkBlock?: number;
|
|
8
18
|
}
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,YAAY,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,YAAY,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,CAqDtD"}
|
package/dist/config.js
CHANGED
|
@@ -19,6 +19,19 @@ export async function loadConfig() {
|
|
|
19
19
|
process.stderr.write(`[dexe-mcp] DeXe-Protocol checkout at ${protocolPath} is incomplete (missing node_modules or hardhat.config) — will be prepared on first dexe_compile call.\n`);
|
|
20
20
|
}
|
|
21
21
|
const rpcUrl = process.env.DEXE_RPC_URL?.trim() || undefined;
|
|
22
|
+
let chainId = 56;
|
|
23
|
+
if (process.env.DEXE_CHAIN_ID) {
|
|
24
|
+
const n = Number(process.env.DEXE_CHAIN_ID);
|
|
25
|
+
if (!Number.isFinite(n) || n <= 0) {
|
|
26
|
+
fatal(`DEXE_CHAIN_ID must be a positive integer, got: ${process.env.DEXE_CHAIN_ID}`);
|
|
27
|
+
}
|
|
28
|
+
chainId = n;
|
|
29
|
+
}
|
|
30
|
+
const registryOverride = process.env.DEXE_CONTRACTS_REGISTRY?.trim() || undefined;
|
|
31
|
+
const pinataJwt = process.env.DEXE_PINATA_JWT?.trim() || undefined;
|
|
32
|
+
const subgraphPoolsUrl = process.env.DEXE_SUBGRAPH_POOLS_URL?.trim() || undefined;
|
|
33
|
+
const subgraphValidatorsUrl = process.env.DEXE_SUBGRAPH_VALIDATORS_URL?.trim() || undefined;
|
|
34
|
+
const subgraphInteractionsUrl = process.env.DEXE_SUBGRAPH_INTERACTIONS_URL?.trim() || undefined;
|
|
22
35
|
let forkBlock;
|
|
23
36
|
if (process.env.DEXE_FORK_BLOCK) {
|
|
24
37
|
const n = Number(process.env.DEXE_FORK_BLOCK);
|
|
@@ -27,7 +40,17 @@ export async function loadConfig() {
|
|
|
27
40
|
}
|
|
28
41
|
forkBlock = n;
|
|
29
42
|
}
|
|
30
|
-
return Object.freeze({
|
|
43
|
+
return Object.freeze({
|
|
44
|
+
protocolPath,
|
|
45
|
+
rpcUrl,
|
|
46
|
+
chainId,
|
|
47
|
+
registryOverride,
|
|
48
|
+
pinataJwt,
|
|
49
|
+
subgraphPoolsUrl,
|
|
50
|
+
subgraphValidatorsUrl,
|
|
51
|
+
subgraphInteractionsUrl,
|
|
52
|
+
forkBlock,
|
|
53
|
+
});
|
|
31
54
|
}
|
|
32
55
|
function fatal(msg) {
|
|
33
56
|
// stderr only — stdout is the MCP protocol channel.
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":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