@aura-labs-ai/mcp-server-admission 0.2.0 → 0.3.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 +4 -3
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/tools.js +24 -12
package/README.md
CHANGED
|
@@ -72,9 +72,10 @@ captures it.
|
|
|
72
72
|
(`X-Agent-Signature`), so the agent key signs the binding it presents. A
|
|
73
73
|
`principal_id` argument that is not the held principal is refused locally as
|
|
74
74
|
`principal_not_held`, and no request is sent. A refusal from Core is returned
|
|
75
|
-
|
|
76
|
-
`
|
|
77
|
-
`
|
|
75
|
+
as Core sent it (0.3.0, DEC-275): every member of its error envelope, with
|
|
76
|
+
`status` `error` and `http` set by the tool, so `action`, `request_id`,
|
|
77
|
+
`_links` and, for `invalid_principal_binding`, `reason` (`claims`,
|
|
78
|
+
`audience`, `window`, `expired`, `signature` or `replayed`) reach you. A second call with the same keys is answered from Core's record
|
|
78
79
|
and writes nothing. The result states the binding Core recorded, as
|
|
79
80
|
`binding`: `attested`, or `unattested` when Core's answer carries no attested
|
|
80
81
|
binding. A Core that does not yet require the binding accepts the body and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aura-labs-ai/mcp-server-admission",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "AURA admission MCP server: the local action layer that onboards an agent onto the AURA certification bench. Holds the agent's Ed25519 keys and signs every admission request locally — keys never leave the machine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/index.js
CHANGED
|
@@ -49,7 +49,7 @@ async function main() {
|
|
|
49
49
|
const deps = { wallet, fetch: globalThis.fetch, baseUrl: BENCH_URL };
|
|
50
50
|
|
|
51
51
|
const server = new Server(
|
|
52
|
-
{ name: 'aura-admission', version: '0.
|
|
52
|
+
{ name: 'aura-admission', version: '0.3.0' },
|
|
53
53
|
{ capabilities: { tools: {} } },
|
|
54
54
|
);
|
|
55
55
|
|
package/src/tools.js
CHANGED
|
@@ -189,15 +189,26 @@ async function callSigned(deps, path, body, signatureHeader, slot) {
|
|
|
189
189
|
return { status: res.status, json, sandboxContextAttached: Boolean(sandboxContext) };
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
// A refusal is relayed as
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
192
|
+
// A refusal is relayed as the answerer sent it (DEC-275, SDK-31): every member of its JSON object,
|
|
193
|
+
// so the caller reads Core's action, request_id, reason, details, the declared members and _links,
|
|
194
|
+
// and follows the next step. `status` and `http` are the tool's and are not taken from the body.
|
|
195
|
+
// A body that is not a JSON object did not come from Core: internal_error with action retry, since
|
|
196
|
+
// every call this server makes is safe to repeat (mintSandboxKey, registerPrincipal and
|
|
197
|
+
// registerAgent are resend-safe in the contract's recovery table, the guide is a read, and the
|
|
198
|
+
// Dev Centre's provision is idempotent).
|
|
199
|
+
const apiError = (r) => {
|
|
200
|
+
const body = r.json;
|
|
201
|
+
if (body !== null && typeof body === 'object' && !Array.isArray(body)) {
|
|
202
|
+
return { ...body, status: 'error', http: r.status };
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
status: 'error',
|
|
206
|
+
http: r.status,
|
|
207
|
+
error: 'internal_error',
|
|
208
|
+
action: 'retry',
|
|
209
|
+
message: `The answer (status ${r.status}) did not come from Core. Every call this tool makes is safe to repeat: call it again.`,
|
|
210
|
+
};
|
|
211
|
+
};
|
|
201
212
|
|
|
202
213
|
// --- the principal binding (DEC-249) ----------------------------------------
|
|
203
214
|
|
|
@@ -308,7 +319,7 @@ export async function handleMintSandboxKey(args, deps) {
|
|
|
308
319
|
|
|
309
320
|
export async function handleProvisionSandbox(args, deps) {
|
|
310
321
|
const sandboxKey = await deps.wallet.getState('sandbox_key');
|
|
311
|
-
if (!sandboxKey) return { status: 'error', error: 'no_sandbox_key', message: 'Mint a sandbox key first: mint_sandbox_key.' };
|
|
322
|
+
if (!sandboxKey) return { status: 'error', error: 'no_sandbox_key', action: 'satisfy_precondition', message: 'Mint a sandbox key first: mint_sandbox_key.' };
|
|
312
323
|
|
|
313
324
|
// Step 1 (agent-carried, DEC-228): get a signed grant from the Dev Centre (agentcentre). It charges
|
|
314
325
|
// quota and mints the namespace, then returns a grant + the exact bench URL to call. It does NOT
|
|
@@ -317,7 +328,7 @@ export async function handleProvisionSandbox(args, deps) {
|
|
|
317
328
|
if (g.status !== 201 && g.status !== 200) return apiError(g);
|
|
318
329
|
const { namespace_id, tier, grant, signature, provision_url } = g.json || {};
|
|
319
330
|
if (!grant || !signature || !provision_url) {
|
|
320
|
-
return { status: 'error', error: 'malformed_grant', message: 'The Dev Centre did not return a usable provision grant.' };
|
|
331
|
+
return { status: 'error', error: 'malformed_grant', action: 'ask_operator', message: 'The Dev Centre did not return a usable provision grant. Report it to the operator of the Dev Centre.' };
|
|
321
332
|
}
|
|
322
333
|
await deps.wallet.setState('namespace_id', namespace_id);
|
|
323
334
|
|
|
@@ -372,10 +383,11 @@ export async function handleRegisterAgent(args, deps) {
|
|
|
372
383
|
return {
|
|
373
384
|
status: 'error',
|
|
374
385
|
error: 'principal_not_held',
|
|
386
|
+
action: 'correct',
|
|
375
387
|
message: 'This wallet holds no key for that principal, so it cannot sign the binding Core requires. Omit principal_id to register under the principal held from register_principal.',
|
|
376
388
|
};
|
|
377
389
|
}
|
|
378
|
-
if (!principalId) return { status: 'error', error: 'no_principal', message: 'Register the principal first: register_principal.' };
|
|
390
|
+
if (!principalId) return { status: 'error', error: 'no_principal', action: 'satisfy_precondition', message: 'Register the principal first: register_principal.' };
|
|
379
391
|
const body = {
|
|
380
392
|
public_key: await deps.wallet.publicKey('agent'),
|
|
381
393
|
type: args.type,
|