bostrom-mcp 0.1.0 → 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/README.md +218 -0
- package/dist/clients/ipfs-write.d.ts +6 -0
- package/dist/clients/ipfs-write.js +31 -0
- package/dist/clients/ipfs-write.js.map +1 -0
- package/dist/clients/signing.d.ts +27 -0
- package/dist/clients/signing.js +116 -0
- package/dist/clients/signing.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +41 -15
- package/dist/index.js.map +1 -1
- package/dist/services/contract-exec.d.ts +84 -0
- package/dist/services/contract-exec.js +125 -0
- package/dist/services/contract-exec.js.map +1 -0
- package/dist/services/graph-write.d.ts +67 -0
- package/dist/services/graph-write.js +80 -0
- package/dist/services/graph-write.js.map +1 -0
- package/dist/services/grid.d.ts +46 -0
- package/dist/services/grid.js +50 -0
- package/dist/services/grid.js.map +1 -0
- package/dist/services/ibc.d.ts +25 -0
- package/dist/services/ibc.js +37 -0
- package/dist/services/ibc.js.map +1 -0
- package/dist/services/liquidity.d.ts +103 -0
- package/dist/services/liquidity.js +162 -0
- package/dist/services/liquidity.js.map +1 -0
- package/dist/services/lithium-write.d.ts +45 -0
- package/dist/services/lithium-write.js +33 -0
- package/dist/services/lithium-write.js.map +1 -0
- package/dist/services/tokenfactory.d.ts +58 -0
- package/dist/services/tokenfactory.js +83 -0
- package/dist/services/tokenfactory.js.map +1 -0
- package/dist/services/wallet.d.ts +78 -0
- package/dist/services/wallet.js +111 -0
- package/dist/services/wallet.js.map +1 -0
- package/dist/tools/contract.d.ts +2 -0
- package/dist/tools/contract.js +99 -0
- package/dist/tools/contract.js.map +1 -0
- package/dist/tools/graph-write.d.ts +2 -0
- package/dist/tools/graph-write.js +60 -0
- package/dist/tools/graph-write.js.map +1 -0
- package/dist/tools/grid.d.ts +2 -0
- package/dist/tools/grid.js +37 -0
- package/dist/tools/grid.js.map +1 -0
- package/dist/tools/ibc.d.ts +2 -0
- package/dist/tools/ibc.js +23 -0
- package/dist/tools/ibc.js.map +1 -0
- package/dist/tools/liquidity.d.ts +2 -0
- package/dist/tools/liquidity.js +105 -0
- package/dist/tools/liquidity.js.map +1 -0
- package/dist/tools/lithium-write.d.ts +2 -0
- package/dist/tools/lithium-write.js +51 -0
- package/dist/tools/lithium-write.js.map +1 -0
- package/dist/tools/tokenfactory.d.ts +2 -0
- package/dist/tools/tokenfactory.js +57 -0
- package/dist/tools/tokenfactory.js.map +1 -0
- package/dist/tools/wallet.d.ts +2 -0
- package/dist/tools/wallet.js +64 -0
- package/dist/tools/wallet.js.map +1 -0
- package/dist/util.d.ts +14 -0
- package/dist/util.js +14 -0
- package/dist/util.js.map +1 -1
- package/package.json +12 -5
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# bostrom-mcp
|
|
2
|
+
|
|
3
|
+
[MCP](https://modelcontextprotocol.io) server for the [Bostrom](https://cyb.ai) blockchain — knowledge graph, economy, lithium mining, governance, infrastructure, and **autonomous agent capabilities**.
|
|
4
|
+
|
|
5
|
+
87 tools: 44 read + 43 write. Read tools work with zero configuration. Write tools require a wallet mnemonic.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
```jsonc
|
|
10
|
+
// Claude Desktop / Cursor / any MCP client
|
|
11
|
+
{
|
|
12
|
+
"mcpServers": {
|
|
13
|
+
"bostrom": {
|
|
14
|
+
"command": "npx",
|
|
15
|
+
"args": ["-y", "bostrom-mcp"],
|
|
16
|
+
"env": {
|
|
17
|
+
"BOSTROM_MNEMONIC": "your twelve word mnemonic phrase here ..."
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Read-only mode (no mnemonic needed):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx -y bostrom-mcp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Environment variables
|
|
31
|
+
|
|
32
|
+
| Variable | Default | Description |
|
|
33
|
+
|----------|---------|-------------|
|
|
34
|
+
| `BOSTROM_MNEMONIC` | — | Wallet mnemonic for write tools. Without it, only read tools are available. |
|
|
35
|
+
| `BOSTROM_RPC` | `https://rpc.bostrom.cybernode.ai` | RPC endpoint |
|
|
36
|
+
| `BOSTROM_LCD` | `https://lcd.bostrom.cybernode.ai` | LCD/REST endpoint |
|
|
37
|
+
| `BOSTROM_IPFS_API` | `https://io.cybernode.ai` | IPFS API for pinning content |
|
|
38
|
+
| `BOSTROM_GAS_PRICE` | `0.01boot` | Gas price |
|
|
39
|
+
| `BOSTROM_GAS_MULTIPLIER` | `1.4` | Gas estimate multiplier |
|
|
40
|
+
| `BOSTROM_MIN_GAS` | `100000` | Minimum gas limit |
|
|
41
|
+
| `BOSTROM_MAX_SEND_AMOUNT` | — | Circuit breaker: max amount per send (optional) |
|
|
42
|
+
|
|
43
|
+
## Tools
|
|
44
|
+
|
|
45
|
+
### Knowledge Graph — Read (6)
|
|
46
|
+
|
|
47
|
+
| Tool | Description |
|
|
48
|
+
|------|-------------|
|
|
49
|
+
| `graph_search` | Search cyberlinks by particle CID or neuron address |
|
|
50
|
+
| `graph_rank` | Get cyberank score for a particle |
|
|
51
|
+
| `graph_neuron` | Get neuron profile and cyberlink count |
|
|
52
|
+
| `graph_particle` | Fetch particle content by CID from IPFS |
|
|
53
|
+
| `graph_recent_links` | Get the most recent cyberlinks |
|
|
54
|
+
| `graph_stats` | Total cyberlinks and active neurons |
|
|
55
|
+
|
|
56
|
+
### Knowledge Graph — Write (5)
|
|
57
|
+
|
|
58
|
+
| Tool | Description |
|
|
59
|
+
|------|-------------|
|
|
60
|
+
| `graph_create_cyberlink` | Create a single cyberlink between two CIDs |
|
|
61
|
+
| `graph_create_cyberlinks` | Create multiple cyberlinks in one transaction |
|
|
62
|
+
| `graph_investmint` | Convert HYDROGEN into millivolt or milliampere |
|
|
63
|
+
| `graph_pin_content` | Pin text content to IPFS and return the CID |
|
|
64
|
+
| `graph_create_knowledge` | Compound: pin content to IPFS then create cyberlinks |
|
|
65
|
+
|
|
66
|
+
### Economy (6)
|
|
67
|
+
|
|
68
|
+
| Tool | Description |
|
|
69
|
+
|------|-------------|
|
|
70
|
+
| `economy_balances` | All token balances for an address |
|
|
71
|
+
| `economy_supply` | Total supply for a token denom |
|
|
72
|
+
| `economy_mint_price` | Current Volt and Ampere mint prices |
|
|
73
|
+
| `economy_staking` | Delegations, rewards, and unbonding for an address |
|
|
74
|
+
| `economy_pools` | Liquidity pool stats |
|
|
75
|
+
| `economy_inflation` | Current inflation rate and minting parameters |
|
|
76
|
+
|
|
77
|
+
### Wallet (7)
|
|
78
|
+
|
|
79
|
+
| Tool | Description |
|
|
80
|
+
|------|-------------|
|
|
81
|
+
| `wallet_info` | Get wallet address and all balances |
|
|
82
|
+
| `wallet_send` | Send tokens to an address |
|
|
83
|
+
| `wallet_delegate` | Delegate tokens to a validator |
|
|
84
|
+
| `wallet_undelegate` | Undelegate tokens from a validator |
|
|
85
|
+
| `wallet_redelegate` | Move delegation between validators |
|
|
86
|
+
| `wallet_claim_rewards` | Claim staking rewards from a validator |
|
|
87
|
+
| `wallet_vote` | Vote on a governance proposal |
|
|
88
|
+
|
|
89
|
+
### Token Factory (6)
|
|
90
|
+
|
|
91
|
+
| Tool | Description |
|
|
92
|
+
|------|-------------|
|
|
93
|
+
| `token_create` | Create a new token denom (costs ~10,000 BOOT) |
|
|
94
|
+
| `token_set_metadata` | Set token name, symbol, description, exponent |
|
|
95
|
+
| `token_mint` | Mint tokens to an address |
|
|
96
|
+
| `token_burn` | Burn tokens from an address |
|
|
97
|
+
| `token_change_admin` | Transfer token admin to another address |
|
|
98
|
+
| `token_list_created` | List all denoms created by this wallet |
|
|
99
|
+
|
|
100
|
+
### Liquidity & Swap (7)
|
|
101
|
+
|
|
102
|
+
| Tool | Description |
|
|
103
|
+
|------|-------------|
|
|
104
|
+
| `swap_tokens` | Swap tokens with auto pool discovery and price calculation |
|
|
105
|
+
| `swap_estimate` | Preview a swap: find pool, get price, estimate output |
|
|
106
|
+
| `liquidity_create_pool` | Create a Gravity DEX pool (costs ~1,000 BOOT) |
|
|
107
|
+
| `liquidity_deposit` | Deposit tokens into a pool |
|
|
108
|
+
| `liquidity_withdraw` | Withdraw LP tokens from a pool |
|
|
109
|
+
| `liquidity_swap` | Swap via pool with explicit pool ID and limit price |
|
|
110
|
+
| `liquidity_pool_detail` | Get pool reserves, parameters, and batch info |
|
|
111
|
+
|
|
112
|
+
### CosmWasm Contracts (7)
|
|
113
|
+
|
|
114
|
+
| Tool | Description |
|
|
115
|
+
|------|-------------|
|
|
116
|
+
| `contract_execute` | Execute a contract message |
|
|
117
|
+
| `contract_execute_multi` | Execute multiple contract messages atomically |
|
|
118
|
+
| `wasm_upload` | Upload .wasm bytecode to chain |
|
|
119
|
+
| `wasm_instantiate` | Instantiate a contract from code ID |
|
|
120
|
+
| `wasm_migrate` | Migrate a contract to new code |
|
|
121
|
+
| `wasm_update_admin` | Update contract admin |
|
|
122
|
+
| `wasm_clear_admin` | Clear contract admin (irreversible) |
|
|
123
|
+
|
|
124
|
+
### Lithium Mining — Read (25)
|
|
125
|
+
|
|
126
|
+
| Tool | Description |
|
|
127
|
+
|------|-------------|
|
|
128
|
+
| `li_core_config` | Token denom, admin, paused status |
|
|
129
|
+
| `li_burn_stats` | Total LI burned |
|
|
130
|
+
| `li_total_minted` | Total LI minted and supply cap |
|
|
131
|
+
| `li_mine_state` | Full mine state: config, seed, difficulty, stats, epoch, proofs, emission |
|
|
132
|
+
| `li_mine_config` | Difficulty, base reward, period duration, target proofs |
|
|
133
|
+
| `li_seed` | Current mining seed and interval |
|
|
134
|
+
| `li_difficulty` | Current difficulty, min profitable, window proof count |
|
|
135
|
+
| `li_epoch_status` | Current epoch: start/end blocks, proof count, target solutions |
|
|
136
|
+
| `li_proof_stats` | Epoch proof counters and total work |
|
|
137
|
+
| `li_emission` | Emission breakdown: mining, staking, referral |
|
|
138
|
+
| `li_reward_estimate` | Estimate LI reward for a given difficulty |
|
|
139
|
+
| `li_mine_stats` | Aggregate: total proofs, rewards, unique miners |
|
|
140
|
+
| `li_miner_stats` | Per-miner: proofs submitted, total rewards, last proof height |
|
|
141
|
+
| `li_miner_epoch_stats` | Miner's proof count for a specific epoch |
|
|
142
|
+
| `li_verify_proof` | Dry-run verify a proof without submitting |
|
|
143
|
+
| `li_recent_proofs` | Recent proof submission transactions |
|
|
144
|
+
| `li_stake_config` | Unbonding period, linked contracts |
|
|
145
|
+
| `li_total_staked` | Total LI staked across all stakers |
|
|
146
|
+
| `li_stake_info` | Staking state for an address |
|
|
147
|
+
| `li_staking_stats` | Reserve, total staked, reward index |
|
|
148
|
+
| `li_refer_config` | Referral contract config |
|
|
149
|
+
| `li_referrer_of` | Who referred a specific miner |
|
|
150
|
+
| `li_referral_info` | Referral rewards and count for a referrer |
|
|
151
|
+
| `li_community_pool` | Unclaimed community pool balance |
|
|
152
|
+
| `li_miner_tx_history` | Miner's recent contract TX history |
|
|
153
|
+
|
|
154
|
+
### Lithium Mining — Write (5)
|
|
155
|
+
|
|
156
|
+
| Tool | Description |
|
|
157
|
+
|------|-------------|
|
|
158
|
+
| `li_submit_proof` | Submit a mining proof |
|
|
159
|
+
| `li_stake` | Stake LI tokens |
|
|
160
|
+
| `li_unstake` | Unstake LI tokens |
|
|
161
|
+
| `li_claim_rewards` | Claim LI staking rewards |
|
|
162
|
+
| `li_set_referrer` | Set referrer for your address |
|
|
163
|
+
|
|
164
|
+
### Energy Grid (4)
|
|
165
|
+
|
|
166
|
+
| Tool | Description |
|
|
167
|
+
|------|-------------|
|
|
168
|
+
| `grid_create_route` | Create an energy route to another address |
|
|
169
|
+
| `grid_edit_route` | Edit route allocated value (millivolt/milliampere) |
|
|
170
|
+
| `grid_delete_route` | Delete an energy route |
|
|
171
|
+
| `grid_list_routes` | List all routes from an address |
|
|
172
|
+
|
|
173
|
+
### Governance (4)
|
|
174
|
+
|
|
175
|
+
| Tool | Description |
|
|
176
|
+
|------|-------------|
|
|
177
|
+
| `gov_proposals` | List proposals (active, passed, rejected, all) |
|
|
178
|
+
| `gov_proposal_detail` | Full proposal details with vote tally |
|
|
179
|
+
| `gov_validators` | Active validator set with commission and voting power |
|
|
180
|
+
| `gov_params` | Chain parameters |
|
|
181
|
+
|
|
182
|
+
### IBC (2)
|
|
183
|
+
|
|
184
|
+
| Tool | Description |
|
|
185
|
+
|------|-------------|
|
|
186
|
+
| `ibc_transfer` | IBC token transfer to another chain |
|
|
187
|
+
| `ibc_channels` | List IBC channels and their status |
|
|
188
|
+
|
|
189
|
+
### Infrastructure (3)
|
|
190
|
+
|
|
191
|
+
| Tool | Description |
|
|
192
|
+
|------|-------------|
|
|
193
|
+
| `infra_chain_status` | Latest block height, time, chain ID, sync status |
|
|
194
|
+
| `infra_tx_search` | Search transactions by sender, contract, or message type |
|
|
195
|
+
| `infra_tx_detail` | Full decoded transaction by hash |
|
|
196
|
+
|
|
197
|
+
## Agent workflows
|
|
198
|
+
|
|
199
|
+
With write tools enabled, an LLM agent can perform autonomous workflows:
|
|
200
|
+
|
|
201
|
+
- **Lithium mining**: `li_mine_state` → compute proof → `li_verify_proof` → `li_submit_proof` → `li_stake`
|
|
202
|
+
- **Token launch + market**: `token_create` → `token_set_metadata` → `token_mint` → `liquidity_create_pool` → `graph_create_knowledge`
|
|
203
|
+
- **Knowledge graph**: `graph_pin_content` → `graph_create_cyberlink` → `graph_search` → `graph_rank`
|
|
204
|
+
- **Governance**: `gov_proposals` → `gov_proposal_detail` → `wallet_vote`
|
|
205
|
+
- **DeFi**: `swap_estimate` → `swap_tokens` → `liquidity_deposit`
|
|
206
|
+
- **Contract deployment**: `wasm_upload` → `wasm_instantiate` → `contract_execute`
|
|
207
|
+
|
|
208
|
+
## Development
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
npm install
|
|
212
|
+
npm run build
|
|
213
|
+
node dist/index.js
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
MIT
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const IPFS_API = process.env.BOSTROM_IPFS_API ?? "https://io.cybernode.ai";
|
|
2
|
+
/**
|
|
3
|
+
* Pin content to IPFS and return the CID.
|
|
4
|
+
* Supports both kubo API (/api/v0/add) and IPFS Cluster API (/add).
|
|
5
|
+
* Default: https://io.cybernode.ai (cybernode IPFS cluster).
|
|
6
|
+
*/
|
|
7
|
+
export async function ipfsAdd(content) {
|
|
8
|
+
const formData = new FormData();
|
|
9
|
+
formData.append("file", new Blob([content], { type: "text/plain" }));
|
|
10
|
+
// Detect endpoint type: cluster uses /add, kubo uses /api/v0/add
|
|
11
|
+
const isCluster = !IPFS_API.includes("5001") && !IPFS_API.includes("localhost") && !IPFS_API.includes("127.0.0.1");
|
|
12
|
+
const url = isCluster
|
|
13
|
+
? `${IPFS_API}/add?cid-version=0&raw-leaves=false`
|
|
14
|
+
: `${IPFS_API}/api/v0/add?pin=true`;
|
|
15
|
+
const res = await fetch(url, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body: formData,
|
|
18
|
+
signal: AbortSignal.timeout(30_000),
|
|
19
|
+
});
|
|
20
|
+
if (!res.ok) {
|
|
21
|
+
throw new Error(`IPFS add failed (${res.status}): ${res.statusText}`);
|
|
22
|
+
}
|
|
23
|
+
const data = await res.json();
|
|
24
|
+
// Cluster returns { cid }, kubo returns { Hash }
|
|
25
|
+
const cid = data.cid ?? data.Hash;
|
|
26
|
+
if (!cid) {
|
|
27
|
+
throw new Error(`IPFS add: no CID in response: ${JSON.stringify(data)}`);
|
|
28
|
+
}
|
|
29
|
+
return cid;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ipfs-write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipfs-write.js","sourceRoot":"","sources":["../../src/clients/ipfs-write.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,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;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SigningStargateClient, type DeliverTxResponse } from "@cosmjs/stargate";
|
|
2
|
+
import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate";
|
|
3
|
+
import type { EncodeObject } from "@cosmjs/proto-signing";
|
|
4
|
+
/** Get the wallet address (initializes wallet on first call) */
|
|
5
|
+
export declare function getWalletAddress(): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Get a SigningStargateClient with cyber + osmosis + default types registered.
|
|
8
|
+
* Used for chain-native messages (bank, staking, gov, cyberlink, tokenfactory, etc.)
|
|
9
|
+
*/
|
|
10
|
+
export declare function getStargateClient(): Promise<SigningStargateClient>;
|
|
11
|
+
/**
|
|
12
|
+
* Get a SigningCosmWasmClient for contract execution.
|
|
13
|
+
* Includes wasm types (MsgExecuteContract, etc.) automatically.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCosmWasmClient(): Promise<SigningCosmWasmClient>;
|
|
16
|
+
/** Sign and broadcast messages using the stargate client with auto gas */
|
|
17
|
+
export declare function signAndBroadcast(msgs: EncodeObject[], memo?: string): Promise<DeliverTxResponse>;
|
|
18
|
+
/** Format a DeliverTxResponse for tool output */
|
|
19
|
+
export declare function formatTxResult(result: DeliverTxResponse): {
|
|
20
|
+
txHash: string;
|
|
21
|
+
height: number;
|
|
22
|
+
gasUsed: bigint;
|
|
23
|
+
gasWanted: bigint;
|
|
24
|
+
code: number;
|
|
25
|
+
};
|
|
26
|
+
/** Check amount against BOSTROM_MAX_SEND_AMOUNT circuit breaker */
|
|
27
|
+
export declare function checkAmountLimit(amount: string, denom: string): void;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
3
|
+
import { SigningStargateClient, defaultRegistryTypes, GasPrice, } from "@cosmjs/stargate";
|
|
4
|
+
import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate";
|
|
5
|
+
import { Registry } from "@cosmjs/proto-signing";
|
|
6
|
+
// CJS sub-path imports — cyber-ts lacks ESM "exports" field
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const { cyberProtoRegistry } = require("@cybercongress/cyber-ts/cyber/client");
|
|
9
|
+
const { osmosisProtoRegistry } = require("@cybercongress/cyber-ts/osmosis/client");
|
|
10
|
+
const RPC_ENDPOINT = process.env.BOSTROM_RPC ?? "https://rpc.bostrom.cybernode.ai";
|
|
11
|
+
const ADDRESS_PREFIX = "bostrom";
|
|
12
|
+
const GAS_PRICE_STR = process.env.BOSTROM_GAS_PRICE ?? "0.01boot";
|
|
13
|
+
const GAS_MULTIPLIER = Number(process.env.BOSTROM_GAS_MULTIPLIER ?? "1.4");
|
|
14
|
+
let wallet = null;
|
|
15
|
+
let address = null;
|
|
16
|
+
let stargateClient = null;
|
|
17
|
+
let cosmwasmClient = null;
|
|
18
|
+
function requireMnemonic() {
|
|
19
|
+
const mnemonic = process.env.BOSTROM_MNEMONIC;
|
|
20
|
+
if (!mnemonic) {
|
|
21
|
+
throw new Error("BOSTROM_MNEMONIC environment variable is not set. " +
|
|
22
|
+
"Write tools require a wallet. Set BOSTROM_MNEMONIC to enable signing.");
|
|
23
|
+
}
|
|
24
|
+
return mnemonic;
|
|
25
|
+
}
|
|
26
|
+
async function initWallet() {
|
|
27
|
+
if (wallet)
|
|
28
|
+
return;
|
|
29
|
+
const mnemonic = requireMnemonic();
|
|
30
|
+
wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {
|
|
31
|
+
prefix: ADDRESS_PREFIX,
|
|
32
|
+
});
|
|
33
|
+
const [account] = await wallet.getAccounts();
|
|
34
|
+
address = account.address;
|
|
35
|
+
}
|
|
36
|
+
/** Get the wallet address (initializes wallet on first call) */
|
|
37
|
+
export async function getWalletAddress() {
|
|
38
|
+
await initWallet();
|
|
39
|
+
return address;
|
|
40
|
+
}
|
|
41
|
+
/** Build a merged registry: default stargate + cyber + osmosis types */
|
|
42
|
+
function buildRegistry() {
|
|
43
|
+
return new Registry([
|
|
44
|
+
...defaultRegistryTypes,
|
|
45
|
+
...cyberProtoRegistry,
|
|
46
|
+
...osmosisProtoRegistry,
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get a SigningStargateClient with cyber + osmosis + default types registered.
|
|
51
|
+
* Used for chain-native messages (bank, staking, gov, cyberlink, tokenfactory, etc.)
|
|
52
|
+
*/
|
|
53
|
+
export async function getStargateClient() {
|
|
54
|
+
await initWallet();
|
|
55
|
+
if (!stargateClient) {
|
|
56
|
+
const registry = buildRegistry();
|
|
57
|
+
stargateClient = await SigningStargateClient.connectWithSigner(RPC_ENDPOINT, wallet, {
|
|
58
|
+
registry,
|
|
59
|
+
gasPrice: GasPrice.fromString(GAS_PRICE_STR),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return stargateClient;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get a SigningCosmWasmClient for contract execution.
|
|
66
|
+
* Includes wasm types (MsgExecuteContract, etc.) automatically.
|
|
67
|
+
*/
|
|
68
|
+
export async function getCosmWasmClient() {
|
|
69
|
+
await initWallet();
|
|
70
|
+
if (!cosmwasmClient) {
|
|
71
|
+
cosmwasmClient = await SigningCosmWasmClient.connectWithSigner(RPC_ENDPOINT, wallet, {
|
|
72
|
+
gasPrice: GasPrice.fromString(GAS_PRICE_STR),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return cosmwasmClient;
|
|
76
|
+
}
|
|
77
|
+
const MIN_GAS = Number(process.env.BOSTROM_MIN_GAS ?? "100000");
|
|
78
|
+
/** Sign and broadcast messages using the stargate client with auto gas */
|
|
79
|
+
export async function signAndBroadcast(msgs, memo) {
|
|
80
|
+
const client = await getStargateClient();
|
|
81
|
+
const addr = await getWalletAddress();
|
|
82
|
+
const gasEstimate = await client.simulate(addr, msgs, memo);
|
|
83
|
+
const gasLimit = Math.max(Math.ceil(gasEstimate * GAS_MULTIPLIER), MIN_GAS);
|
|
84
|
+
const fee = {
|
|
85
|
+
amount: [{ denom: "boot", amount: String(Math.ceil(gasLimit * 0.01)) }],
|
|
86
|
+
gas: String(gasLimit),
|
|
87
|
+
};
|
|
88
|
+
const result = await client.signAndBroadcast(addr, msgs, fee, memo);
|
|
89
|
+
if (result.code !== 0) {
|
|
90
|
+
throw new Error(`Transaction failed (code ${result.code}): ${result.rawLog}`);
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
/** Format a DeliverTxResponse for tool output */
|
|
95
|
+
export function formatTxResult(result) {
|
|
96
|
+
return {
|
|
97
|
+
txHash: result.transactionHash,
|
|
98
|
+
height: result.height,
|
|
99
|
+
gasUsed: result.gasUsed,
|
|
100
|
+
gasWanted: result.gasWanted,
|
|
101
|
+
code: result.code,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** Check amount against BOSTROM_MAX_SEND_AMOUNT circuit breaker */
|
|
105
|
+
export function checkAmountLimit(amount, denom) {
|
|
106
|
+
const maxStr = process.env.BOSTROM_MAX_SEND_AMOUNT;
|
|
107
|
+
if (!maxStr)
|
|
108
|
+
return;
|
|
109
|
+
const max = BigInt(maxStr);
|
|
110
|
+
const val = BigInt(amount);
|
|
111
|
+
if (val > max) {
|
|
112
|
+
throw new Error(`Amount ${amount} ${denom} exceeds BOSTROM_MAX_SEND_AMOUNT (${maxStr}). ` +
|
|
113
|
+
"Increase the limit or reduce the amount.");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=signing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.js","sourceRoot":"","sources":["../../src/clients/signing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,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;AACnE,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,KAAa;IAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;IACnD,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,UAAU,MAAM,IAAI,KAAK,qCAAqC,MAAM,KAAK;YACzE,0CAA0C,CAC3C,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,26 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
2
3
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
// Read tools
|
|
4
6
|
import { registerGraphTools } from "./tools/graph.js";
|
|
5
7
|
import { registerEconomyTools } from "./tools/economy.js";
|
|
6
8
|
import { registerLithiumTools } from "./tools/lithium.js";
|
|
7
9
|
import { registerGovernanceTools } from "./tools/governance.js";
|
|
8
10
|
import { registerInfraTools } from "./tools/infra.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
// Write tools
|
|
12
|
+
import { registerWalletTools } from "./tools/wallet.js";
|
|
13
|
+
import { registerGraphWriteTools } from "./tools/graph-write.js";
|
|
14
|
+
import { registerContractTools } from "./tools/contract.js";
|
|
15
|
+
import { registerLithiumWriteTools } from "./tools/lithium-write.js";
|
|
16
|
+
import { registerTokenFactoryTools } from "./tools/tokenfactory.js";
|
|
17
|
+
import { registerLiquidityTools } from "./tools/liquidity.js";
|
|
18
|
+
import { registerGridTools } from "./tools/grid.js";
|
|
19
|
+
import { registerIbcTools } from "./tools/ibc.js";
|
|
20
|
+
export function createServer() {
|
|
21
|
+
const server = new McpServer({
|
|
22
|
+
name: "bostrom",
|
|
23
|
+
version: "0.2.0",
|
|
24
|
+
});
|
|
25
|
+
// Read tools (44)
|
|
26
|
+
registerGraphTools(server);
|
|
27
|
+
registerEconomyTools(server);
|
|
28
|
+
registerLithiumTools(server);
|
|
29
|
+
registerGovernanceTools(server);
|
|
30
|
+
registerInfraTools(server);
|
|
31
|
+
// Write tools (43)
|
|
32
|
+
registerWalletTools(server);
|
|
33
|
+
registerGraphWriteTools(server);
|
|
34
|
+
registerContractTools(server);
|
|
35
|
+
registerLithiumWriteTools(server);
|
|
36
|
+
registerTokenFactoryTools(server);
|
|
37
|
+
registerLiquidityTools(server);
|
|
38
|
+
registerGridTools(server);
|
|
39
|
+
registerIbcTools(server);
|
|
40
|
+
return server;
|
|
41
|
+
}
|
|
42
|
+
export const createSandboxServer = createServer;
|
|
43
|
+
const isDirectRun = import.meta.url && process.argv[1] === fileURLToPath(import.meta.url);
|
|
44
|
+
if (isDirectRun) {
|
|
45
|
+
const server = createServer();
|
|
19
46
|
const transport = new StdioServerTransport();
|
|
20
|
-
|
|
47
|
+
server.connect(transport).catch((err) => {
|
|
48
|
+
console.error("Fatal:", err);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
});
|
|
21
51
|
}
|
|
22
|
-
main().catch((err) => {
|
|
23
|
-
console.error("Fatal:", err);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
});
|
|
26
52
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,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C,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Coin } from "@cosmjs/amino";
|
|
2
|
+
/** Execute a single CosmWasm contract message */
|
|
3
|
+
export declare function executeContract(contractAddr: string, msg: Record<string, unknown>, funds?: Coin[], memo?: string): Promise<{
|
|
4
|
+
txHash: string;
|
|
5
|
+
height: number;
|
|
6
|
+
gasUsed: bigint;
|
|
7
|
+
gasWanted: bigint;
|
|
8
|
+
sender: string;
|
|
9
|
+
contract: string;
|
|
10
|
+
}>;
|
|
11
|
+
/** Upload wasm bytecode. Returns code ID. */
|
|
12
|
+
export declare function uploadCode(wasmBytecode: Uint8Array, memo?: string): Promise<{
|
|
13
|
+
codeId: number;
|
|
14
|
+
txHash: string;
|
|
15
|
+
height: number;
|
|
16
|
+
gasUsed: bigint;
|
|
17
|
+
gasWanted: bigint;
|
|
18
|
+
checksum: string;
|
|
19
|
+
sender: string;
|
|
20
|
+
}>;
|
|
21
|
+
/** Upload wasm bytecode from a file path. Returns code ID. */
|
|
22
|
+
export declare function uploadCodeFromFile(filePath: string, memo?: string): Promise<{
|
|
23
|
+
codeId: number;
|
|
24
|
+
txHash: string;
|
|
25
|
+
height: number;
|
|
26
|
+
gasUsed: bigint;
|
|
27
|
+
gasWanted: bigint;
|
|
28
|
+
checksum: string;
|
|
29
|
+
sender: string;
|
|
30
|
+
}>;
|
|
31
|
+
/** Instantiate a contract from a code ID */
|
|
32
|
+
export declare function instantiateContract(codeId: number, msg: Record<string, unknown>, label: string, funds?: Coin[], admin?: string, memo?: string): Promise<{
|
|
33
|
+
contractAddress: string;
|
|
34
|
+
txHash: string;
|
|
35
|
+
height: number;
|
|
36
|
+
gasUsed: bigint;
|
|
37
|
+
gasWanted: bigint;
|
|
38
|
+
codeId: number;
|
|
39
|
+
label: string;
|
|
40
|
+
sender: string;
|
|
41
|
+
}>;
|
|
42
|
+
/** Migrate a contract to a new code ID */
|
|
43
|
+
export declare function migrateContract(contractAddr: string, newCodeId: number, msg: Record<string, unknown>, memo?: string): Promise<{
|
|
44
|
+
txHash: string;
|
|
45
|
+
height: number;
|
|
46
|
+
gasUsed: bigint;
|
|
47
|
+
gasWanted: bigint;
|
|
48
|
+
sender: string;
|
|
49
|
+
contract: string;
|
|
50
|
+
newCodeId: number;
|
|
51
|
+
}>;
|
|
52
|
+
/** Update the admin of a contract */
|
|
53
|
+
export declare function updateContractAdmin(contractAddr: string, newAdmin: string, memo?: string): Promise<{
|
|
54
|
+
txHash: string;
|
|
55
|
+
height: number;
|
|
56
|
+
gasUsed: bigint;
|
|
57
|
+
gasWanted: bigint;
|
|
58
|
+
sender: string;
|
|
59
|
+
contract: string;
|
|
60
|
+
newAdmin: string;
|
|
61
|
+
}>;
|
|
62
|
+
/** Clear the admin of a contract (makes it immutable) */
|
|
63
|
+
export declare function clearContractAdmin(contractAddr: string, memo?: string): Promise<{
|
|
64
|
+
txHash: string;
|
|
65
|
+
height: number;
|
|
66
|
+
gasUsed: bigint;
|
|
67
|
+
gasWanted: bigint;
|
|
68
|
+
sender: string;
|
|
69
|
+
contract: string;
|
|
70
|
+
note: string;
|
|
71
|
+
}>;
|
|
72
|
+
/** Execute multiple contract messages in a single transaction */
|
|
73
|
+
export declare function executeContractMulti(operations: Array<{
|
|
74
|
+
contract: string;
|
|
75
|
+
msg: Record<string, unknown>;
|
|
76
|
+
funds?: Coin[];
|
|
77
|
+
}>, memo?: string): Promise<{
|
|
78
|
+
txHash: string;
|
|
79
|
+
height: number;
|
|
80
|
+
gasUsed: bigint;
|
|
81
|
+
gasWanted: bigint;
|
|
82
|
+
sender: string;
|
|
83
|
+
operationCount: number;
|
|
84
|
+
}>;
|