@buildaureon/mcp 0.1.1

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/docs/auth.md ADDED
@@ -0,0 +1,349 @@
1
+ # Authentication Guide
2
+
3
+ How **`@buildaureon/mcp`** `v0.1.1` authenticates to the live AUREON API — aligned with `@buildaureon/sdk`, safe for humans and for agents that call the **34** stdio tools.
4
+
5
+ Related docs: [Setup](./setup.md) · [Tools](./tools.md) · [Agent guide](./agent-guide.md) · [Architecture](./architecture.md) · [Security](./security.md) · [Package README](../README.md)
6
+
7
+ ---
8
+
9
+ ## Who this is for
10
+
11
+ - **Agent operators** wiring Cursor or Claude Desktop with an issued developer key
12
+ - **Integrators** comparing MCP auth to the typed SDK client
13
+ - **Security reviewers** checking that private keys never enter the MCP process
14
+ - **Agents** reading this file as context before calling `aureon_me`, restore, or vault prepare tools
15
+
16
+ If you have not configured the host yet, start with [./setup.md](./setup.md), then return here for credential semantics.
17
+
18
+ ---
19
+
20
+ ## Goals of MCP auth
21
+
22
+ 1. Reach `https://api.aureonlabs.network` with credentials the gateway accepts.
23
+ 2. Bind control-plane actions to a wallet identity (issued key or Bearer session).
24
+ 3. Keep signing and broadcasting of on-chain vault steps **outside** MCP.
25
+ 4. Prefer a long-lived issued key for always-on agents over interactive wallet handshakes.
26
+
27
+ The operator utility at [app.aureonlabs.network](https://app.aureonlabs.network) remains wallet-Bearer oriented for humans. MCP and the SDK share the issued-key path for automation.
28
+
29
+ ---
30
+
31
+ ## Credential types
32
+
33
+ | Credential | Where you get it | Put it in MCP? | What it does |
34
+ | --- | --- | --- | --- |
35
+ | **Issued developer API key** | Developers page → create key | Yes — `AUREON_API_KEY` | Product access **and** wallet identity for control-plane tools. **Recommended.** |
36
+ | **Bootstrap / env-style key** | Rare / special environments | Only if explicitly issued for that purpose as `AUREON_API_KEY` | Same transport header as an issued key; treat with equal secrecy. Prefer Developers-issued keys for production agents. |
37
+ | **Wallet Bearer token** | Wallet sign-in, or `aureon_verify_wallet` | Optional — `AUREON_AUTH_TOKEN` or in-process after verify | Session for utility-style identity. **Wins** when both key and Bearer are present. |
38
+ | **Wallet private key** | Your wallet / HSM / signing bot | **Never** in MCP env | Sign and broadcast deposit/withdraw txs **outside** MCP after prepare tools return unsigned steps. |
39
+
40
+ Plain language:
41
+
42
+ - **Issued key** = “this agent may call the API as my Developers-bound wallet.”
43
+ - **Bearer** = “this process has an active wallet session.”
44
+ - **Private key** = “this other process may move funds on chain.” MCP does not hold that.
45
+
46
+ ---
47
+
48
+ ## Environment variables (auth-focused)
49
+
50
+ | Variable | Role |
51
+ | --- | --- |
52
+ | `AUREON_API_KEY` | Preferred. Issued developer key from [app.aureonlabs.network](https://app.aureonlabs.network) **Developers**. |
53
+ | `AUREON_AUTH_TOKEN` | Optional Bearer. Use when you intentionally want a session without (or in addition to) a key — see conflict rules below. |
54
+ | `AUREON_API_URL` | Defaults to `https://api.aureonlabs.network`. Leave default for public use. |
55
+
56
+ Startup rule: at least one of `AUREON_API_KEY` or `AUREON_AUTH_TOKEN` must be set or the MCP process exits with a clear error.
57
+
58
+ See also the setup tables in [./setup.md](./setup.md).
59
+
60
+ ---
61
+
62
+ ## Recommended path: issued developer key
63
+
64
+ This is the default for Cursor, Claude, and other always-on agents.
65
+
66
+ ### Steps
67
+
68
+ 1. Open [https://app.aureonlabs.network](https://app.aureonlabs.network).
69
+ 2. Connect the wallet that should own objectives and Capital Book state.
70
+ 3. Open **Developers** and create a key (name it after the host, e.g. `cursor-mcp`).
71
+ 4. Copy the secret once into the host MCP `env` as `AUREON_API_KEY`.
72
+ 5. Do **not** set `AUREON_AUTH_TOKEN` unless you have a specific reason.
73
+ 6. Restart the host and call `aureon_ping` then `aureon_me`.
74
+
75
+ Minimal env:
76
+
77
+ ```bash
78
+ AUREON_API_URL=https://api.aureonlabs.network
79
+ AUREON_API_KEY=aureon_....
80
+ ```
81
+
82
+ With only the issued key, agents can sync portfolio, create objectives, fetch restore plans, restore, refresh watchdog, and manage developer keys — without an interactive signature each session.
83
+
84
+ Rotate or revoke from the same Developers page if the secret is exposed. Update the host config immediately after rotation.
85
+
86
+ ---
87
+
88
+ ## Optional wallet handshake (Bearer session)
89
+
90
+ Use when you need a utility-style session, when debugging auth, or when an issued key is unavailable and you already hold a Bearer.
91
+
92
+ ### Tools involved
93
+
94
+ | Tool | Role |
95
+ | --- | --- |
96
+ | `aureon_get_auth_nonce` | Fetch an EIP-191 challenge message for an address |
97
+ | `aureon_verify_wallet` | Submit address + message + signature (+ optional invite); **stores** the returned Bearer in-process |
98
+ | `aureon_logout` | Revoke the session server-side and clear the in-process token |
99
+ | `aureon_me` | Show the wallet for the active key or Bearer |
100
+ | `aureon_dev_login` | Preview-only login — **not** available on the production API |
101
+
102
+ ### Sequence
103
+
104
+ ```text
105
+ Agent → aureon_get_auth_nonce(address)
106
+ ← challenge message
107
+
108
+ Agent → host wallet signs message (EIP-191) [outside MCP]
109
+ ← signature
110
+
111
+ Agent → aureon_verify_wallet(address, message, signature, inviteCode?)
112
+ ← token; MCP session.setToken(token)
113
+
114
+ Later tools use getAccessToken() from the in-process session provider.
115
+ ```
116
+
117
+ Early access may require an `inviteCode` on first verify for a new wallet.
118
+
119
+ You may also seed `AUREON_AUTH_TOKEN` in the host env if you already obtained a Bearer elsewhere. That token is loaded into the same in-process session provider at startup.
120
+
121
+ Prefer issued keys for unattended agents. Handshakes need a human (or separate signing host) for every new session after logout or process restart — unless the Bearer is re-injected via env.
122
+
123
+ ---
124
+
125
+ ## How MCP stores Bearer in-process
126
+
127
+ On startup, `@buildaureon/mcp` builds an `@buildaureon/sdk` client with:
128
+
129
+ - `apiKey` from `AUREON_API_KEY` (if set)
130
+ - `getAccessToken` from a small session provider initialized with `AUREON_AUTH_TOKEN` (if set)
131
+
132
+ When `aureon_verify_wallet` (or `aureon_dev_login` on a preview API) succeeds, the MCP layer calls `session.setToken(token)`.
133
+
134
+ When `aureon_logout` succeeds, it clears the in-process token after the API revoke.
135
+
136
+ Important properties:
137
+
138
+ - The Bearer lives **only in the MCP process memory** (plus whatever you put in host env).
139
+ - Restarting the host clears memory unless `AUREON_AUTH_TOKEN` is still in env.
140
+ - MCP does not write tokens to disk and does not sync them into Cursor chat history by itself — but agents may echo tool results; treat tool output as sensitive.
141
+
142
+ Issued keys do not need this session store for identity. The key header alone identifies the Developers-bound wallet.
143
+
144
+ ---
145
+
146
+ ## `aureon_me` and `aureon_logout`
147
+
148
+ ### `aureon_me`
149
+
150
+ Returns the wallet bound to the **effective** credential the gateway sees: issued key identity, or Bearer session when a Bearer is active and winning.
151
+
152
+ Use it as the first identity check after setup:
153
+
154
+ - Expected address matches your Developers wallet → good.
155
+ - Unexpected address → you likely have a stale Bearer winning over the key (see conflict rules).
156
+
157
+ ### `aureon_logout`
158
+
159
+ Revokes the current Bearer session and clears the in-process token.
160
+
161
+ It does **not** revoke your issued developer API key. Key lifecycle is managed on the Developers page (`aureon_revoke_api_key` / pause toggle tools, or the UI).
162
+
163
+ After logout, if only `AUREON_API_KEY` remains, subsequent tools continue as the key-bound wallet. If you had neither key nor a remaining env Bearer, authenticated calls will fail until you configure credentials again.
164
+
165
+ ---
166
+
167
+ ## What MCP never does
168
+
169
+ | Action | MCP behavior |
170
+ | --- | --- |
171
+ | Hold a wallet private key | Never — not in env, not in tool args, not in memory by design |
172
+ | Sign EIP-191 auth challenges | Host / wallet signs; MCP only transports nonce and verify |
173
+ | Sign or broadcast vault txs | `aureon_prepare_vault_*` returns **unsigned** steps only |
174
+ | Custodialize funds | Non-custodial; settlement remains plan-driven on the API / vault |
175
+ | Replace the operator utility | Humans still use the app; MCP is the agent adapter |
176
+ | Enable `aureon_dev_login` on production | Production rejects it; use issued keys |
177
+
178
+ If an agent asks for a private key “so MCP can deposit,” refuse and point to prepare → external sign → sync. See [./security.md](./security.md).
179
+
180
+ ---
181
+
182
+ ## Conflict rules: key + Bearer together
183
+
184
+ Both credentials may be present:
185
+
186
+ 1. Host sets `AUREON_API_KEY` **and** `AUREON_AUTH_TOKEN`, or
187
+ 2. Host sets only the key, then the agent runs `aureon_verify_wallet` and stores a Bearer in-process.
188
+
189
+ **Rule:** when both are sent on a request, the **Bearer wins** for wallet identity.
190
+
191
+ Implications:
192
+
193
+ - An old Bearer can mask a freshly rotated issued key’s wallet.
194
+ - Debugging “wrong wallet on `aureon_me`” almost always means clear Bearer: call `aureon_logout`, remove `AUREON_AUTH_TOKEN` from env, restart the host.
195
+ - For always-on agents, keep config key-only so identity is predictable across restarts.
196
+
197
+ Bootstrap or special env keys still travel as `AUREON_API_KEY`. They do not change the Bearer-wins rule when a session token is also attached.
198
+
199
+ ---
200
+
201
+ ## Private key: outside MCP only
202
+
203
+ Vault deposit and withdraw are two-phase:
204
+
205
+ 1. **MCP / SDK prepare** — `aureon_prepare_vault_deposit` or `aureon_prepare_vault_withdraw` returns unsigned calldata / steps.
206
+ 2. **External signer** — a wallet UI, hardware wallet, or a separate `@buildaureon/sdk` script with a private key broadcasts the txs.
207
+ 3. **Sync** — `aureon_sync_portfolio` / `aureon_get_vault` to refresh Capital Book state.
208
+
209
+ Never paste a private key into MCP tool arguments or host env “for convenience.” That expands the blast radius of every chat that can invoke tools.
210
+
211
+ ---
212
+
213
+ ## Common errors
214
+
215
+ | Error / symptom | Meaning | Fix |
216
+ | --- | --- | --- |
217
+ | Startup: set `AUREON_API_KEY` or `AUREON_AUTH_TOKEN` | No credential configured | Add issued key to host `env` — [./setup.md](./setup.md) |
218
+ | `401` Unauthorized | Key revoked/paused, Bearer expired, or typo | Rotate key or re-verify wallet |
219
+ | Wrong wallet on `aureon_me` | Bearer winning over key | `aureon_logout`; remove env Bearer; restart |
220
+ | `aureon_verify_wallet` fails | Bad signature, stale nonce, or missing invite | New nonce; re-sign; supply `inviteCode` if required |
221
+ | `aureon_dev_login` fails on live API | Expected | Use issued key on `https://api.aureonlabs.network` |
222
+ | Prepare tools succeed but funds do not move | Unsigned steps not broadcast | Sign outside MCP with a real wallet |
223
+ | Agent invents a local API URL | Misconfigured override | Reset `AUREON_API_URL` to the live default |
224
+
225
+ Map structured SDK errors in tool output to the same categories; do not retry blindly on `401` without rotating credentials.
226
+
227
+ ---
228
+
229
+ ## Agent-safe practices
230
+
231
+ 1. **Prefer issued keys** in host config; avoid interactive Bearer for unattended loops.
232
+ 2. **Never request private keys** in chat; guide operators to prepare → external broadcast.
233
+ 3. **Do not echo full API keys or Bearers** back into long chat logs when summarizing tool results.
234
+ 4. **Call `aureon_me` once** after connect to confirm identity before write tools.
235
+ 5. **On identity mismatch**, clear Bearer before creating objectives or restoring.
236
+ 6. **Treat Developers keys like passwords** — rotate on leak; use labeled keys per host.
237
+ 7. **Keep MCP local stdio** — do not expose the process on a public port.
238
+ 8. **Read** [./agent-guide.md](./agent-guide.md) before multi-step restore or market-event rehearsals.
239
+ 9. **Respect locked objective fields** — recreate rather than fighting update errors (see tools doc).
240
+ 10. **Assume tool output may be logged** by the host; minimize secret material in responses.
241
+
242
+ ---
243
+
244
+ ## Topology (mental model)
245
+
246
+ ```text
247
+ MCP host (Cursor / Claude)
248
+ │ stdio
249
+
250
+ @buildaureon/mcp (34 tools, no private key)
251
+
252
+
253
+ @buildaureon/sdk (HTTP, retries, types)
254
+ │ HTTPS + API key and/or Bearer
255
+
256
+ https://api.aureonlabs.network
257
+
258
+ ├── control plane (objectives, portfolio, restore, …)
259
+ └── prepare vault steps → human/agent signs elsewhere
260
+ ```
261
+
262
+ Architecture detail: [./architecture.md](./architecture.md).
263
+
264
+ ---
265
+
266
+ ## FAQ
267
+
268
+ ### Is an issued key enough for restore?
269
+
270
+ Yes. `aureon_restore_objective` and related control-plane tools authenticate with the issued key. On-chain funding of the vault still needs external signing when deposits are required.
271
+
272
+ ### When should I use Bearer instead?
273
+
274
+ Interactive debugging, parity with the operator utility session model, or short-lived demos. Not the default for scheduled agents.
275
+
276
+ ### What is a “bootstrap” key in this doc?
277
+
278
+ A key supplied via environment rather than freshly minted in the UI mid-session. Operationally it still goes in `AUREON_API_KEY`. Prefer Developers-issued keys you can pause and revoke from the console.
279
+
280
+ ### Does logout delete my API key?
281
+
282
+ No. Logout clears Bearer session state. Manage keys on the Developers page or via developer tools.
283
+
284
+ ### Can MCP and the SDK share the same issued key?
285
+
286
+ Yes. Same live API, same key family. Revoking the key affects both surfaces.
287
+
288
+ ### Why does Bearer win over the key?
289
+
290
+ So an explicit wallet session can override key identity when operators intentionally complete a handshake. For agents, avoid that ambiguity by not setting Bearer.
291
+
292
+ ### Where do I configure credentials?
293
+
294
+ In the MCP host `env` block — see Cursor / Claude examples in [./setup.md](./setup.md). Primary launch remains `npx -y @buildaureon/mcp`.
295
+
296
+ ---
297
+
298
+ ## Rotating credentials safely
299
+
300
+ When a key may have leaked (pasted in chat, committed to a repo, shared in a screenshot):
301
+
302
+ 1. Open [app.aureonlabs.network](https://app.aureonlabs.network) → **Developers**.
303
+ 2. Pause or revoke the compromised key immediately.
304
+ 3. Create a replacement key with a new label.
305
+ 4. Update every MCP host `env` that still references the old secret.
306
+ 5. Restart those hosts so in-memory clients reload.
307
+ 6. Call `aureon_me` once to confirm the bound wallet is unchanged and authorized.
308
+
309
+ If a Bearer may have leaked, call `aureon_logout` from a trusted session (if still valid), remove `AUREON_AUTH_TOKEN` from env, and re-verify only if you still need a session. Prefer switching the agent to issued-key-only afterward.
310
+
311
+ Do not reuse the compromised secret “temporarily.” Treat rotation as mandatory once exposure is plausible.
312
+
313
+ ---
314
+
315
+ ## Relationship to the SDK
316
+
317
+ `@buildaureon/mcp` does not invent a second auth protocol. It configures `createAureonClient` from `@buildaureon/sdk` with the same headers the SDK would send in a script:
318
+
319
+ - Issued key → API key header / client option
320
+ - Bearer → access token via the session provider
321
+ - Base URL → `https://api.aureonlabs.network` by default
322
+
323
+ If a typed SDK script works with your issued key but MCP fails, compare env names (`AUREON_API_KEY` vs hard-coded client options) and confirm the host actually injects env into the stdio child process.
324
+
325
+ Package version for this guide: **`@buildaureon/mcp` `v0.1.1`**.
326
+
327
+ ---
328
+
329
+ ## Quick reference checklist
330
+
331
+ - [ ] Issued key from Developers page in `AUREON_API_KEY`
332
+ - [ ] No private key anywhere in MCP config
333
+ - [ ] `AUREON_AUTH_TOKEN` unset unless you need a session
334
+ - [ ] `aureon_me` shows the expected wallet
335
+ - [ ] You know Bearer wins if both are present
336
+ - [ ] Vault moves use prepare tools + external signer
337
+ - [ ] Leaked secrets → revoke / rotate on Developers
338
+ - [ ] After rotation, every host env updated and restarted
339
+
340
+ ---
341
+
342
+ ## Next steps
343
+
344
+ - Finish host wiring: [./setup.md](./setup.md)
345
+ - Tool schemas: [./tools.md](./tools.md)
346
+ - Playbooks: [./agent-guide.md](./agent-guide.md)
347
+ - Boundaries: [./architecture.md](./architecture.md)
348
+ - Threat model: [./security.md](./security.md)
349
+ - Package home: [../README.md](../README.md)
@@ -0,0 +1,335 @@
1
+ # Security
2
+
3
+ Threat model and operational guidance for running `@buildaureon/mcp` against the live AUREON API.
4
+
5
+ This document is for operators configuring agent hosts and for AI agents that must respect custody and credential boundaries. It complements `architecture.md`: the adapter is thin, but the **blast radius of a leaked API key or a mis-hosted MCP process** is not.
6
+
7
+ ---
8
+
9
+ ## 1. Trust boundaries (light threat model)
10
+
11
+ | Boundary | Assumption | Failure mode if broken |
12
+ | --- | --- | --- |
13
+ | MCP process | Local stdio child of a trusted host | Remote callers could invoke any registered tool |
14
+ | Issued API key | Equivalent to “act as this developer / wallet scope” on the control plane | Attacker creates objectives, restores, prepares vault steps, manages keys |
15
+ | Private key | Never enters MCP env or process | Full fund theft if combined with broadcast capability |
16
+ | Host LLM / agent | Can call any enabled tool | Prompt injection or confused deputy may trigger writes |
17
+ | Operator utility | Separate wallet-Bearer UI | Unrelated to MCP, but same API identity if same wallet |
18
+ | HTTPS to API | TLS to `https://api.aureonlabs.network` | MITM only if TLS broken or base URL pointed at attacker |
19
+
20
+ ```mermaid
21
+ flowchart LR
22
+ Host[MCP_host_and_LLM] -->|tool_calls_stdio| MCP[local_MCP_adapter]
23
+ MCP -->|API_key_and_optional_Bearer| API[api.aureonlabs.network]
24
+ MCP -.->|never_holds| PK[private_keys]
25
+ Human[Human_operator] -->|reviews_and_signs| Chain[Robinhood_Chain]
26
+ API --> Vault[Smart_Vault]
27
+ Vault --> Chain
28
+ ```
29
+
30
+ ### Assets worth protecting
31
+
32
+ 1. **Issued API keys** — long-lived control-plane credentials.
33
+ 2. **Bearer session tokens** — short-lived wallet sessions in process memory.
34
+ 3. **Unsigned prepare payloads** — not spendable alone, but valuable for phishing / wrong-chain tricks if altered.
35
+ 4. **Agent conversation logs** — may accidentally echo secrets if tools or prompts dump env.
36
+
37
+ ### Adversaries (simplified)
38
+
39
+ - Malicious or compromised MCP host configuration.
40
+ - Prompt injection that steers an agent toward write tools.
41
+ - Leaked key material from chat logs, screenshots, or shared configs.
42
+ - Insider with host access but without wallet keys (still dangerous for control plane).
43
+
44
+ This is a **light** threat model: enough to drive defaults, not a formal audit report.
45
+
46
+ ---
47
+
48
+ ## 2. Credential handling
49
+
50
+ ### Issued API keys (`AUREON_API_KEY`)
51
+
52
+ - Created via developer tools / utility Developers surface; **plaintext shown once** at issuance.
53
+ - Treat as a **secret password** for the AUREON control plane.
54
+ - Store in the host’s MCP env configuration or a secret manager — **never** commit to git, never paste into public issues, never embed in prompts as standing instructions.
55
+ - Prefer **one key per agent host** (e.g. Cursor workspace vs Claude Desktop vs CI agent).
56
+ - Pause or revoke immediately on suspicion of leak (`aureon_toggle_api_key`, `aureon_revoke_api_key`, or utility equivalents).
57
+
58
+ ### Bearer tokens (`AUREON_AUTH_TOKEN` / session)
59
+
60
+ - Obtained from wallet verify flows (`aureon_get_auth_nonce` → sign off-MCP → `aureon_verify_wallet`) or optional env bootstrap.
61
+ - Held **in-process only** by the SDK session provider; MCP does not write them to disk.
62
+ - Clear with `aureon_logout` on shared long-lived hosts when the human session ends.
63
+ - Do not log, print, or ask the model to “show the token.”
64
+
65
+ ### What travels on the wire
66
+
67
+ - Issued key: `X-Aureon-Api-Key` (SDK).
68
+ - Bearer: `Authorization` (SDK).
69
+ - Both are composed inside the SDK HTTP client. MCP handlers should not re-implement header injection.
70
+
71
+ ### Private keys
72
+
73
+ - **Never** place a wallet private key or seed in MCP environment variables.
74
+ - Required only to **broadcast** transactions after prepare tools return unsigned steps.
75
+ - Keep keys in the operator wallet, hardware wallet, or a dedicated signing service **outside** the MCP child process.
76
+
77
+ ---
78
+
79
+ ## 3. What MCP never does
80
+
81
+ `@buildaureon/mcp` deliberately omits capabilities that would collapse the custody boundary:
82
+
83
+ | Capability | MCP behavior |
84
+ | --- | --- |
85
+ | Hold private keys | Never |
86
+ | Sign transactions | Never |
87
+ | Broadcast to chain | Never |
88
+ | Custodial withdraw | Never |
89
+ | Silent auto-trade without a plan | Never — restores are explicit tool calls |
90
+ | Persist secrets to disk | Never |
91
+ | Expose a public HTTP MCP endpoint | Not supported / not recommended |
92
+ | Claim `settlement: "vault"` when staged | Never — pass through API honesty fields |
93
+ | Print API keys in tool results | Must not |
94
+
95
+ If a fork or wrapper adds signing inside the MCP process, it is **no longer** the same trust model. Treat that as a different product with a different review bar.
96
+
97
+ ---
98
+
99
+ ## 4. Deposit / withdraw trust boundary
100
+
101
+ Vault tools are split on purpose:
102
+
103
+ 1. **Read** — `aureon_get_vault`, `aureon_get_vault_status` (and related reads) show state.
104
+ 2. **Prepare** — `aureon_prepare_vault_deposit` / `aureon_prepare_vault_withdraw` return **unsigned** steps / calldata descriptions.
105
+ 3. **Sign & broadcast** — human or external signer only.
106
+ 4. **Observe** — later reads confirm chain effects.
107
+
108
+ ```mermaid
109
+ sequenceDiagram
110
+ participant Agent
111
+ participant MCP
112
+ participant API
113
+ participant Signer as External_signer
114
+ participant Chain
115
+
116
+ Agent->>MCP: prepare_vault_withdraw
117
+ MCP->>API: prepare request
118
+ API-->>MCP: unsigned steps
119
+ MCP-->>Agent: JSON calldata description
120
+ Note over Agent,Signer: Human review required
121
+ Signer->>Chain: signed broadcast
122
+ Agent->>MCP: get_vault_status
123
+ MCP->>API: status
124
+ API-->>Agent: updated state
125
+ ```
126
+
127
+ ### Operator checklist for prepare flows
128
+
129
+ - Confirm the **amount**, **asset**, and **destination** in the prepare payload before signing.
130
+ - Confirm you are on the intended network (Robinhood Chain context as documented by AUREON).
131
+ - Do not ask the agent to “just sign it” with a key the agent can access.
132
+ - Treat unexpected prepare output (wrong recipient, odd calldata) as a stop-ship signal.
133
+
134
+ Prepare without broadcast cannot move funds. Broadcast without review can. Keep the human (or a hardened signing policy engine) in that gap.
135
+
136
+ ---
137
+
138
+ ## 5. Key rotation, pause, and revoke
139
+
140
+ ### Rotation pattern
141
+
142
+ 1. Create a new issued key (`aureon_create_api_key` or utility).
143
+ 2. Update host MCP env to the new key.
144
+ 3. Restart the MCP host / child process so config reloads.
145
+ 4. Verify with a read tool (`aureon_ping`, `aureon_me`, or overview).
146
+ 5. **Revoke** or **pause** the old key.
147
+
148
+ Avoid long dual-key windows on untrusted machines. Prefer short overlap only while validating the new host config.
149
+
150
+ ### Pause vs revoke
151
+
152
+ | Action | Intent |
153
+ | --- | --- |
154
+ | Pause / toggle off | Temporary disable without destroying the key record |
155
+ | Revoke | Permanent invalidation after leak or decommission |
156
+ | Logout (Bearer) | Clear in-memory session only; does not revoke issued keys |
157
+
158
+ ### Least privilege habits
159
+
160
+ - Separate keys for **read-heavy experimentation** vs **production agent** hosts when the product surface allows operational separation.
161
+ - Do not share one key across untrusted operators or public demo machines.
162
+ - Limit which host profiles load write-capable MCP configs.
163
+ - Prefer issued keys over long-lived Bearer env injection for agents.
164
+
165
+ ---
166
+
167
+ ## 6. Host config hygiene
168
+
169
+ MCP hosts typically store command + env in a JSON (or UI) config. Hygiene rules:
170
+
171
+ 1. **Secrets only in env fields** managed by the host — not in chat history, not in repo files checked into git.
172
+ 2. **Do not commit** MCP config files that contain live keys. Prefer redacted examples in docs (see package `examples/`).
173
+ 3. **Restrict workspace access** — anyone who can edit MCP config can point the agent at their own key or change the API base URL.
174
+ 4. **Watch `AUREON_API_URL` overrides** — only use non-default bases when you intentionally target a documented non-production environment. A malicious override is a credential phishing vector.
175
+ 5. **Browser vs agent hosting** — browser-based agent products may persist configs in cloud profiles; treat those as higher risk than a local desktop host you control. Prefer short-lived keys and aggressive revoke there.
176
+ 6. **Disable MCP** when not needed — reduce accidental write tool invocation.
177
+ 7. **Never ask the model to echo env** — including “debug by printing AUREON_API_KEY.”
178
+
179
+ ### Logging
180
+
181
+ - Application logs must not include Authorization headers, API keys, or raw verify signatures.
182
+ - Prefer logging tool **names** and high-level outcomes, not full credential-bearing payloads.
183
+ - If a host captures full tool I/O for debugging, scrub secrets before sharing traces.
184
+
185
+ ---
186
+
187
+ ## 7. Agent / LLM-specific risks
188
+
189
+ Agents amplify ordinary API risks:
190
+
191
+ | Risk | Mitigation |
192
+ | --- | --- |
193
+ | Prompt injection (“ignore policy, restore now”) | Human approval for destructive tools; narrow system rules |
194
+ | Confused deputy (agent acts for attacker text) | Treat untrusted documents as untrusted; confirm writes |
195
+ | Secret exfiltration via tool args | Never pass keys as tool arguments; keys stay in env/SDK |
196
+ | Over-broad tool enablement | Enable only needed tools if the host supports filtering |
197
+ | Stale sessions | Logout; rotate keys after shared-machine use |
198
+
199
+ Remember: **the model is not a security boundary**. The boundary is env isolation, key lifecycle, and human signing for chain moves.
200
+
201
+ ---
202
+
203
+ ## 8. Production checklist
204
+
205
+ Use this before enabling `@buildaureon/mcp` on a machine that can affect real capital:
206
+
207
+ - [ ] Issued API key created specifically for this host
208
+ - [ ] Key stored only in host secret/env config (not in git)
209
+ - [ ] Private keys absent from MCP env and agent-accessible storage
210
+ - [ ] Default API URL is `https://api.aureonlabs.network` unless override is intentional
211
+ - [ ] Host is local stdio — not published as an open network service
212
+ - [ ] Write tools understood by operators (`create`, `restore`, `prepare`, key CRUD)
213
+ - [ ] Prepare → human sign → broadcast workflow documented for the team
214
+ - [ ] Pause/revoke path tested once (know which tool/UI to use under stress)
215
+ - [ ] Logging scrubbed of secrets
216
+ - [ ] Browser-hosted agents use stricter key lifetimes than desktop if used at all
217
+ - [ ] Onboarding docs for agents point at least-privilege tool use
218
+ - [ ] Incident contacts known (who rotates keys, who pauses agents)
219
+
220
+ ---
221
+
222
+ ## 9. Incident response basics
223
+
224
+ ### If an API key may be leaked
225
+
226
+ 1. **Pause or revoke** the key immediately (developer tools or utility).
227
+ 2. **Restart** hosts so stale processes drop the old env after config update.
228
+ 3. **Inventory** recent objectives, restores, prepares, and key CRUD via timeline / executions / key list tools.
229
+ 4. **Issue a replacement key**; update only trusted hosts.
230
+ 5. **Review** whether Bearer sessions were also exposed; logout and re-verify if needed.
231
+ 6. **Communicate** to operators: stop signing prepare payloads from unknown sessions until review completes.
232
+
233
+ ### If a private key may be leaked
234
+
235
+ 1. This is **outside MCP** but higher severity — move funds / rotate wallets per your chain runbook.
236
+ 2. Revoke associated API keys as a secondary control-plane lockdown.
237
+ 3. Assume any unsigned prepare history could be replayed by an attacker who also has the key.
238
+
239
+ ### If an agent mis-fired writes
240
+
241
+ 1. Pause the objective or agent host.
242
+ 2. Inspect health, timeline, and executions for settlement honesty (`vault` vs `staged`).
243
+ 3. Do not “fix forward” with more restores until intent is clear.
244
+ 4. Rotate keys if the mis-fire suggests prompt injection with data exfil attempts.
245
+
246
+ ### Evidence to preserve
247
+
248
+ - Timestamps of tool calls (host logs, if scrubbed).
249
+ - Objective ids and execution receipts.
250
+ - Key ids (not secret material) involved.
251
+
252
+ Do not paste live secrets into tickets.
253
+
254
+ ---
255
+
256
+ ## 10. Browser vs desktop agent hosting
257
+
258
+ | Hosting style | Typical risk | Guidance |
259
+ | --- | --- | --- |
260
+ | Local desktop MCP (Cursor / Claude Desktop style) | Config files on disk; local malware | Disk encryption; least-privilege OS user; no shared accounts |
261
+ | Cloud / browser agent with remote tool runner | Broader persistence and sharing surfaces | Short-lived keys; revoke often; avoid high-value wallets |
262
+ | Shared demo machine | Key reuse across people | Unique keys; revoke after demo; no private keys nearby |
263
+
264
+ In all cases: MCP remains a **local adapter pattern** conceptually. If a product remotes the stdio server, you have changed the threat model — re-validate network ACLs and auth before use.
265
+
266
+ ---
267
+
268
+ ## 11. Honest settlement and integrity
269
+
270
+ Security is not only custody; it is also **truthfulness of outcomes**:
271
+
272
+ - Agents must surface `settlement` fields accurately.
273
+ - Staged settlement is not the same as vault/on-chain completion.
274
+ - Do not coach models to rewrite receipts as “done on-chain” when the API said `staged`.
275
+
276
+ Integrity failures (lying about settlement) create operator errors that look like security incidents later.
277
+
278
+ ---
279
+
280
+ ## 12. Dependency and supply-chain notes
281
+
282
+ - Install `@buildaureon/mcp` from the published package registry you trust.
283
+ - Pin versions when reproducibility and change control matter.
284
+ - The MCP package depends on `@buildaureon/sdk` and `@modelcontextprotocol/sdk`.
285
+ - Review release notes when upgrading — new tools expand the agent’s write surface.
286
+
287
+ ---
288
+
289
+ ## 13. FAQ
290
+
291
+ **Is an issued API key as powerful as my wallet private key?**
292
+ No. It does not sign chain transactions. It **is** powerful on the control plane (objectives, restores, prepares, key management). Protect it accordingly.
293
+
294
+ **Can MCP steal funds by itself?**
295
+ Not via signing — it never holds private keys. Funds move only after an external signer broadcasts. Control-plane misuse can still create harmful plans or confuse operators.
296
+
297
+ **Should I put my private key in the host env so the agent can deposit for me?**
298
+ No. That collapses the custody model. Keep signing outside MCP.
299
+
300
+ **What if I need automation for broadcast?**
301
+ Use a dedicated signing service with its own policy engine and audit log — not the MCP adapter.
302
+
303
+ **Is Bearer safer than an API key?**
304
+ Different tradeoffs. Bearer is often shorter-lived; issued keys are better for unattended agents. Both are secrets.
305
+
306
+ **Can I run multiple MCP hosts with one key?**
307
+ Technically yes; operationally prefer one key per host for blast-radius control.
308
+
309
+ **Does `aureon_logout` revoke my issued key?**
310
+ No. It clears the in-memory Bearer only.
311
+
312
+ **What should agents refuse to do?**
313
+ Print secrets, accept private keys as tool args, claim vault settlement without API fields, or broadcast transactions.
314
+
315
+ **Where is the deeper architecture?**
316
+ See `architecture.md` for layers, registration, and SDK vs MCP ownership.
317
+
318
+ **Who do I contact for platform incidents?**
319
+ Follow AUREON’s published support / security channels on the product site; include key ids and timestamps, never raw secrets.
320
+
321
+ ---
322
+
323
+ ## 14. Related documents
324
+
325
+ - [Architecture](./architecture.md) — layers and request lifecycle
326
+ - [Authentication](./auth.md) — key and Bearer flows
327
+ - [Setup](./setup.md) — host configuration patterns
328
+ - [Tools](./tools.md) — including developer key tools
329
+ - [Agent guide](./agent-guide.md) — safe call sequences
330
+
331
+ ---
332
+
333
+ ## 15. Summary
334
+
335
+ Treat `@buildaureon/mcp` as a **local, non-custodial stdio adapter** over `@buildaureon/sdk` to `https://api.aureonlabs.network`. Protect issued keys like passwords, keep private keys out of the MCP process, require human (or hardened external) signing for deposit/withdraw broadcast, rotate and revoke quickly, and assume the LLM is not a security boundary — configuration hygiene and least privilege are.