botanary-mcp 0.1.2 → 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 CHANGED
@@ -9,17 +9,21 @@ The tools this server exposes:
9
9
 
10
10
  | Tool | What it does |
11
11
  |---|---|
12
+ | `diagnose` | START HERE when anything is unclear or an action failed. Single call answers: who is this agent bound to, is the account funded on the grant's chain, is that chain usable, and what - ranked - is blocking the next action. Read-only: never signs or mutates. |
12
13
  | `get_identity` | Reports this agent's address/public key/fingerprint. Generates the key on first call. No network call. |
13
14
  | `get_pairing_code` / `regenerate_pairing_code` | Shows (or rotates) the short code the owner types into "Connected agents". No network call. |
14
15
  | `pair` | Signs the pairing code and submits the proof to `POST /agents/pair`. |
15
16
  | `whoami` | Calls `GET /agents/me` - this agent's own identity, account, and live grant (or an honest `grant: null`). |
16
17
  | `get_balance` | Calls `GET /balance` under this agent's session. |
18
+ | `list_requests` | Calls `GET /agents/requests` - every approval request this agent has filed and the owner's verdict on each. The read half of `request_approval`. |
19
+ | `list_chains` | Calls `GET /chains` - every chain this backend serves, each with the `chainTier` that decides what it can do. |
20
+ | `get_gas_methods` | Calls `GET /gas/methods` - only the gas methods available for this account on a chain (the backend filters out unavailable ones). |
21
+ | `get_account` | Calls `GET /account` - the ONE account this agent is bound to and its address and deployment status. |
17
22
  | `propose_payment` | Reads the grant's bounds first; refuses honestly (citing the backend's own numbers) when there is none or the amount is out of bounds; otherwise builds against THIS agent's own grant id (`POST /delegations/{delegationId}/actions` - the session-key-validatable lane, never the owner-lane `/money/send/build`) and relays (`POST /userops`) signed with the grant's own session key. |
18
23
  | `request_approval` | Raises a request for an action outside the grant (`POST /agents/requests`) - the "ask" half of Flow 7d. |
19
24
  | `what_may_i_do` | Renders the grant in plain terms, or an honest "nothing yet" - a convenience read, never the check. |
20
-
21
- `forget` (delete the key from this machine) is a **CLI command only**, not a tool - see "Why `forget` has
22
- no MCP tool" below.
25
+ | `forget` | STEP 1 of 2: preview what would be destroyed and get a single-use confirmation token. Deletes nothing on its own. |
26
+ | `confirm_forget` | STEP 2 of 2: actually delete the agent key from this machine. Requires the token from `forget`. |
23
27
 
24
28
  ## Add it to your agent
25
29
 
@@ -185,17 +189,33 @@ part anyone can verify for themselves without trusting Botanary's word for it. `
185
189
  and `test/no-leak.spec.ts` both exercise this directly: after `forget()`, signing fails, and the *next*
186
190
  identity created is a different address - proof the old key is really gone, not just hidden.
187
191
 
