@buildaureon/mcp 0.1.8 → 0.1.10

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 CHANGED
@@ -1,351 +1,361 @@
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 **43** 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 the resolved API (default local mainnet `http://127.0.0.1:8788` / 4663). Opt in to the public host with `AUREON_NETWORK=testnet` (still 46630).
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. |
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_NETWORK` | Optional. Omit for mainnet (4663 / 8788). Set `testnet` for the public host (still 46630). |
55
- | `AUREON_API_URL` | Optional override. Must match `AUREON_NETWORK` if both are set. |
56
-
57
- 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.
58
-
59
- See also the setup tables in [./setup.md](./setup.md).
60
-
61
- ---
62
-
63
- ## Recommended path: issued developer key
64
-
65
- This is the default for Cursor, Claude, and other always-on agents.
66
-
67
- ### Steps
68
-
69
- 1. Issue a key on the **same** API you will call. Local mainnet: Developers on `http://127.0.0.1:5174`. Public testnet: [app.aureonlabs.network](https://app.aureonlabs.network) (still 46630).
70
- 2. Connect the wallet that should own objectives and Capital Book state.
71
- 3. Open **Developers** and create a key (name it after the host, e.g. `cursor-mcp`).
72
- 4. Copy the secret once into the host MCP `env` as `AUREON_API_KEY`.
73
- 5. Do **not** set `AUREON_AUTH_TOKEN` unless you have a specific reason.
74
- 6. Restart the host and call `aureon_ping` then `aureon_me`.
75
-
76
- Minimal env (local mainnet 8788 / 4663):
77
-
78
- ```bash
79
- AUREON_API_KEY=aureon_....
80
- # AUREON_NETWORK=testnet # only for the public host (still 46630)
81
- ```
82
-
83
- 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.
84
-
85
- Rotate or revoke from the same Developers page if the secret is exposed. Update the host config immediately after rotation.
86
-
87
- ---
88
-
89
- ## Optional wallet handshake (Bearer session)
90
-
91
- Use when you need a utility-style session, when debugging auth, or when an issued key is unavailable and you already hold a Bearer.
92
-
93
- ### Tools involved
94
-
95
- | Tool | Role |
96
- | --- | --- |
97
- | `aureon_get_auth_nonce` | Fetch an EIP-191 challenge message for an address |
98
- | `aureon_verify_wallet` | Submit address + message + signature (+ optional invite); **stores** the returned Bearer in-process |
99
- | `aureon_logout` | Revoke the session server-side and clear the in-process token |
100
- | `aureon_me` | Show the wallet for the active key or Bearer |
101
- | `aureon_dev_login` | Preview-only login — **not** available on the production API |
102
-
103
- ### Sequence
104
-
105
- ```text
106
- Agent aureon_get_auth_nonce(address)
107
- challenge message
108
-
109
- Agent host wallet signs message (EIP-191) [outside MCP]
110
- signature
111
-
112
- Agent → aureon_verify_wallet(address, message, signature, inviteCode?)
113
- ← token; MCP session.setToken(token)
114
-
115
- Later tools use getAccessToken() from the in-process session provider.
116
- ```
117
-
118
- Early access may require an `inviteCode` on first verify for a new wallet.
119
-
120
- 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.
121
-
122
- 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.
123
-
124
- ---
125
-
126
- ## How MCP stores Bearer in-process
127
-
128
- On startup, `@buildaureon/mcp` builds an `@buildaureon/sdk` client with:
129
-
130
- - `apiKey` from `AUREON_API_KEY` (if set)
131
- - `getAccessToken` from a small session provider initialized with `AUREON_AUTH_TOKEN` (if set)
132
-
133
- When `aureon_verify_wallet` (or `aureon_dev_login` on a preview API) succeeds, the MCP layer calls `session.setToken(token)`.
134
-
135
- When `aureon_logout` succeeds, it clears the in-process token after the API revoke.
136
-
137
- Important properties:
138
-
139
- - The Bearer lives **only in the MCP process memory** (plus whatever you put in host env).
140
- - Restarting the host clears memory unless `AUREON_AUTH_TOKEN` is still in env.
141
- - 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.
142
-
143
- Issued keys do not need this session store for identity. The key header alone identifies the Developers-bound wallet.
144
-
145
- ---
146
-
147
- ## `aureon_me` and `aureon_logout`
148
-
149
- ### `aureon_me`
150
-
151
- Returns the wallet bound to the **effective** credential the gateway sees: issued key identity, or Bearer session when a Bearer is active and winning.
152
-
153
- Use it as the first identity check after setup:
154
-
155
- - Expected address matches your Developers wallet → good.
156
- - Unexpected address → you likely have a stale Bearer winning over the key (see conflict rules).
157
-
158
- ### `aureon_logout`
159
-
160
- Revokes the current Bearer session and clears the in-process token.
161
-
162
- 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).
163
-
164
- 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.
165
-
166
- ---
167
-
168
- ## What MCP never does
169
-
170
- | Action | MCP behavior |
171
- | --- | --- |
172
- | Hold a wallet private key | Never — not in env, not in tool args, not in memory by design |
173
- | Sign EIP-191 auth challenges | Host / wallet signs; MCP only transports nonce and verify |
174
- | Sign or broadcast vault txs | `aureon_prepare_vault_*` returns **unsigned** steps only |
175
- | Custodialize funds | Non-custodial; settlement remains plan-driven on the API / vault |
176
- | Replace the operator utility | Humans still use the app; MCP is the agent adapter |
177
- | Enable `aureon_dev_login` on production | Production rejects it; use issued keys |
178
-
179
- 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).
180
-
181
- ---
182
-
183
- ## Conflict rules: key + Bearer together
184
-
185
- Both credentials may be present:
186
-
187
- 1. Host sets `AUREON_API_KEY` **and** `AUREON_AUTH_TOKEN`, or
188
- 2. Host sets only the key, then the agent runs `aureon_verify_wallet` and stores a Bearer in-process.
189
-
190
- **Rule:** when both are sent on a request, the **Bearer wins** for wallet identity.
191
-
192
- Implications:
193
-
194
- - An old Bearer can mask a freshly rotated issued key’s wallet.
195
- - Debugging “wrong wallet on `aureon_me`” almost always means clear Bearer: call `aureon_logout`, remove `AUREON_AUTH_TOKEN` from env, restart the host.
196
- - For always-on agents, keep config key-only so identity is predictable across restarts.
197
-
198
- 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.
199
-
200
- ---
201
-
202
- ## Private key: outside MCP only
203
-
204
- Vault deposit and withdraw are two-phase:
205
-
206
- 1. **MCP / SDK prepare** — `aureon_prepare_vault_deposit` or `aureon_prepare_vault_withdraw` returns unsigned calldata / steps.
207
- 2. **External signer** a wallet UI, hardware wallet, or a separate `@buildaureon/sdk` script with a private key broadcasts the txs.
208
- 3. **Sync** — `aureon_sync_portfolio` / `aureon_get_vault` to refresh Capital Book state.
209
-
210
- 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.
211
-
212
- ---
213
-
214
- ## Common errors
215
-
216
- | Error / symptom | Meaning | Fix |
217
- | --- | --- | --- |
218
- | Startup: set `AUREON_API_KEY` or `AUREON_AUTH_TOKEN` | No credential configured | Add issued key to host `env` — [./setup.md](./setup.md) |
219
- | `401` Unauthorized | Key revoked/paused, Bearer expired, or typo | Rotate key or re-verify wallet |
220
- | Wrong wallet on `aureon_me` | Bearer winning over key | `aureon_logout`; remove env Bearer; restart |
221
- | `aureon_verify_wallet` fails | Bad signature, stale nonce, or missing invite | New nonce; re-sign; supply `inviteCode` if required |
222
- | `aureon_dev_login` fails on live API | Expected | Use an issued key. Public host is still 46630. |
223
- | Prepare tools succeed but funds do not move | Unsigned steps not broadcast | Sign outside MCP with a real wallet |
224
- | Agent invents a local API URL | Misconfigured override | Omit `AUREON_API_URL` for 8788, or set `AUREON_NETWORK=testnet` |
225
-
226
- Map structured SDK errors in tool output to the same categories; do not retry blindly on `401` without rotating credentials.
227
-
228
- ---
229
-
230
- ## Agent-safe practices
231
-
232
- 1. **Prefer issued keys** in host config; avoid interactive Bearer for unattended loops.
233
- 2. **Never request private keys** in chat; guide operators to prepare external broadcast.
234
- 3. **Do not echo full API keys or Bearers** back into long chat logs when summarizing tool results.
235
- 4. **Call `aureon_me` once** after connect to confirm identity before write tools.
236
- 5. **On identity mismatch**, clear Bearer before creating objectives or restoring.
237
- 6. **Treat Developers keys like passwords** — rotate on leak; use labeled keys per host.
238
- 7. **Keep MCP local stdio** — do not expose the process on a public port.
239
- 8. **Read** [./agent-guide.md](./agent-guide.md) before multi-step restore or market-event rehearsals.
240
- 9. **Respect locked objective fields** — recreate rather than fighting update errors (see tools doc).
241
- 10. **Assume tool output may be logged** by the host; minimize secret material in responses.
242
-
243
- ---
244
-
245
- ## Topology (mental model)
246
-
247
- ```text
248
- MCP host (Cursor / Claude)
249
- │ stdio
250
-
251
- @buildaureon/mcp (54 tools, no private key)
252
-
253
-
254
- @buildaureon/sdk (HTTP, retries, types)
255
- │ HTTP(S) + API key and/or Bearer
256
-
257
- default http://127.0.0.1:8788 (4663)
258
- opt-in https://api.aureonlabs.network (still 46630)
259
-
260
- ├── control plane (objectives, portfolio, restore, …)
261
- └── prepare vault steps → human/agent signs elsewhere
262
- ```
263
-
264
- Architecture detail: [./architecture.md](./architecture.md).
265
-
266
- ---
267
-
268
- ## FAQ
269
-
270
- ### Is an issued key enough for restore?
271
-
272
- 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.
273
-
274
- ### When should I use Bearer instead?
275
-
276
- Interactive debugging, parity with the operator utility session model, or short-lived demos. Not the default for scheduled agents.
277
-
278
- ### What is a “bootstrap” key in this doc?
279
-
280
- 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.
281
-
282
- ### Does logout delete my API key?
283
-
284
- No. Logout clears Bearer session state. Manage keys on the Developers page or via developer tools.
285
-
286
- ### Can MCP and the SDK share the same issued key?
287
-
288
- Yes. Same live API, same key family. Revoking the key affects both surfaces.
289
-
290
- ### Why does Bearer win over the key?
291
-
292
- So an explicit wallet session can override key identity when operators intentionally complete a handshake. For agents, avoid that ambiguity by not setting Bearer.
293
-
294
- ### Where do I configure credentials?
295
-
296
- In the MCP host `env` block see Cursor / Claude examples in [./setup.md](./setup.md). Primary launch remains `npx -y @buildaureon/mcp`.
297
-
298
- ---
299
-
300
- ## Rotating credentials safely
301
-
302
- When a key may have leaked (pasted in chat, committed to a repo, shared in a screenshot):
303
-
304
- 1. Open [app.aureonlabs.network](https://app.aureonlabs.network) **Developers**.
305
- 2. Pause or revoke the compromised key immediately.
306
- 3. Create a replacement key with a new label.
307
- 4. Update every MCP host `env` that still references the old secret.
308
- 5. Restart those hosts so in-memory clients reload.
309
- 6. Call `aureon_me` once to confirm the bound wallet is unchanged and authorized.
310
-
311
- 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.
312
-
313
- Do not reuse the compromised secret “temporarily.” Treat rotation as mandatory once exposure is plausible.
314
-
315
- ---
316
-
317
- ## Relationship to the SDK
318
-
319
- `@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:
320
-
321
- - Issued key API key header / client option
322
- - Bearer → access token via the session provider
323
- - Base URL `http://127.0.0.1:8788` by default (4663). Public host is `AUREON_NETWORK=testnet` (still 46630).
324
-
325
- 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.
326
-
327
- Package version for this guide: **`@buildaureon/mcp` `v0.1.1`**.
328
-
329
- ---
330
-
331
- ## Quick reference checklist
332
-
333
- - [ ] Issued key from Developers page in `AUREON_API_KEY`
334
- - [ ] No private key anywhere in MCP config
335
- - [ ] `AUREON_AUTH_TOKEN` unset unless you need a session
336
- - [ ] `aureon_me` shows the expected wallet
337
- - [ ] You know Bearer wins if both are present
338
- - [ ] Vault moves use prepare tools + external signer
339
- - [ ] Leaked secrets → revoke / rotate on Developers
340
- - [ ] After rotation, every host env updated and restarted
341
-
342
- ---
343
-
344
- ## Next steps
345
-
346
- - Finish host wiring: [./setup.md](./setup.md)
347
- - Tool schemas: [./tools.md](./tools.md)
348
- - Playbooks: [./agent-guide.md](./agent-guide.md)
349
- - Boundaries: [./architecture.md](./architecture.md)
350
- - Threat model: [./security.md](./security.md)
351
- - Package home: [../README.md](../README.md)
1
+ # Authentication Guide
2
+
3
+ How **`@buildaureon/mcp`** `v0.1.10` authenticates to the live AUREON API — aligned with `@buildaureon/sdk`, safe for humans and for agents that call the **54** tools over hosted HTTP or local stdio.
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 to the hosted URL or to stdio 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 the official API `https://api.aureonlabs.network` on mainnet. Stay on testnet with `AUREON_NETWORK=testnet`. Public Living Capital is still the testnet console.
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
+ ### Hosted URL vs stdio
30
+
31
+ | How you connect | Where the issued key lives |
32
+ | --- | --- |
33
+ | `https://mcp.aureonlabs.network/mcp` | Optional. URL-only for open tools. Your wallet tools need `X-Aureon-Api-Key`. |
34
+ | `npx -y @buildaureon/mcp` | In the host `env` as `AUREON_API_KEY` (your Developers key). |
35
+
36
+ Private keys stay out of both. Hosted without a header is not your wallet. Hosted with `X-Aureon-Api-Key` is your issued key. Stdio identity is the key you set in env.
37
+
38
+ ---
39
+
40
+ ## Credential types
41
+
42
+ | Credential | Where you get it | Put it in MCP? | What it does |
43
+ | --- | --- | --- | --- |
44
+ | **Issued developer API key** | Developers page create key | Yes `AUREON_API_KEY` | Product access **and** wallet identity for control-plane tools. **Recommended.** |
45
+ | **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. |
46
+ | **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. |
47
+ | **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. |
48
+
49
+ Plain language:
50
+
51
+ - **Issued key** = “this agent may call the API as my Developers-bound wallet.”
52
+ - **Bearer** = “this process has an active wallet session.”
53
+ - **Private key** = “this other process may move funds on chain.” MCP does not hold that.
54
+
55
+ ---
56
+
57
+ ## Environment variables (auth-focused)
58
+
59
+ | Variable | Role |
60
+ | --- | --- |
61
+ | `AUREON_API_KEY` | Preferred. Issued developer key. |
62
+ | `AUREON_AUTH_TOKEN` | Optional Bearer. Use when you intentionally want a session without (or in addition to) a key — see conflict rules below. |
63
+ | `AUREON_NETWORK` | Optional. Omit for official API / mainnet. Set `testnet` to stay on testnet. |
64
+ | `AUREON_API_URL` | Optional override of `https://api.aureonlabs.network`. |
65
+
66
+ 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.
67
+
68
+ See also the setup tables in [./setup.md](./setup.md).
69
+
70
+ ---
71
+
72
+ ## Recommended path: issued developer key
73
+
74
+ This is the default for Cursor, Claude, and other always-on agents.
75
+
76
+ ### Steps
77
+
78
+ 1. Issue a key at [app.aureonlabs.network](https://app.aureonlabs.network) → **Developers**.
79
+ 2. Connect the wallet that should own objectives and Capital Book state.
80
+ 3. Open **Developers** and create a key (name it after the host, e.g. `cursor-mcp`).
81
+ 4. Copy the secret once into the host MCP `env` as `AUREON_API_KEY`.
82
+ 5. Do **not** set `AUREON_AUTH_TOKEN` unless you have a specific reason.
83
+ 6. Restart the host and call `aureon_ping` then `aureon_me`.
84
+
85
+ Minimal env (official API):
86
+
87
+ ```bash
88
+ AUREON_API_KEY=aureon_....
89
+ # AUREON_NETWORK=testnet # stay on testnet on the same official host
90
+ ```
91
+
92
+ 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.
93
+
94
+ Rotate or revoke from the same Developers page if the secret is exposed. Update the host config immediately after rotation.
95
+
96
+ ---
97
+
98
+ ## Optional wallet handshake (Bearer session)
99
+
100
+ Use when you need a utility-style session, when debugging auth, or when an issued key is unavailable and you already hold a Bearer.
101
+
102
+ ### Tools involved
103
+
104
+ | Tool | Role |
105
+ | --- | --- |
106
+ | `aureon_get_auth_nonce` | Fetch an EIP-191 challenge message for an address |
107
+ | `aureon_verify_wallet` | Submit address + message + signature (+ optional invite); **stores** the returned Bearer in-process |
108
+ | `aureon_logout` | Revoke the session server-side and clear the in-process token |
109
+ | `aureon_me` | Show the wallet for the active key or Bearer |
110
+ | `aureon_dev_login` | Preview-only login — **not** available on the production API |
111
+
112
+ ### Sequence
113
+
114
+ ```text
115
+ Agent aureon_get_auth_nonce(address)
116
+ ← challenge message
117
+
118
+ Agent host wallet signs message (EIP-191) [outside MCP]
119
+ ← signature
120
+
121
+ Agent → aureon_verify_wallet(address, message, signature, inviteCode?)
122
+ token; MCP session.setToken(token)
123
+
124
+ Later tools use getAccessToken() from the in-process session provider.
125
+ ```
126
+
127
+ `inviteCode` is only for the optional wallet Bearer handshake when the API asks for it. It is not required to use hosted MCP or stdio with an issued key.
128
+
129
+ 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.
130
+
131
+ 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.
132
+
133
+ ---
134
+
135
+ ## How MCP stores Bearer in-process
136
+
137
+ On startup, `@buildaureon/mcp` builds an `@buildaureon/sdk` client with:
138
+
139
+ - `apiKey` from `AUREON_API_KEY` (if set)
140
+ - `getAccessToken` from a small session provider initialized with `AUREON_AUTH_TOKEN` (if set)
141
+
142
+ When `aureon_verify_wallet` (or `aureon_dev_login` on a preview API) succeeds, the MCP layer calls `session.setToken(token)`.
143
+
144
+ When `aureon_logout` succeeds, it clears the in-process token after the API revoke.
145
+
146
+ Important properties:
147
+
148
+ - The Bearer lives **only in the MCP process memory** (plus whatever you put in host env).
149
+ - Restarting the host clears memory unless `AUREON_AUTH_TOKEN` is still in env.
150
+ - 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.
151
+
152
+ Issued keys do not need this session store for identity. The key header alone identifies the Developers-bound wallet.
153
+
154
+ ---
155
+
156
+ ## `aureon_me` and `aureon_logout`
157
+
158
+ ### `aureon_me`
159
+
160
+ Returns the wallet bound to the **effective** credential the gateway sees: issued key identity, or Bearer session when a Bearer is active and winning.
161
+
162
+ Use it as the first identity check after setup:
163
+
164
+ - Expected address matches your Developers wallet good.
165
+ - Unexpected address → you likely have a stale Bearer winning over the key (see conflict rules).
166
+
167
+ ### `aureon_logout`
168
+
169
+ Revokes the current Bearer session and clears the in-process token.
170
+
171
+ 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).
172
+
173
+ 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.
174
+
175
+ ---
176
+
177
+ ## What MCP never does
178
+
179
+ | Action | MCP behavior |
180
+ | --- | --- |
181
+ | Hold a wallet private key | Never — not in env, not in tool args, not in memory by design |
182
+ | Sign EIP-191 auth challenges | Host / wallet signs; MCP only transports nonce and verify |
183
+ | Sign or broadcast vault txs | `aureon_prepare_vault_*` returns **unsigned** steps only |
184
+ | Custodialize funds | Non-custodial; settlement remains plan-driven on the API / vault |
185
+ | Replace the operator utility | Humans still use the app; MCP is the agent adapter |
186
+ | Enable `aureon_dev_login` on production | Production rejects it; use issued keys |
187
+
188
+ 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).
189
+
190
+ ---
191
+
192
+ ## Conflict rules: key + Bearer together
193
+
194
+ Both credentials may be present:
195
+
196
+ 1. Host sets `AUREON_API_KEY` **and** `AUREON_AUTH_TOKEN`, or
197
+ 2. Host sets only the key, then the agent runs `aureon_verify_wallet` and stores a Bearer in-process.
198
+
199
+ **Rule:** when both are sent on a request, the **Bearer wins** for wallet identity.
200
+
201
+ Implications:
202
+
203
+ - An old Bearer can mask a freshly rotated issued key’s wallet.
204
+ - Debugging “wrong wallet on `aureon_me`” almost always means clear Bearer: call `aureon_logout`, remove `AUREON_AUTH_TOKEN` from env, restart the host.
205
+ - For always-on agents, keep config key-only so identity is predictable across restarts.
206
+
207
+ 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.
208
+
209
+ ---
210
+
211
+ ## Private key: outside MCP only
212
+
213
+ Vault deposit and withdraw are two-phase:
214
+
215
+ 1. **MCP / SDK prepare** — `aureon_prepare_vault_deposit` or `aureon_prepare_vault_withdraw` returns unsigned calldata / steps.
216
+ 2. **External signer** — a wallet UI, hardware wallet, or a separate `@buildaureon/sdk` script with a private key broadcasts the txs.
217
+ 3. **Sync** `aureon_sync_portfolio` / `aureon_get_vault` to refresh Capital Book state.
218
+
219
+ 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.
220
+
221
+ ---
222
+
223
+ ## Common errors
224
+
225
+ | Error / symptom | Meaning | Fix |
226
+ | --- | --- | --- |
227
+ | Startup: set `AUREON_API_KEY` or `AUREON_AUTH_TOKEN` | No credential configured | Add issued key to host `env` — [./setup.md](./setup.md) |
228
+ | `401` Unauthorized | Key revoked/paused, Bearer expired, or typo | Rotate key or re-verify wallet |
229
+ | Wrong wallet on `aureon_me` | Bearer winning over key | `aureon_logout`; remove env Bearer; restart |
230
+ | `aureon_verify_wallet` fails | Bad signature, stale nonce, or missing invite | New nonce; re-sign; supply `inviteCode` if required |
231
+ | `aureon_dev_login` fails on live API | Expected | Use an issued key. Public Living Capital is still the testnet console. |
232
+ | Prepare tools succeed but funds do not move | Unsigned steps not broadcast | Sign outside MCP with a real wallet |
233
+ | Agent invents a local API URL | Misconfigured override | Omit `AUREON_API_URL` for the official API, or set `AUREON_NETWORK=testnet` |
234
+
235
+ Map structured SDK errors in tool output to the same categories; do not retry blindly on `401` without rotating credentials.
236
+
237
+ ---
238
+
239
+ ## Agent-safe practices
240
+
241
+ 1. **Prefer issued keys** in host config; avoid interactive Bearer for unattended loops.
242
+ 2. **Never request private keys** in chat; guide operators to prepare → external broadcast.
243
+ 3. **Do not echo full API keys or Bearers** back into long chat logs when summarizing tool results.
244
+ 4. **Call `aureon_me` once** after connect to confirm identity before write tools.
245
+ 5. **On identity mismatch**, clear Bearer before creating objectives or restoring.
246
+ 6. **Treat Developers keys like passwords** — rotate on leak; use labeled keys per host.
247
+ 7. **Do not expose your stdio process** — use `https://mcp.aureonlabs.network/mcp` for the official host; do not publish your own child process.
248
+ 8. **Read** [./agent-guide.md](./agent-guide.md) before multi-step restore or market-event rehearsals.
249
+ 9. **Respect locked objective fields** — recreate rather than fighting update errors (see tools doc).
250
+ 10. **Assume tool output may be logged** by the host; minimize secret material in responses.
251
+
252
+ ---
253
+
254
+ ## Topology (mental model)
255
+
256
+ ```text
257
+ MCP host (Cursor / Claude)
258
+ Streamable HTTP https://mcp.aureonlabs.network/mcp
259
+ or stdio npx @buildaureon/mcp
260
+
261
+ adapter (54 tools, no private key)
262
+
263
+
264
+ @buildaureon/sdk (HTTP, retries, types)
265
+ │ HTTP(S) + API key and/or Bearer
266
+
267
+ default https://api.aureonlabs.network (mainnet)
268
+ opt-in AUREON_NETWORK=testnet (same host)
269
+
270
+ ├── control plane (objectives, portfolio, restore, …)
271
+ └── prepare vault steps → human/agent signs elsewhere
272
+ ```
273
+
274
+ Architecture detail: [./architecture.md](./architecture.md).
275
+
276
+ ---
277
+
278
+ ## FAQ
279
+
280
+ ### Is an issued key enough for restore?
281
+
282
+ 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.
283
+
284
+ ### When should I use Bearer instead?
285
+
286
+ Interactive debugging, parity with the operator utility session model, or short-lived demos. Not the default for scheduled agents.
287
+
288
+ ### What is a “bootstrap” key in this doc?
289
+
290
+ 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.
291
+
292
+ ### Does logout delete my API key?
293
+
294
+ No. Logout clears Bearer session state. Manage keys on the Developers page or via developer tools.
295
+
296
+ ### Can MCP and the SDK share the same issued key?
297
+
298
+ Yes. Same live API, same key family. Revoking the key affects both surfaces.
299
+
300
+ ### Why does Bearer win over the key?
301
+
302
+ So an explicit wallet session can override key identity when operators intentionally complete a handshake. For agents, avoid that ambiguity by not setting Bearer.
303
+
304
+ ### Where do I configure credentials?
305
+
306
+ In the MCP host `env` block see Cursor / Claude examples in [./setup.md](./setup.md). Primary launch remains `npx -y @buildaureon/mcp`.
307
+
308
+ ---
309
+
310
+ ## Rotating credentials safely
311
+
312
+ When a key may have leaked (pasted in chat, committed to a repo, shared in a screenshot):
313
+
314
+ 1. Open [app.aureonlabs.network](https://app.aureonlabs.network) → **Developers**.
315
+ 2. Pause or revoke the compromised key immediately.
316
+ 3. Create a replacement key with a new label.
317
+ 4. Update every MCP host `env` that still references the old secret.
318
+ 5. Restart those hosts so in-memory clients reload.
319
+ 6. Call `aureon_me` once to confirm the bound wallet is unchanged and authorized.
320
+
321
+ 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.
322
+
323
+ Do not reuse the compromised secret “temporarily.” Treat rotation as mandatory once exposure is plausible.
324
+
325
+ ---
326
+
327
+ ## Relationship to the SDK
328
+
329
+ `@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:
330
+
331
+ - Issued key → API key header / client option
332
+ - Bearer → access token via the session provider
333
+ - Base URL `https://api.aureonlabs.network` by default (mainnet). `AUREON_NETWORK=testnet` stays on testnet.
334
+
335
+ 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.
336
+
337
+ Package version for this guide: **`@buildaureon/mcp` `v0.1.10`**.
338
+
339
+ ---
340
+
341
+ ## Quick reference checklist
342
+
343
+ - [ ] Issued key from Developers page in `AUREON_API_KEY`
344
+ - [ ] No private key anywhere in MCP config
345
+ - [ ] `AUREON_AUTH_TOKEN` unset unless you need a session
346
+ - [ ] `aureon_me` shows the expected wallet
347
+ - [ ] You know Bearer wins if both are present
348
+ - [ ] Vault moves use prepare tools + external signer
349
+ - [ ] Leaked secrets → revoke / rotate on Developers
350
+ - [ ] After rotation, every host env updated and restarted
351
+
352
+ ---
353
+
354
+ ## Next steps
355
+
356
+ - Finish host wiring: [./setup.md](./setup.md)
357
+ - Tool schemas: [./tools.md](./tools.md)
358
+ - Playbooks: [./agent-guide.md](./agent-guide.md)
359
+ - Boundaries: [./architecture.md](./architecture.md)
360
+ - Threat model: [./security.md](./security.md)
361
+ - Package home: [../README.md](../README.md)