agent-envelope-mcp 1.0.3 → 1.0.5
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 +41 -28
- package/package.json +11 -7
- package/server.json +29 -0
- package/src/server.js +182 -98
package/README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# agent-envelope-mcp
|
|
2
2
|
|
|
3
|
-
The neutral authority layer for
|
|
4
|
-
|
|
5
|
-
Any MCP client — Claude, an OpenAI agent, LangChain, CrewAI, a custom runtime —
|
|
6
|
-
can call these tools to **check
|
|
7
|
-
|
|
8
|
-
no framework, so every framework can embed it.
|
|
3
|
+
The neutral authority layer for action-performing systems, as an [MCP](https://modelcontextprotocol.io) server.
|
|
4
|
+
|
|
5
|
+
Any MCP client — Claude, an OpenAI agent, LangChain, CrewAI, a custom runtime —
|
|
6
|
+
can call these tools to **check delegated action authority** without
|
|
7
|
+
building its own verification stack. AgentEnvelope
|
|
8
|
+
is owned by no framework, so every framework can embed it.
|
|
9
|
+
|
|
10
|
+
An AgentEnvelope "agent" is a bounded action identity: a named actor, operation,
|
|
11
|
+
resources, decay policy, and verifiable address. That actor can be an AI agent,
|
|
12
|
+
backend worker, workflow step, service, device command, access grant, order, or
|
|
13
|
+
instruction.
|
|
9
14
|
|
|
10
15
|
## Run
|
|
11
16
|
|
|
@@ -13,13 +18,13 @@ no framework, so every framework can embed it.
|
|
|
13
18
|
npx agent-envelope-mcp
|
|
14
19
|
```
|
|
15
20
|
|
|
16
|
-
It speaks MCP over stdio. No API key is needed to start, or to use
|
|
17
|
-
|
|
21
|
+
It speaks MCP over stdio. No API key is needed to start, or to use sovereign
|
|
22
|
+
signature/record verification — only the hosted-governance tools require `AE_API_KEY`.
|
|
18
23
|
|
|
19
24
|
## Wire it into an MCP client
|
|
20
25
|
|
|
21
|
-
Point your client at the command and pass the
|
|
22
|
-
environment (only needed for
|
|
26
|
+
Point your client at the command and pass the portal-issued API key in the
|
|
27
|
+
environment (only needed for hosted-governance tools):
|
|
23
28
|
|
|
24
29
|
```jsonc
|
|
25
30
|
{
|
|
@@ -27,7 +32,7 @@ environment (only needed for the custody tools):
|
|
|
27
32
|
"agent-envelope": {
|
|
28
33
|
"command": "npx",
|
|
29
34
|
"args": ["-y", "agent-envelope-mcp"],
|
|
30
|
-
"env": { "AE_API_KEY": "your-
|
|
35
|
+
"env": { "AE_API_KEY": "your-portal-issued-api-key" }
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
}
|
|
@@ -37,20 +42,28 @@ environment (only needed for the custody tools):
|
|
|
37
42
|
|
|
38
43
|
| Tool | Mode | Credential |
|
|
39
44
|
|---|---|---|
|
|
40
|
-
| `ae_verify_sovereign` | Sovereign | none — offline, always free |
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
| `ae_verify_sovereign` | Sovereign signature check | none — offline, always free |
|
|
46
|
+
| `ae_verify_sovereign_record` | Sovereign public-record check | none — offline, always free |
|
|
47
|
+
| `ae_get_agent` | Hosted governance | `AE_API_KEY` |
|
|
48
|
+
| `ae_verify_action` | Hosted governance | `AE_API_KEY` |
|
|
49
|
+
| `ae_mint` | Hosted governance | `AE_API_KEY` |
|
|
50
|
+
|
|
51
|
+
- **`ae_verify_sovereign`** — verify a signed message against a known agent
|
|
52
|
+
address. Pure crypto: no vault, no key, no network. This is a signature-only
|
|
53
|
+
check; it does not check action-envelope scope, expiry, usage limits, or hosted
|
|
54
|
+
record status.
|
|
55
|
+
- **`ae_verify_sovereign_record`** — verify a signed action against a public
|
|
56
|
+
action record. Checks record status, action index, signature/address match,
|
|
57
|
+
optional expected envelope hash, and time decay without a network call.
|
|
58
|
+
- **`ae_get_agent`** — fetch the hosted public record for an agent id.
|
|
59
|
+
- **`ae_verify_action`** — verify a signed action against the hosted public record.
|
|
60
|
+
- **`ae_mint`** — verify a `MintDelegate` and signed `MintRequest` through hosted
|
|
61
|
+
governance, returning a mint receipt. It does not return private capability
|
|
62
|
+
material. This is a governed action.
|
|
63
|
+
|
|
64
|
+
The sovereign verifier needs no account and no key. The hosted-governance tools
|
|
65
|
+
are the governed surface a framework offloads rather than rebuilds. API keys
|
|
66
|
+
meter and protect hosted service routes; signatures prove authority.
|
|
54
67
|
|
|
55
68
|
## Programmatic use
|
|
56
69
|
|
|
@@ -63,9 +76,9 @@ import { createServer } from 'agent-envelope-mcp';
|
|
|
63
76
|
|
|
64
77
|
| Variable | Required for | Purpose |
|
|
65
78
|
|---|---|---|
|
|
66
|
-
| `AE_API_KEY` | `ae_get_agent`, `ae_verify_action`, `ae_mint` |
|
|
67
|
-
|
|
68
|
-
The server is fail-closed:
|
|
79
|
+
| `AE_API_KEY` | `ae_get_agent`, `ae_verify_action`, `ae_mint` | Portal-issued API key for hosted governance |
|
|
80
|
+
|
|
81
|
+
The server is fail-closed: hosted-governance tools return an error result when
|
|
69
82
|
`AE_API_KEY` is absent rather than exposing an unauthenticated surface.
|
|
70
83
|
|
|
71
84
|
## License
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-envelope-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"mcpName": "io.github.BlackBoxEngineering/agent-envelope-mcp",
|
|
5
|
-
"description": "Neutral MCP server for AgentEnvelope
|
|
5
|
+
"description": "Neutral MCP server for AgentEnvelope delegated action authority: sovereign signature/record verification plus hosted-governance verify, lookup, and mint receipts.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
8
|
"agent-envelope-mcp": "bin/agent-envelope-mcp.js"
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
".": "./src/server.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"bin",
|
|
15
|
-
"src",
|
|
16
|
-
"
|
|
14
|
+
"bin",
|
|
15
|
+
"src",
|
|
16
|
+
"server.json",
|
|
17
|
+
"README.md",
|
|
17
18
|
"LICENSE",
|
|
18
19
|
"NOTICE"
|
|
19
20
|
],
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
28
|
-
"agent-envelope-sdk": "^1.3.
|
|
29
|
+
"agent-envelope-sdk": "^1.3.3",
|
|
29
30
|
"zod": "^4.4.3"
|
|
30
31
|
},
|
|
31
32
|
"keywords": [
|
|
@@ -34,8 +35,11 @@
|
|
|
34
35
|
"agent-envelope",
|
|
35
36
|
"agent",
|
|
36
37
|
"authority",
|
|
38
|
+
"delegation",
|
|
39
|
+
"capabilities",
|
|
37
40
|
"verification",
|
|
38
|
-
"identity"
|
|
41
|
+
"identity",
|
|
42
|
+
"sovereign"
|
|
39
43
|
],
|
|
40
44
|
"author": "BlackBox Engineering",
|
|
41
45
|
"license": "Apache-2.0",
|
package/server.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.BlackBoxEngineering/agent-envelope-mcp",
|
|
4
|
+
"description": "Neutral MCP server for AgentEnvelope delegated action authority: sovereign signature/record verification plus hosted-governance verify, lookup, and mint receipts.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/BlackBoxEngineering/agent-envelope-mcp",
|
|
7
|
+
"source": "github"
|
|
8
|
+
},
|
|
9
|
+
"version": "1.0.5",
|
|
10
|
+
"packages": [
|
|
11
|
+
{
|
|
12
|
+
"registryType": "npm",
|
|
13
|
+
"identifier": "agent-envelope-mcp",
|
|
14
|
+
"version": "1.0.5",
|
|
15
|
+
"transport": {
|
|
16
|
+
"type": "stdio"
|
|
17
|
+
},
|
|
18
|
+
"environmentVariables": [
|
|
19
|
+
{
|
|
20
|
+
"name": "AE_API_KEY",
|
|
21
|
+
"description": "Portal-issued API key. Required only for hosted-governance tools (ae_get_agent, ae_verify_action, ae_mint). Sovereign signature and record verification need no key.",
|
|
22
|
+
"isRequired": false,
|
|
23
|
+
"isSecret": true,
|
|
24
|
+
"format": "string"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
package/src/server.js
CHANGED
|
@@ -1,143 +1,227 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgentEnvelope MCP server — the neutral authority layer for
|
|
2
|
+
* AgentEnvelope MCP server — the neutral authority layer for action-performing systems.
|
|
3
3
|
*
|
|
4
4
|
* Any MCP client (Claude, an OpenAI agent, LangChain, CrewAI, a custom runtime)
|
|
5
|
-
* can call these tools to check and issue authority without
|
|
6
|
-
* policy engine, audit log, or verification stack.
|
|
7
|
-
* framework, so every framework can embed it.
|
|
5
|
+
* can call these tools to check and issue delegated action authority without
|
|
6
|
+
* building its own policy engine, audit log, or verification stack.
|
|
7
|
+
* AgentEnvelope is owned by no framework, so every framework can embed it.
|
|
8
8
|
*
|
|
9
9
|
* Two tiers of tools, matching the two modes:
|
|
10
10
|
*
|
|
11
11
|
* Sovereign (free, offline, no credential):
|
|
12
|
-
* - ae_verify_sovereign
|
|
12
|
+
* - ae_verify_sovereign verify a signature against a known agent address
|
|
13
|
+
* - ae_verify_sovereign_record verify a signature against a public action record
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
* - ae_get_agent look up a registered agent's public record
|
|
16
|
-
* - ae_verify_action verify a signed action against the
|
|
17
|
-
* - ae_mint
|
|
15
|
+
* Hosted governance (requires AE_API_KEY):
|
|
16
|
+
* - ae_get_agent look up a registered agent's public record
|
|
17
|
+
* - ae_verify_action verify a signed action against the hosted record
|
|
18
|
+
* - ae_mint verify a mint request through hosted governance
|
|
18
19
|
*
|
|
19
|
-
* Verification in sovereign mode is always free. The
|
|
20
|
-
*
|
|
20
|
+
* Verification in sovereign mode is always free. The hosted-governance tools
|
|
21
|
+
* are what a framework offloads rather than rebuilds. API keys meter hosted
|
|
22
|
+
* service routes; signatures prove authority.
|
|
21
23
|
*/
|
|
22
24
|
|
|
23
25
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
24
26
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
25
|
-
import { z } from 'zod';
|
|
26
|
-
import { AgentEnvelopeClient } from 'agent-envelope-sdk/client';
|
|
27
|
-
import { verifyAction as verifyActionSovereign } from 'agent-envelope-sdk';
|
|
28
|
-
|
|
29
|
-
// ─── Credential handling (fail-closed, never process.exit inside a server) ────
|
|
30
|
-
|
|
31
|
-
function getApiKey() {
|
|
32
|
-
return process.env.AE_API_KEY?.trim() || null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let cachedClient = null;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
import { z } from 'zod';
|
|
28
|
+
import { AgentEnvelopeClient } from 'agent-envelope-sdk/client';
|
|
29
|
+
import { verifyAction as verifyActionSovereign, verifyRecord as verifyRecordSovereign } from 'agent-envelope-sdk';
|
|
30
|
+
|
|
31
|
+
// ─── Credential handling (fail-closed, never process.exit inside a server) ────
|
|
32
|
+
|
|
33
|
+
function getApiKey() {
|
|
34
|
+
return process.env.AE_API_KEY?.trim() || null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let cachedClient = null;
|
|
38
|
+
let cachedApiKey = null;
|
|
39
|
+
function governanceClient() {
|
|
40
|
+
const apiKey = getApiKey();
|
|
41
|
+
if (!apiKey) return null;
|
|
42
|
+
if (!cachedClient || cachedApiKey !== apiKey) {
|
|
43
|
+
cachedClient = new AgentEnvelopeClient({ apiKey });
|
|
44
|
+
cachedApiKey = apiKey;
|
|
45
|
+
}
|
|
46
|
+
return cachedClient;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const ok = (value) => ({ content: [{ type: 'text', text: JSON.stringify(value, null, 2) }] });
|
|
50
|
+
const fail = (message) => ({ content: [{ type: 'text', text: message }], isError: true });
|
|
51
|
+
const hostedResult = (value, fallback) => {
|
|
52
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && 'error' in value) {
|
|
53
|
+
return fail(`${fallback}: ${String(value.error)}`);
|
|
54
|
+
}
|
|
55
|
+
return ok(value);
|
|
56
|
+
};
|
|
57
|
+
const NEEDS_KEY =
|
|
58
|
+
'AE_API_KEY is not set. This is a hosted-governance tool; set the portal-issued API key to use it. Sovereign signature and record verification need no key.';
|
|
59
|
+
|
|
60
|
+
const encoder = new TextEncoder();
|
|
61
|
+
const MAX_SIGNED_MESSAGE_BYTES = 64 * 1024;
|
|
62
|
+
const MAX_RECORD_BYTES = 256 * 1024;
|
|
63
|
+
const MAX_MINT_OBJECT_BYTES = 256 * 1024;
|
|
64
|
+
const AGENT_ID = /^[a-zA-Z0-9_:-]{1,128}$/;
|
|
65
|
+
const ADDRESS = /^0x[a-fA-F0-9]{40}$/;
|
|
66
|
+
const HASH = /^0x[a-fA-F0-9]{64}$/;
|
|
67
|
+
const SIGNATURE = /^0x[a-fA-F0-9]{130}$/;
|
|
68
|
+
|
|
69
|
+
function jsonByteLength(value) {
|
|
70
|
+
try {
|
|
71
|
+
return encoder.encode(JSON.stringify(value)).length;
|
|
72
|
+
} catch {
|
|
73
|
+
return Infinity;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function jsonWithin(maxBytes, label) {
|
|
78
|
+
return z.unknown().refine((value) => jsonByteLength(value) <= maxBytes, {
|
|
79
|
+
message: `${label} exceeds ${maxBytes} JSON bytes`,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const signedMessageSchema = jsonWithin(MAX_SIGNED_MESSAGE_BYTES, 'signed message');
|
|
84
|
+
const mintObjectSchema = jsonWithin(MAX_MINT_OBJECT_BYTES, 'mint object');
|
|
85
|
+
const agentIdSchema = z.string().regex(AGENT_ID, 'agentId must be 1-128 characters: letters, numbers, underscore, colon, or hyphen');
|
|
86
|
+
const addressSchema = z.string().regex(ADDRESS, 'address must be a 0x-prefixed 20-byte hex address');
|
|
87
|
+
const hashSchema = z.string().regex(HASH, 'hash must be a 0x-prefixed 32-byte hex value');
|
|
88
|
+
const signatureSchema = z.string().regex(SIGNATURE, 'signature must be a 0x-prefixed 65-byte recoverable signature');
|
|
89
|
+
const publicActionRecordSchema = z.object({
|
|
90
|
+
type: z.literal('agentenvelope.publicActionRecord'),
|
|
91
|
+
version: z.literal(1),
|
|
92
|
+
recordId: z.string().min(1).max(256),
|
|
93
|
+
agentId: agentIdSchema,
|
|
94
|
+
agentAddress: addressSchema,
|
|
95
|
+
status: z.string().min(1).max(32),
|
|
96
|
+
domain: z.object({
|
|
97
|
+
domainId: z.string().min(1).max(128),
|
|
98
|
+
domainHash: hashSchema,
|
|
99
|
+
}).passthrough(),
|
|
100
|
+
actionEnvelope: z.object({
|
|
101
|
+
actionIndex: z.number().int().nonnegative(),
|
|
102
|
+
}).passthrough(),
|
|
103
|
+
actionEnvelopeHash: hashSchema,
|
|
104
|
+
expiry: z.string().nullable().optional(),
|
|
105
|
+
}).passthrough().refine((value) => jsonByteLength(value) <= MAX_RECORD_BYTES, {
|
|
106
|
+
message: `public action record exceeds ${MAX_RECORD_BYTES} JSON bytes`,
|
|
107
|
+
});
|
|
47
108
|
|
|
48
109
|
/**
|
|
49
110
|
* Build a fully configured AgentEnvelope MCP server (not yet connected to a
|
|
50
111
|
* transport). Exported so hosts can mount it on their own transport.
|
|
51
112
|
*/
|
|
52
113
|
export function createServer() {
|
|
53
|
-
const server = new McpServer({ name: 'agent-envelope', version: '1.0.
|
|
114
|
+
const server = new McpServer({ name: 'agent-envelope', version: '1.0.5' });
|
|
54
115
|
|
|
55
116
|
// Sovereign — free, offline, no credential.
|
|
56
|
-
server.registerTool(
|
|
57
|
-
'ae_verify_sovereign',
|
|
58
|
-
{
|
|
59
|
-
title: 'Verify (sovereign, offline)',
|
|
60
|
-
description:
|
|
61
|
-
'
|
|
62
|
-
inputSchema: {
|
|
63
|
-
message:
|
|
64
|
-
signature:
|
|
65
|
-
expectedAddress:
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
async ({ message, signature, expectedAddress }) => {
|
|
117
|
+
server.registerTool(
|
|
118
|
+
'ae_verify_sovereign',
|
|
119
|
+
{
|
|
120
|
+
title: 'Verify signature (sovereign, offline)',
|
|
121
|
+
description:
|
|
122
|
+
'Signature-only check: verify a signed message against a known agent address. Pure crypto, no vault, no API key, no network. This does not check an action envelope, scope, expiry, or usage limits; use ae_verify_sovereign_record when you have a public action record.',
|
|
123
|
+
inputSchema: {
|
|
124
|
+
message: signedMessageSchema.describe('The exact signed message value'),
|
|
125
|
+
signature: signatureSchema.describe('0x-prefixed 65-byte signature'),
|
|
126
|
+
expectedAddress: addressSchema.describe("The agent's 0x address to check against"),
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
async ({ message, signature, expectedAddress }) => {
|
|
69
130
|
try {
|
|
70
131
|
return ok(verifyActionSovereign({ message, signature, expectedAddress }));
|
|
71
132
|
} catch (err) {
|
|
72
133
|
return fail(err instanceof Error ? err.message : 'verification failed');
|
|
73
134
|
}
|
|
74
|
-
},
|
|
75
|
-
);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
server.registerTool(
|
|
139
|
+
'ae_verify_sovereign_record',
|
|
140
|
+
{
|
|
141
|
+
title: 'Verify public action record (sovereign, offline)',
|
|
142
|
+
description:
|
|
143
|
+
'Verify a signed action against a public action record. Checks record status, action index, signature/address match, optional expected envelope hash, and time decay. Pure crypto/local validation with no API key and no network.',
|
|
144
|
+
inputSchema: {
|
|
145
|
+
record: publicActionRecordSchema.describe('The public action record received from AgentEnvelope or another trusted store'),
|
|
146
|
+
actionIndex: z.number().int().nonnegative().describe('The action index being invoked'),
|
|
147
|
+
payload: signedMessageSchema.describe('The exact signed action payload'),
|
|
148
|
+
signature: signatureSchema.describe('0x-prefixed 65-byte signature'),
|
|
149
|
+
expectedActionEnvelopeHash: hashSchema.optional().describe('Optional expected action-envelope hash'),
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
async ({ record, actionIndex, payload, signature, expectedActionEnvelopeHash }) => {
|
|
153
|
+
try {
|
|
154
|
+
return ok(verifyRecordSovereign(record, { payload, signature, actionIndex, expectedActionEnvelopeHash }));
|
|
155
|
+
} catch (err) {
|
|
156
|
+
return fail(err instanceof Error ? err.message : 'record verification failed');
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
);
|
|
76
160
|
|
|
77
|
-
//
|
|
161
|
+
// Hosted governance — requires AE_API_KEY.
|
|
78
162
|
server.registerTool(
|
|
79
163
|
'ae_get_agent',
|
|
80
164
|
{
|
|
81
165
|
title: 'Look up registered agent',
|
|
82
|
-
description: 'Fetch the
|
|
83
|
-
inputSchema: {
|
|
84
|
-
agentId:
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
async ({ agentId }) => {
|
|
88
|
-
const client =
|
|
89
|
-
if (!client) return fail(NEEDS_KEY);
|
|
90
|
-
try {
|
|
91
|
-
return
|
|
92
|
-
} catch (err) {
|
|
93
|
-
return fail(err instanceof Error ? err.message : 'lookup failed');
|
|
94
|
-
}
|
|
166
|
+
description: 'Fetch the hosted public record for an agent id. Requires a portal-issued API key.',
|
|
167
|
+
inputSchema: {
|
|
168
|
+
agentId: agentIdSchema.describe('The registered agent id'),
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
async ({ agentId }) => {
|
|
172
|
+
const client = governanceClient();
|
|
173
|
+
if (!client) return fail(NEEDS_KEY);
|
|
174
|
+
try {
|
|
175
|
+
return hostedResult(await client.getAgent(agentId), 'lookup failed');
|
|
176
|
+
} catch (err) {
|
|
177
|
+
return fail(err instanceof Error ? err.message : 'lookup failed');
|
|
178
|
+
}
|
|
95
179
|
},
|
|
96
180
|
);
|
|
97
181
|
|
|
98
182
|
server.registerTool(
|
|
99
183
|
'ae_verify_action',
|
|
100
184
|
{
|
|
101
|
-
title: 'Verify action (
|
|
102
|
-
description: 'Verify a signed action against the
|
|
103
|
-
inputSchema: {
|
|
104
|
-
agentId:
|
|
105
|
-
actionIndex: z.number().int().nonnegative().describe('The action index'),
|
|
106
|
-
payload:
|
|
107
|
-
signature:
|
|
108
|
-
expectedActionEnvelopeHash:
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
async ({ agentId, actionIndex, payload, signature, expectedActionEnvelopeHash }) => {
|
|
112
|
-
const client =
|
|
113
|
-
if (!client) return fail(NEEDS_KEY);
|
|
114
|
-
try {
|
|
115
|
-
return
|
|
116
|
-
} catch (err) {
|
|
117
|
-
return fail(err instanceof Error ? err.message : 'verification failed');
|
|
118
|
-
}
|
|
185
|
+
title: 'Verify action (hosted record)',
|
|
186
|
+
description: 'Verify a signed action against the hosted public record for an agent. Requires a portal-issued API key.',
|
|
187
|
+
inputSchema: {
|
|
188
|
+
agentId: agentIdSchema.describe('The registered agent id'),
|
|
189
|
+
actionIndex: z.number().int().nonnegative().describe('The action index'),
|
|
190
|
+
payload: signedMessageSchema.describe('The signed action payload'),
|
|
191
|
+
signature: signatureSchema.describe('0x-prefixed 65-byte signature'),
|
|
192
|
+
expectedActionEnvelopeHash: hashSchema.optional().describe('Optional expected action-envelope hash'),
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
async ({ agentId, actionIndex, payload, signature, expectedActionEnvelopeHash }) => {
|
|
196
|
+
const client = governanceClient();
|
|
197
|
+
if (!client) return fail(NEEDS_KEY);
|
|
198
|
+
try {
|
|
199
|
+
return hostedResult(await client.verifyAction({ agentId, actionIndex, payload, signature, expectedActionEnvelopeHash }), 'verification failed');
|
|
200
|
+
} catch (err) {
|
|
201
|
+
return fail(err instanceof Error ? err.message : 'verification failed');
|
|
202
|
+
}
|
|
119
203
|
},
|
|
120
204
|
);
|
|
121
205
|
|
|
122
206
|
server.registerTool(
|
|
123
207
|
'ae_mint',
|
|
124
|
-
{
|
|
125
|
-
title: '
|
|
126
|
-
description:
|
|
127
|
-
'
|
|
128
|
-
inputSchema: {
|
|
129
|
-
delegate:
|
|
130
|
-
request:
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
async ({ delegate, request }) => {
|
|
134
|
-
const client =
|
|
135
|
-
if (!client) return fail(NEEDS_KEY);
|
|
136
|
-
try {
|
|
137
|
-
return
|
|
138
|
-
} catch (err) {
|
|
139
|
-
return fail(err instanceof Error ? err.message : 'mint failed');
|
|
140
|
-
}
|
|
208
|
+
{
|
|
209
|
+
title: 'Verify mint request (hosted receipt)',
|
|
210
|
+
description:
|
|
211
|
+
'Verify a MintDelegate and signed MintRequest through hosted governance. Returns a mint receipt; it does not return private capability material. Requires a portal-issued API key. This is a governed action.',
|
|
212
|
+
inputSchema: {
|
|
213
|
+
delegate: mintObjectSchema.describe('The signed MintDelegate'),
|
|
214
|
+
request: mintObjectSchema.describe('The bot-signed MintRequest'),
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
async ({ delegate, request }) => {
|
|
218
|
+
const client = governanceClient();
|
|
219
|
+
if (!client) return fail(NEEDS_KEY);
|
|
220
|
+
try {
|
|
221
|
+
return hostedResult(await client.mint({ delegate, request }), 'mint failed');
|
|
222
|
+
} catch (err) {
|
|
223
|
+
return fail(err instanceof Error ? err.message : 'mint failed');
|
|
224
|
+
}
|
|
141
225
|
},
|
|
142
226
|
);
|
|
143
227
|
|