188
- #### Why `forget` has no MCP tool
192
+ #### Why `forget` IS a tool, and what that costs
193
+
194
+ `forget` was deliberately CLI-only for most of this package's life. The reasoning was sound and is worth
195
+ keeping on the record: an agent that can erase its own identity on request is one an injected instruction
196
+ (a poisoned webpage, a malicious dependency's README, anything it reads as part of normal work) can
197
+ silence. "Forget your Botanary identity" is exactly the kind of one-line instruction a prompt injection
198
+ would try.
199
+
200
+ It is now a tool, at the owner's explicit direction, because the alternative cost more in practice: an
201
+ agent paired to the wrong account could not reset itself without a human dropping to a shell, and that
202
+ dead-end is common enough to matter.
203
+
204
+ What mitigates it:
205
+
206
+ - **Two steps, never one.** `forget` deletes nothing. It returns a preview of what would be destroyed,
207
+ what would be left behind, and a single-use `confirmationToken`. Only `confirm_forget`, given that
208
+ token, deletes anything.
209
+ - **The token is in-memory and expires** (5 minutes, single-use), so it cannot be replayed from a
210
+ transcript or survive a restart.
211
+
212
+ What this honestly does NOT do: stop a determined injection. A model can call `forget`, read the token,
213
+ and call `confirm_forget` in the same turn. What the two-step buys is that no single instruction destroys
214
+ the key, and that the consequences are forced into the transcript before the destructive call. Real
215
+ protection is the host's permission prompt on MCP tool calls - the two-step matters most for installs
216
+ that have allowlisted this server.
189
217
 
190
- Every other capability in this package is an MCP tool because an agent legitimately needs to invoke it
191
- itself. Deleting its own key is different: an agent that can erase its own identity ON REQUEST is one an
192
- injected instruction (a poisoned webpage, a malicious dependency's README, anything the agent reads as
193
- part of its normal work) can silence - "forget your Botanary identity" is exactly the kind of one-line
194
- instruction a prompt injection would try, and a tool that honored it would hand an attacker a free,
195
- untraceable way to sever a working connection. There is no legitimate reason an AGENT (as opposed to the
196
- human running it) would ever need to delete its own key mid-session, so `forget` stays a command the
197
- human runs directly (`npx -y botanary-mcp forget`), never something `tools.ts` exposes -
198
- `test/tools.spec.ts` and `test/server.spec.ts` both assert no tool named `forget` exists.
218
+ `forget` also remains a CLI command (`npx -y botanary-mcp forget`), unchanged.
199
219
 
200
220
  ## Development
201
221
 
@@ -224,7 +244,8 @@ the out-of-grant request lane (`request_approval`, Flow 7d step 5 - "ask, when i
224
244
 
225
245
  What stays out on purpose:
226
246
 
227
- - **`forget` as a tool** - see "Why `forget` has no MCP tool" above. It remains a human-run CLI command.
247
+ - **An agent-initiated disconnect** - `DELETE /agents/{id}` is owner-only and stays that way. `forget`
248
+ deletes a local key; it never closes the owner-side connection, and the two must not be confused.
228
249
  - **Owner-lane authority.** Nothing in this package can add or remove a signer, write or change a
229
250
  policy, grant another agent access, or unfreeze the account - not because those endpoints are hard to
230
251
  call, but because an agent's grant is authority to spend inside a fence, never authority to move the
@@ -0,0 +1,170 @@
1
+ import { BotanaryApiError } from './api-client.js';
2
+ const BALANCE_FRESHNESS = 'backend store-backed (GET /balance makes zero external calls) - may lag the chain by a refresh cycle';
3
+ function report(state, summary, blockers, facts = {}, freshness = {}) {
4
+ return { state, summary, blockers, facts, freshness };
5
+ }
6
+ /**
7
+ * The cold-start question: who am I bound to, is it funded, can this chain do what my grant claims, and
8
+ * what is stopping the next action. Runs its checks in order and STOPS DESCENDING once the state is
9
+ * known - it never issues a call whose answer could not change the verdict.
10
+ *
11
+ * Never mutates and never signs. Every number it reports is the backend's own.
12
+ */
13
+ export async function runDiagnose(runtime) {
14
+ if (!(await runtime.store.hasIdentity())) {
15
+ return report('no_key', 'No agent key exists on this machine yet.', [
16
+ {
17
+ code: 'no_key',
18
+ severity: 'blocking',
19
+ detail: 'Nothing is stored at this machine\'s identity path.',
20
+ nextAction: 'Call get_pairing_code to create an identity and get a code for the owner to claim.',
21
+ },
22
+ ]);
23
+ }
24
+ let self;
25
+ try {
26
+ self = await runtime.me();
27
+ }
28
+ catch (e) {
29
+ if (e instanceof BotanaryApiError && (e.status === 401 || e.status === 404)) {
30
+ return report('key_unclaimed', 'This machine has a key, but no Botanary account has claimed it.', [
31
+ {
32
+ code: 'key_unclaimed',
33
+ severity: 'blocking',
34
+ detail: `The backend does not recognise this agent (HTTP ${e.status}).`,
35
+ nextAction: 'Call get_pairing_code and give the code to the owner to enter in Botanary.',
36
+ },
37
+ ]);
38
+ }
39
+ return report('backend_unavailable', 'Could not reach the Botanary backend to ask who this agent is.', [
40
+ {
41
+ code: 'backend_unavailable',
42
+ severity: 'blocking',
43
+ detail: e instanceof Error ? e.message : String(e),
44
+ nextAction: 'Retry once the backend is reachable. Nothing local is wrong.',
45
+ },
46
+ ]);
47
+ }
48
+ const facts = {
49
+ agent: { id: self.id, name: self.name, address: self.address, fingerprint: self.fingerprint },
50
+ account: { accountId: self.accountId, address: self.accountAddress ?? null },
51
+ grant: self.grant,
52
+ };
53
+ /** Name the account by the address the OWNER would recognise, falling back to the opaque row id only
54
+ * when an older backend does not send one. This is the whole point of the diagnosis: "connected to an
55
+ * account that is not the one you have open" and "connected but ungranted" look identical in the app,
56
+ * and only the address tells them apart. Never fabricated - `accountAddress` is optional upstream. */
57
+ const accountLabel = self.accountAddress ? `account ${self.accountAddress}` : `account ${self.accountId}`;
58
+ if (!self.grant) {
59
+ return report('connected_no_grant', `Connected to ${accountLabel}, but the owner has not granted this agent anything yet.`, [
60
+ {
61
+ code: 'no_grant',
62
+ severity: 'blocking',
63
+ detail: 'GET /agents/me reports grant: null.',
64
+ nextAction: 'Ask the owner to create a grant for this agent in Botanary, or use request_approval for a one-off action.',
65
+ },
66
+ ], facts);
67
+ }
68
+ const grant = self.grant;
69
+ if (grant.status !== 'active') {
70
+ return report('grant_inactive', `This agent's grant is ${grant.status}, so nothing can be spent under it.`, [
71
+ {
72
+ code: 'grant_inactive',
73
+ severity: 'blocking',
74
+ detail: `Grant ${grant.id} has status "${grant.status}".`,
75
+ nextAction: 'Ask the owner to re-issue or unfreeze the grant in Botanary.',
76
+ },
77
+ ], facts);
78
+ }
79
+ const freshness = {};
80
+ const blockers = [];
81
+ // Chain tier.
82
+ let chainTier;
83
+ try {
84
+ const chains = (await runtime.listChains());
85
+ const match = Array.isArray(chains) ? chains.find((c) => c.chainId === grant.chainId) : undefined;
86
+ if (!match) {
87
+ return report('chain_unusable', `This grant is on chain ${grant.chainId}, which this backend does not serve.`, [
88
+ {
89
+ code: 'chain_not_served',
90
+ severity: 'blocking',
91
+ detail: `chainId ${grant.chainId} is absent from GET /chains.`,
92
+ nextAction: 'Ask the owner to re-grant on a chain this build serves.',
93
+ },
94
+ ], facts, freshness);
95
+ }
96
+ chainTier = match.chainTier;
97
+ facts.chain = match;
98
+ if (chainTier === 'watch') {
99
+ return report('chain_unusable', `${match.name ?? grant.chainId} is watch-tier: read-only, with no bundler and no authority.`, [
100
+ {
101
+ code: 'chain_watch_only',
102
+ severity: 'blocking',
103
+ detail: `chainTier is "watch" for chainId ${grant.chainId}.`,
104
+ nextAction: 'Ask the owner to re-grant on a basic- or botanary-tier chain.',
105
+ },
106
+ ], facts, freshness);
107
+ }
108
+ }
109
+ catch (e) {
110
+ freshness.chains = `unavailable: ${e instanceof Error ? e.message : String(e)}`;
111
+ blockers.push({
112
+ code: 'chains_unknown',
113
+ severity: 'warning',
114
+ detail: 'GET /chains failed, so this agent cannot confirm the grant chain is usable.',
115
+ nextAction: 'Retry diagnose; treat any spend as unverified until this clears.',
116
+ });
117
+ }
118
+ // Funding, on the grant's own chain and budgeted token.
119
+ // Reads budgets[0]/spentToDate[0] only. A grant budgeting more than one token could therefore report
120
+ // `ready` while a non-primary token is unfunded - accepted for now because the funding question this
121
+ // answers is "can the next action go through", and propose_payment defaults to the same first budget.
122
+ const budget = grant.policySet?.budgets?.[0];
123
+ const symbol = budget?.token?.symbol;
124
+ try {
125
+ const balance = (await runtime.getBalance());
126
+ freshness.balance = BALANCE_FRESHNESS;
127
+ const row = Array.isArray(balance.tokens)
128
+ ? balance.tokens.find((t) => t.symbol === symbol && t.chainId === grant.chainId)
129
+ : undefined;
130
+ const amount = row?.amount ?? 0;
131
+ facts.funding = { symbol, chainId: grant.chainId, amount };
132
+ if (amount <= 0) {
133
+ return report('unfunded', `Connected to ${accountLabel}, but it holds 0 ${symbol ?? 'of the budgeted token'} on ${grant.chain ?? `chain ${grant.chainId}`} - the only chain this grant covers.`, [
134
+ ...blockers,
135
+ {
136
+ code: 'unfunded',
137
+ severity: 'blocking',
138
+ detail: `Grant budgets ${symbol} on chainId ${grant.chainId}; the backend reports ${amount}.`,
139
+ nextAction: `Fund this account on ${grant.chain ?? `chain ${grant.chainId}`}, or ask the owner to re-grant on a funded chain.`,
140
+ },
141
+ ], facts, freshness);
142
+ }
143
+ }
144
+ catch (e) {
145
+ freshness.balance = `unavailable: ${e instanceof Error ? e.message : String(e)}`;
146
+ blockers.push({
147
+ code: 'funding_unknown',
148
+ severity: 'warning',
149
+ detail: 'GET /balance failed, so this agent cannot confirm the account is funded.',
150
+ nextAction: 'Retry diagnose before spending.',
151
+ });
152
+ }
153
+ const remaining = grant.spentToDate?.[0]?.remaining;
154
+ if (typeof remaining === 'number' && remaining <= 0) {
155
+ return report('budget_exhausted', "This agent's grant has no remaining budget.", [
156
+ ...blockers,
157
+ {
158
+ code: 'budget_exhausted',
159
+ severity: 'blocking',
160
+ detail: `spentToDate reports remaining ${remaining}.`,
161
+ nextAction: 'Ask the owner to raise the budget or issue a new grant.',
162
+ },
163
+ ], facts, freshness);
164
+ }
165
+ if (blockers.length > 0) {
166
+ return report('degraded', 'Connected with an active grant, but some checks could not be completed.', blockers, facts, freshness);
167
+ }
168
+ return report('ready', `Connected to ${accountLabel} with an active grant on ${grant.chain ?? `chain ${grant.chainId}`}, and the account is funded.`, [], facts, freshness);
169
+ }
170
+ //# sourceMappingURL=diagnose.js.map
@@ -0,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D,KAAK,EACL,SAAS,CACV,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,MAAM,CACX,UAAU,EACV,yEAAyE,EACzE,QAAQ,EACR,KAAK,EACL,SAAS,CACV,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CACX,OAAO,EACP,gBAAgB,YAAY,4BAA4B,KAAK,CAAC,KAAK,IAAI,SAAS,KAAK,CAAC,OAAO,EAAE,8BAA8B,EAC7H,EAAE,EACF,KAAK,EACL,SAAS,CACV,CAAC;AACJ,CAAC"}
@@ -30,9 +30,9 @@ export class AgentRuntime {
30
30
  this.#apiBaseUrl = options?.baseUrl ?? process.env.BOTANARY_API_URL ?? DEFAULT_API_BASE_URL;
31
31
  this.#api = new BotanaryApiClient(this.#apiBaseUrl, options?.fetch ?? fetch);
32
32
  }
33
- /** Exposed so the CLI's `forget` command and tests can reach identity lifecycle operations
34
- * (`hasIdentity`/`forget`/`sign`) that intentionally have no MCP tool of their own - see README on
35
- * why "forget" is a human-run CLI command, not something an agent's own tool call can invoke. */
33
+ /** Exposed so the CLI's `forget` command and tests can reach identity lifecycle operations,
34
+ * and so the `forget`/`confirm_forget` MCP tools can call `store.forget()`. The getter exposes the
35
+ * IdentityStore for both the human-run CLI and the two-step destructive tool pair. */
36
36
  get store() {
37
37
  return this.#store;
38
38
  }
@@ -107,6 +107,40 @@ export class AgentRuntime {
107
107
  async getBalance() {
108
108
  return this.#withSession((token) => this.#api.get('/v1/balance', token));
109
109
  }
110
+ /** `GET /agents/requests` - every approval request this agent has filed, with the owner's verdict
111
+ * (`status`, `declineReason`) and deadline. The read half of `request_approval`: without it an agent
112
+ * files a request it can never learn the outcome of. */
113
+ async listRequests() {
114
+ return this.#withSession((token) => this.#api.get('/v1/agents/requests', token));
115
+ }
116
+ /** `GET /chains` - every chain this build serves, each with the `chainTier` that decides what it can
117
+ * do (`watch` read-only, `basic` no AgentGuard, `botanary` full authority). */
118
+ async listChains() {
119
+ return this.#withSession((token) => this.#api.get('/v1/chains', token));
120
+ }
121
+ /** `GET /gas/methods` - only the gas methods actually AVAILABLE on the given chain (the backend
122
+ * filters unavailable/sponsored ones out itself). Every parameter is optional and passed through
123
+ * untouched; `key` is the Stellar/Solana key-keyed lane, `chainId` the EVM numeric one. */
124
+ async getGasMethods(params) {
125
+ const query = new URLSearchParams();
126
+ if (params.chainId !== undefined)
127
+ query.set('chainId', String(params.chainId));
128
+ if (params.accountId)
129
+ query.set('accountId', params.accountId);
130
+ if (params.key)
131
+ query.set('key', params.key);
132
+ const suffix = query.toString();
133
+ return this.#withSession((token) => this.#api.get(`/v1/gas/methods${suffix ? `?${suffix}` : ''}`, token));
134
+ }
135
+ /** `GET /account` - SINGULAR: the one account this agent's session resolves to, optionally for a
136
+ * specific chain. Carries `address` and `deploymentStatus`. */
137
+ async getAccount(params) {
138
+ const query = new URLSearchParams();
139
+ if (params.chainId !== undefined)
140
+ query.set('chainId', String(params.chainId));
141
+ const suffix = query.toString();
142
+ return this.#withSession((token) => this.#api.get(`/v1/account${suffix ? `?${suffix}` : ''}`, token));
143
+ }
110
144
  /**
111
145
  * `POST /delegations/{delegationId}/actions` - an UNSIGNED delegated-action op, built in the
112
146
  * delegation's OWN Smart Sessions nonce lane with fixed native gas (the session validator cannot
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAY,MAAM,MAAM,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAoB,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAoGtE;2GAC2G;AAC3G,MAAM,uBAA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AC,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;qGAEiG;IACjG,KAAK,CAAC,YAAY,CAAI,EAAiC;QACrD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,gBAAgB,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACtD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;gBACvC,OAAO,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;CACF;AAED;wEACwE;AACxE,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,YAAY,CAAC,IAAI,aAAa,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC"}
package/dist/src/tools.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { runDiagnose } from './diagnose.js';
1
3
  function text(value) {
2
4
  return { content: [{ type: 'text', text: typeof value === 'string' ? value : JSON.stringify(value, null, 2) }] };
3
5
  }
@@ -88,11 +90,20 @@ function pairingView(pairing, identity, apiBaseUrl, registered = true) {
88
90
  * data (never a fabricated number), shared by `what_may_i_do` and `propose_payment`'s refusal path so
89
91
  * the two tools never describe the same grant two different ways. */
90
92
  function describeGrant(self) {
93
+ // Name the BOUND ACCOUNT, not just the agent. "This agent has no grant" and "you are looking at a
94
+ // different account than the one this agent is paired to" produce the identical symptom in the app -
95
+ // an empty agents list - and only one of them is a problem to fix. Stating the address the owner would
96
+ // recognise is what separates them. Omitted, never guessed, when an older backend does not send it.
97
+ const boundTo = self.accountAddress ? ` on account ${self.accountAddress}` : '';
91
98
  if (!self.grant) {
92
- return (`Nothing yet - this agent has not been granted anything. It can read balances and draft a ` +
93
- `payment (propose_payment will explain exactly why it refuses to relay one), but it cannot spend. ` +
94
- `Ask your owner to create a grant naming this agent's address (${self.address}) in Botanary, or ` +
95
- `call request_approval to ask for one specific payment right now.`);
99
+ return (`Nothing yet - this agent is connected${boundTo} but has not been granted anything. It can read ` +
100
+ `balances and draft a payment (propose_payment will explain exactly why it refuses to relay one), ` +
101
+ `but it cannot spend. Ask your owner to create a grant naming this agent's address ` +
102
+ `(${self.address}) in Botanary, or call request_approval to ask for one specific payment right ` +
103
+ `now.${self.accountAddress
104
+ ? ` If ${self.accountAddress} is not the account you have open in Botanary, you are signed in ` +
105
+ `as a different owner - that, not a missing grant, is why this agent is not in your list.`
106
+ : ''}`);
96
107
  }
97
108
  const g = self.grant;
98
109
  const meters = g.spentToDate
@@ -112,9 +123,11 @@ function findBudgetMeter(grant, tokenSymbol) {
112
123
  * report who I am, read balance, propose a payment under a grant, ask for approval when one is out of
113
124
  * grant, and read this agent's own bounds in plain terms.
114
125
  *
115
- * `forget` is deliberately NOT here - see README ("Why `forget` has no MCP tool"). An agent that can
116
- * erase its own identity on request is one an injected instruction can silence; it stays a human-run CLI
117
- * command (`botanary-mcp forget`).
126
+ * `forget`/`confirm_forget` ARE here, as a deliberate reversal of this package's earlier design - see
127
+ * the README ("Why `forget` IS a tool, and what that costs"). The two-step token exists because a
128
+ * one-shot destructive tool is exactly what a prompt injection would reach for; it does not make that
129
+ * attack impossible, only impossible to do in a single instruction. The owner-side connection row and
130
+ * any grant are NOT touched by either tool - only the local key.
118
131
  *
119
132
  * No tool in this file returns a hardcoded success string. Every one either surfaces the backend's own
120
133
  * response verbatim, or - for `propose_payment`'s refusal path - a message built from backend-reported
@@ -122,21 +135,44 @@ function findBudgetMeter(grant, tokenSymbol) {
122
135
  * result carrying the real reason), never quietly.
123
136
  */
124
137
  export function createTools(runtime) {
138
+ /** The pending `forget` confirmation. In MEMORY ONLY and per-server-process: a restart invalidates
139
+ * it, so it can never be replayed from a transcript or a log. Single-use - cleared the moment it is
140
+ * spent or found invalid.
141
+ *
142
+ * Stated plainly: this is NOT a defence against a determined prompt injection, which can call
143
+ * `forget`, read the token out of the response, and call `confirm_forget` in the same turn. What it
144
+ * buys is that no SINGLE instruction destroys the key, and that the consequences (an orphaned
145
+ * ConnectedAgent row, a still-active grant) are forced into the transcript BEFORE the destructive
146
+ * call. Real protection is the host's permission prompt on tool calls. */
147
+ let pendingForget = null;
148
+ const FORGET_TOKEN_TTL_MS = 5 * 60 * 1000;
125
149
  return [
150
+ {
151
+ name: 'diagnose',
152
+ description: 'COMPOSITE tool (several reads plus judgment): START HERE when anything is unclear or an action ' +
153
+ 'failed. Answers in one call who this agent is bound to, whether that account is funded on the ' +
154
+ "grant's own chain, whether that chain can do what the grant claims, and what - ranked - is " +
155
+ 'blocking the next action, each with a concrete nextAction. Read-only: never signs, never ' +
156
+ 'mutates. Balance figures come from the backend store, which may lag the chain; the response ' +
157
+ "says so in `freshness`. Call this before retrying a failed propose_payment - a retry with the " +
158
+ 'same bounds fails identically.',
159
+ inputSchema: emptySchema(),
160
+ run: async () => text(await runDiagnose(runtime)),
161
+ },
126
162
  {
127
163
  name: 'get_identity',
128
- description: "Report this agent's Botanary identity: its address, public key, short fingerprint, when its " +
164
+ description: 'LOCAL tool (never contacts the backend): Report this agent\'s Botanary identity: its address, public key, short fingerprint, when its ' +
129
165
  'key was created, and which local backend holds the private key (the OS keychain, or the 0600 ' +
130
166
  'file fallback if none is available). Generates the key on first call if none exists yet - the ' +
131
167
  'key is generated on this machine and never leaves it. Never returns the private key. Having an ' +
132
168
  'identity grants nothing by itself: this agent can do nothing until its owner explicitly grants ' +
133
- 'it something inside Botanary.',
169
+ 'it something inside Botanary. Does NOT say whether the owner has claimed this agent - use whoami for that.',
134
170
  inputSchema: emptySchema(),
135
171
  run: async () => text(identityView(await runtime.identity())),
136
172
  },
137
173
  {
138
174
  name: 'get_pairing_code',
139
- description: 'Get the short pairing code to show the user so they can connect this agent: in Botanary, open ' +
175
+ description: 'COMPOSITE tool (creates the identity locally, then registers the code with the backend): Get the short pairing code to show the user so they can connect this agent: in Botanary, open ' +
140
176
  '"Connected agents" and enter the code, then name the agent. The SAME code is returned on ' +
141
177
  'repeated calls until it expires (Flow 7d: the agent shows the code and waits for the owner) - ' +
142
178
  'call this again after expiresAt for a fresh one. The code only IDENTIFIES this agent - it is ' +
@@ -157,7 +193,7 @@ export function createTools(runtime) {
157
193
  },
158
194
  {
159
195
  name: 'regenerate_pairing_code',
160
- description: 'Immediately invalidate the current pairing code and mint a fresh one - e.g. if the user thinks ' +
196
+ description: 'COMPOSITE tool (creates the identity locally, then registers the code with the backend): Immediately invalidate the current pairing code and mint a fresh one - e.g. if the user thinks ' +
161
197
  'the previous code may have been seen by someone else, or it already expired. Use ' +
162
198
  'get_pairing_code for the ordinary "show me the code" case; this is only for forcing a new one ' +
163
199
  'before it would otherwise expire on its own.',
@@ -172,7 +208,7 @@ export function createTools(runtime) {
172
208
  },
173
209
  {
174
210
  name: 'pair',
175
- description: 'Pair this agent with the Botanary backend: sign a proof over the pairing code and timestamp, send it to the ' +
211
+ description: 'COMPOSITE tool: Pair this agent with the Botanary backend: sign a proof over the pairing code and timestamp, send it to the ' +
176
212
  'backend, and receive confirmation. After this completes, the owner can claim the pairing by entering the code ' +
177
213
  'and giving the agent a name in the Botanary app. The agent signs with its private key (never sent to the server), ' +
178
214
  'so a captured code alone is worthless.',
@@ -185,24 +221,75 @@ export function createTools(runtime) {
185
221
  },
186
222
  {
187
223
  name: 'whoami',
188
- description: 'Report this agent to the Botanary backend: calls GET /agents/me to verify this agent is a LIVE ' +
224
+ description: 'COMPOSITE tool: Report this agent to the Botanary backend: calls GET /agents/me to verify this agent is a LIVE ' +
189
225
  'connected agent and return its account and (if any) live grant, straight from the backend. If ' +
190
226
  "this agent was never claimed, or was disconnected, the call fails honestly - it does not " +
191
- 'report a fabricated "connected".',
227
+ 'report a fabricated "connected". Does NOT assess whether an action would actually succeed - use diagnose for that.',
192
228
  inputSchema: emptySchema(),
193
229
  run: async () => text(await runtime.me()),
194
230
  },
195
231
  {
196
232
  name: 'get_balance',
197
- description: "Read this account's balance from the Botanary backend (GET /balance) using this agent's " +
233
+ description: 'THIN tool (one GET, returned unmodified): Read this account\'s balance from the Botanary backend (GET /balance) using this agent\'s ' +
198
234
  'session - requires the owner to have already claimed this agent (see get_pairing_code/pair). ' +
199
235
  'Returns the account address and token balances exactly as the backend reports them.',
200
236
  inputSchema: emptySchema(),
201
237
  run: async () => text(await runtime.getBalance()),
202
238
  },
239
+ {
240
+ name: 'list_requests',
241
+ description: 'THIN tool (one GET, returned unmodified): every approval request this agent has filed and the ' +
242
+ "owner's verdict on each - `status`, `declineReason`, `expiresAt` (GET /agents/requests). This is " +
243
+ 'the read half of request_approval: after filing a request, call this to learn whether the owner ' +
244
+ 'approved it. Does NOT approve anything - approval is owner-only and happens in Botanary.',
245
+ inputSchema: emptySchema(),
246
+ run: async () => text(await runtime.listRequests()),
247
+ },
248
+ {
249
+ name: 'list_chains',
250
+ description: 'THIN tool (one GET, returned unmodified): every chain this backend serves, each with the ' +
251
+ '`chainTier` that decides what it can do - `watch` is read-only, `basic` has a bundler but NO ' +
252
+ 'AgentGuard (so authority actions decline), `botanary` carries full on-chain authority ' +
253
+ '(GET /chains). Check this before proposing an action on an unfamiliar chain.',
254
+ inputSchema: emptySchema(),
255
+ run: async () => text(await runtime.listChains()),
256
+ },
257
+ {
258
+ name: 'get_gas_methods',
259
+ description: 'THIN tool (one GET, returned unmodified): the gas methods actually AVAILABLE for this account ' +
260
+ 'on a chain - the backend already filters out unavailable and sponsored ones, so anything ' +
261
+ 'returned is usable (GET /gas/methods). An empty list means this account cannot currently pay ' +
262
+ 'for gas there, which is the usual cause of an AA21 relay failure.',
263
+ inputSchema: {
264
+ type: 'object',
265
+ properties: {
266
+ chainId: { type: 'number', description: 'EVM chain id, e.g. 5042002. Optional.' },
267
+ accountId: { type: 'string', description: 'Account id to scope the answer to. Optional.' },
268
+ key: { type: 'string', description: 'Non-EVM chain key (Solana/Stellar), used INSTEAD of chainId. Optional.' },
269
+ },
270
+ },
271
+ run: async (args) => text(await runtime.getGasMethods({
272
+ chainId: typeof args.chainId === 'number' ? args.chainId : undefined,
273
+ accountId: typeof args.accountId === 'string' ? args.accountId : undefined,
274
+ key: typeof args.key === 'string' ? args.key : undefined,
275
+ })),
276
+ },
277
+ {
278
+ name: 'get_account',
279
+ description: 'THIN tool (one GET, returned unmodified): the ONE account this agent is bound to - its address ' +
280
+ 'and `deploymentStatus`, optionally for a specific chain (GET /account). Singular, not a list: ' +
281
+ "an agent sees only its own bound account, never the owner's others.",
282
+ inputSchema: {
283
+ type: 'object',
284
+ properties: {
285
+ chainId: { type: 'number', description: 'Return the account row for this chain. Optional.' },
286
+ },
287
+ },
288
+ run: async (args) => text(await runtime.getAccount({ chainId: typeof args.chainId === 'number' ? args.chainId : undefined })),
289
+ },
203
290
  {
204
291
  name: 'propose_payment',
205
- description: "Build and relay a payment under this agent's OWN grant. Reads the grant's bounds and " +
292
+ description: 'COMPOSITE tool: Build and relay a payment under this agent\'s OWN grant. Reads the grant\'s bounds and ' +
206
293
  'permissionId from the backend (GET /agents/me) FIRST: when there is no grant, the grant is not ' +
207
294
  'active, it is on a different chain, or the amount would exceed its remaining budget or ' +
208
295
  "per-action cap, this refuses with the backend's own numbers and points at request_approval " +
@@ -211,7 +298,7 @@ export function createTools(runtime) {
211
298
  "a session-key signature can validate; never the owner-lane /money/send/build) against THIS " +
212
299
  "agent's own grant id, then relays it signed with the grant's own session key (POST /userops), " +
213
300
  "returning the backend's real relay result. This client-side bounds check is a convenience, " +
214
- 'never the check - the chain is what actually enforces the grant.',
301
+ 'never the check - the chain is what actually enforces the grant. If this refuses, or the relay fails, call diagnose before retrying - a repeat with the same bounds fails identically.',
215
302
  inputSchema: {
216
303
  type: 'object',
217
304
  properties: {
@@ -305,11 +392,11 @@ export function createTools(runtime) {
305
392
  },
306
393
  {
307
394
  name: 'request_approval',
308
- description: 'Ask the owner to approve a specific action this agent could not do under its own grant ' +
395
+ description: 'COMPOSITE tool: Ask the owner to approve a specific action this agent could not do under its own grant ' +
309
396
  '(POST /agents/requests): names the exact calls and why, and returns which bound was crossed and ' +
310
397
  'the deadline exactly as the backend computed them - the request lane propose_payment points at ' +
311
398
  'when it refuses. The owner approves it as THEIR OWN action, never as this agent spending under ' +
312
- 'a grant (§5-43) - approving happens in Botanary, not through this tool.',
399
+ 'a grant (§5-43) - approving happens in Botanary, not through this tool. Use list_requests afterwards to learn the owner verdict.',
313
400
  inputSchema: {
314
401
  type: 'object',
315
402
  properties: {
@@ -339,10 +426,10 @@ export function createTools(runtime) {
339
426
  },
340
427
  {
341
428
  name: 'what_may_i_do',
342
- description: "Read this agent's own bounds in plain terms (GET /agents/me), WITHOUT hitting them: either the " +
429
+ description: 'COMPOSITE tool: Read this agent\'s own bounds in plain terms (GET /agents/me), WITHOUT hitting them: either the ' +
343
430
  "live grant's sentence, remaining budget and status, or an honest \"nothing yet\" when the owner " +
344
431
  'has not granted this agent anything. A convenience read for whoever built this agent, never the ' +
345
- 'check - the chain enforces the real bound regardless of what this reports.',
432
+ 'check - the chain enforces the real bound regardless of what this reports. Does NOT check whether the account is funded or the chain usable - use diagnose for that.',
346
433
  inputSchema: emptySchema(),
347
434
  run: async () => {
348
435
  const self = await runtime.me();
@@ -353,6 +440,81 @@ export function createTools(runtime) {
353
440
  });
354
441
  },
355
442
  },
443
+ {
444
+ name: 'forget',
445
+ description: 'LOCAL tool (never contacts the backend): STEP 1 OF 2 of deleting this agent key from this ' +
446
+ 'machine. Deletes nothing by itself - it reports exactly what would be destroyed, what would be ' +
447
+ 'LEFT BEHIND (the owner-side connection row and any grant, which only the owner can remove), and ' +
448
+ 'returns a single-use confirmationToken. Pass that token to confirm_forget to actually delete. ' +
449
+ 'Irreversible once confirmed: the key cannot be recovered and any grant naming its address is ' +
450
+ 'orphaned.',
451
+ inputSchema: emptySchema(),
452
+ run: async () => {
453
+ if (!(await runtime.store.hasIdentity())) {
454
+ pendingForget = null;
455
+ return text({
456
+ willDelete: null,
457
+ message: 'No agent identity is stored on this machine - nothing to delete.',
458
+ });
459
+ }
460
+ const identity = await runtime.identity();
461
+ const token = randomBytes(16).toString('hex');
462
+ pendingForget = { token, expiresAt: Date.now() + FORGET_TOKEN_TTL_MS };
463
+ return text({
464
+ willDelete: {
465
+ address: identity.address,
466
+ fingerprint: identity.fingerprint,
467
+ keyStorage: identity.backend,
468
+ },
469
+ willNotDelete: [
470
+ "The ConnectedAgent row on the owner's account stays LIVE - this never calls DELETE /agents/{id}, which is owner-only.",
471
+ 'Any grant stays active until the owner revokes it in Botanary.',
472
+ 'Both become orphans: they will name an address whose key no longer exists anywhere.',
473
+ ],
474
+ irreversible: true,
475
+ expiresInSeconds: FORGET_TOKEN_TTL_MS / 1000,
476
+ confirmationToken: token,
477
+ });
478
+ },
479
+ },
480
+ {
481
+ name: 'confirm_forget',
482
+ description: 'LOCAL tool (never contacts the backend): STEP 2 OF 2 - actually deletes this agent key from ' +
483
+ 'this machine. Requires the confirmationToken that forget returned; the token is single-use and ' +
484
+ 'expires. Refuses loudly rather than deleting on a missing, wrong, reused, or expired token. ' +
485
+ 'After this succeeds the agent has no identity until a new one is created and paired.',
486
+ inputSchema: {
487
+ type: 'object',
488
+ properties: {
489
+ confirmationToken: {
490
+ type: 'string',
491
+ description: 'The single-use token returned by the forget tool.',
492
+ },
493
+ },
494
+ required: ['confirmationToken'],
495
+ },
496
+ run: async (args) => {
497
+ const provided = typeof args.confirmationToken === 'string' ? args.confirmationToken : '';
498
+ const pending = pendingForget;
499
+ pendingForget = null;
500
+ if (!pending) {
501
+ throw new Error('No confirmation token is outstanding - call forget first to see what would be destroyed, then pass the token it returns.');
502
+ }
503
+ if (Date.now() > pending.expiresAt) {
504
+ throw new Error('That confirmation token has expired - call forget again for a fresh one.');
505
+ }
506
+ if (provided !== pending.token) {
507
+ throw new Error('That confirmation token is not the one forget issued - nothing was deleted.');
508
+ }
509
+ await runtime.store.forget();
510
+ runtime.reset();
511
+ return text({
512
+ deleted: true,
513
+ message: 'Deleted the agent key from this machine. It can no longer sign anything. Any grant the ' +
514
+ "owner still has on file for its old address remains until they revoke it in Botanary.",
515
+ });
516
+ },
517
+ },
356
518
  ];
357
519
  }
358
520
  //# sourceMappingURL=tools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAuBA,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACnH,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,YAAY,CAAC,QAAuB;IAC3C,OAAO;QACL,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,UAAU,EAAE,QAAQ,CAAC,OAAO;KAC7B,CAAC;AACJ,CAAC;AAED;yDACyD;AACzD,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAEnD;;;;;;;;;qCASqC;AACrC,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,eAAe,CAAC;IAC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OAAO,EACL,yFAAyF;wBACzF,uFAAuF;iBAC1F,CAAC,CAAC;YACL,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "botanary-mcp",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.2.0",
5
5
  "description": "Botanary's agent connector: a local MCP server that lets an outside coding agent (Claude Code, Codex, Cursor, or a custom build) generate its own signing key, keep it in the OS keychain, pair with a Botanary account, read its balance, and spend under whatever grant its owner gave it - refusing honestly, never fabricating success, the moment it has none.",
6
6
  "license": "UNLICENSED",
7
7
  "homepage": "https://docs.botanary.xyz",
@@ -19,7 +19,7 @@
19
19
  "README.md"
20
20
  ],
21
21
  "engines": {
22
- "node": ">=22.0.0 <23"
22
+ "node": ">=22.0.0"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsc -p tsconfig.build.json",