agent-envelope-mcp 1.0.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 +73 -0
- package/bin/agent-envelope-mcp.js +7 -0
- package/package.json +47 -0
- package/src/server.js +152 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# agent-envelope-mcp
|
|
2
|
+
|
|
3
|
+
The neutral authority layer for agent runtimes, 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 and issue agent authority** without building its
|
|
7
|
+
own policy engine, audit log, or verification stack. AgentEnvelope is owned by
|
|
8
|
+
no framework, so every framework can embed it.
|
|
9
|
+
|
|
10
|
+
## Run
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx agent-envelope-mcp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
It speaks MCP over stdio. No API key is needed to start, or to use the sovereign
|
|
17
|
+
verifier — only the vault-governed tools require `AE_API_KEY`.
|
|
18
|
+
|
|
19
|
+
## Wire it into an MCP client
|
|
20
|
+
|
|
21
|
+
Point your client at the command and pass the vault-issued key in the
|
|
22
|
+
environment (only needed for the custody tools):
|
|
23
|
+
|
|
24
|
+
```jsonc
|
|
25
|
+
{
|
|
26
|
+
"mcpServers": {
|
|
27
|
+
"agent-envelope": {
|
|
28
|
+
"command": "npx",
|
|
29
|
+
"args": ["-y", "agent-envelope-mcp"],
|
|
30
|
+
"env": { "AE_API_KEY": "your-vault-issued-key" }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Tools
|
|
37
|
+
|
|
38
|
+
| Tool | Mode | Credential |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `ae_verify_sovereign` | Sovereign | none — offline, always free |
|
|
41
|
+
| `ae_get_agent` | Custody | `AE_API_KEY` |
|
|
42
|
+
| `ae_verify_action` | Custody | `AE_API_KEY` |
|
|
43
|
+
| `ae_mint` | Custody | `AE_API_KEY` |
|
|
44
|
+
|
|
45
|
+
- **`ae_verify_sovereign`** — verify a signed message against a known agent
|
|
46
|
+
address. Pure crypto: no vault, no key, no network. Verification is always free.
|
|
47
|
+
- **`ae_get_agent`** — fetch the vault-registered public record for an agent id.
|
|
48
|
+
- **`ae_verify_action`** — verify a signed action against the vault-held record.
|
|
49
|
+
- **`ae_mint`** — mint a capability through the vault from a `MintDelegate` and a
|
|
50
|
+
signed `MintRequest`, returning a mint receipt. This is a governed action.
|
|
51
|
+
|
|
52
|
+
The sovereign verifier needs no vault and no key. The vault-gated tools are the
|
|
53
|
+
governed surface a framework offloads rather than rebuilds.
|
|
54
|
+
|
|
55
|
+
## Programmatic use
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import { createServer } from 'agent-envelope-mcp';
|
|
59
|
+
// mount createServer() on your own MCP transport
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Environment
|
|
63
|
+
|
|
64
|
+
| Variable | Required for | Purpose |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `AE_API_KEY` | `ae_get_agent`, `ae_verify_action`, `ae_mint` | Vault-issued API key |
|
|
67
|
+
|
|
68
|
+
The server is fail-closed: vault-gated tools return an error result when
|
|
69
|
+
`AE_API_KEY` is absent rather than exposing an unauthenticated surface.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-envelope-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Neutral MCP server for AgentEnvelope — expose agent authority (sovereign verify + vault-governed verify, lookup, and mint) to any MCP client.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agent-envelope-mcp": "bin/agent-envelope-mcp.js"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./src/server.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin",
|
|
14
|
+
"src",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"start": "node bin/agent-envelope-mcp.js"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
25
|
+
"agent-envelope-sdk": "^1.1.0",
|
|
26
|
+
"zod": "^4.4.3"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"mcp",
|
|
30
|
+
"model-context-protocol",
|
|
31
|
+
"agent-envelope",
|
|
32
|
+
"agent",
|
|
33
|
+
"authority",
|
|
34
|
+
"verification",
|
|
35
|
+
"identity"
|
|
36
|
+
],
|
|
37
|
+
"author": "BlackBox Engineering",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/BlackBoxEngineering/agent-envelope-mcp.git"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/BlackBoxEngineering/agent-envelope-mcp#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/BlackBoxEngineering/agent-envelope-mcp/issues"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/server.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentEnvelope MCP server — the neutral authority layer for agent runtimes.
|
|
3
|
+
*
|
|
4
|
+
* Any MCP client (Claude, an OpenAI agent, LangChain, CrewAI, a custom runtime)
|
|
5
|
+
* can call these tools to check and issue authority without building its own
|
|
6
|
+
* policy engine, audit log, or verification stack. AgentEnvelope is owned by no
|
|
7
|
+
* framework, so every framework can embed it.
|
|
8
|
+
*
|
|
9
|
+
* Two tiers of tools, matching the two modes:
|
|
10
|
+
*
|
|
11
|
+
* Sovereign (free, offline, no credential):
|
|
12
|
+
* - ae_verify_sovereign verify a signature against a known agent address
|
|
13
|
+
*
|
|
14
|
+
* Custody (vault-governed, requires AE_API_KEY):
|
|
15
|
+
* - ae_get_agent look up a registered agent's public record
|
|
16
|
+
* - ae_verify_action verify a signed action against the vault record
|
|
17
|
+
* - ae_mint mint a capability through the vault (governance event)
|
|
18
|
+
*
|
|
19
|
+
* Verification in sovereign mode is always free. The vault-gated tools are the
|
|
20
|
+
* governed surface: they are what a framework offloads rather than rebuilds.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
24
|
+
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
|
+
function vaultClient() {
|
|
37
|
+
const apiKey = getApiKey();
|
|
38
|
+
if (!apiKey) return null;
|
|
39
|
+
if (!cachedClient) cachedClient = new AgentEnvelopeClient({ apiKey });
|
|
40
|
+
return cachedClient;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const ok = (value) => ({ content: [{ type: 'text', text: JSON.stringify(value, null, 2) }] });
|
|
44
|
+
const fail = (message) => ({ content: [{ type: 'text', text: message }], isError: true });
|
|
45
|
+
const NEEDS_KEY =
|
|
46
|
+
'AE_API_KEY is not set. This is a vault-governed tool; set the vault-issued API key to use it. (Sovereign verification needs no key — use ae_verify_sovereign.)';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Build a fully configured AgentEnvelope MCP server (not yet connected to a
|
|
50
|
+
* transport). Exported so hosts can mount it on their own transport.
|
|
51
|
+
*/
|
|
52
|
+
export function createServer() {
|
|
53
|
+
const server = new McpServer({ name: 'agent-envelope', version: '1.0.0' });
|
|
54
|
+
|
|
55
|
+
// Sovereign — free, offline, no credential.
|
|
56
|
+
server.registerTool(
|
|
57
|
+
'ae_verify_sovereign',
|
|
58
|
+
{
|
|
59
|
+
title: 'Verify (sovereign, offline)',
|
|
60
|
+
description:
|
|
61
|
+
'Verify a signed message against a known agent address. Pure crypto, no vault, no API key, no network. Verification is always free.',
|
|
62
|
+
inputSchema: {
|
|
63
|
+
message: z.record(z.string(), z.unknown()).describe('The exact signed message object'),
|
|
64
|
+
signature: z.string().describe('0x-prefixed 65-byte signature'),
|
|
65
|
+
expectedAddress: z.string().describe("The agent's 0x address to check against"),
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
async ({ message, signature, expectedAddress }) => {
|
|
69
|
+
try {
|
|
70
|
+
return ok(verifyActionSovereign({ message, signature, expectedAddress }));
|
|
71
|
+
} catch (err) {
|
|
72
|
+
return fail(err instanceof Error ? err.message : 'verification failed');
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// Custody — vault-governed, requires AE_API_KEY.
|
|
78
|
+
server.registerTool(
|
|
79
|
+
'ae_get_agent',
|
|
80
|
+
{
|
|
81
|
+
title: 'Look up registered agent',
|
|
82
|
+
description: 'Fetch the vault-registered public record for an agent id. Requires a vault-issued API key.',
|
|
83
|
+
inputSchema: {
|
|
84
|
+
agentId: z.string().describe('The registered agent id'),
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
async ({ agentId }) => {
|
|
88
|
+
const client = vaultClient();
|
|
89
|
+
if (!client) return fail(NEEDS_KEY);
|
|
90
|
+
try {
|
|
91
|
+
return ok(await client.getAgent(agentId));
|
|
92
|
+
} catch (err) {
|
|
93
|
+
return fail(err instanceof Error ? err.message : 'lookup failed');
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
server.registerTool(
|
|
99
|
+
'ae_verify_action',
|
|
100
|
+
{
|
|
101
|
+
title: 'Verify action (vault-anchored)',
|
|
102
|
+
description: 'Verify a signed action against the vault-held record for an agent. Requires a vault-issued API key.',
|
|
103
|
+
inputSchema: {
|
|
104
|
+
agentId: z.string().describe('The registered agent id'),
|
|
105
|
+
actionIndex: z.number().int().nonnegative().describe('The action index'),
|
|
106
|
+
payload: z.record(z.string(), z.unknown()).describe('The signed action payload'),
|
|
107
|
+
signature: z.string().describe('0x-prefixed 65-byte signature'),
|
|
108
|
+
expectedActionEnvelopeHash: z.string().optional().describe('Optional expected action-envelope hash'),
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
async ({ agentId, actionIndex, payload, signature, expectedActionEnvelopeHash }) => {
|
|
112
|
+
const client = vaultClient();
|
|
113
|
+
if (!client) return fail(NEEDS_KEY);
|
|
114
|
+
try {
|
|
115
|
+
return ok(await client.verifyAction({ agentId, actionIndex, payload, signature, expectedActionEnvelopeHash }));
|
|
116
|
+
} catch (err) {
|
|
117
|
+
return fail(err instanceof Error ? err.message : 'verification failed');
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
server.registerTool(
|
|
123
|
+
'ae_mint',
|
|
124
|
+
{
|
|
125
|
+
title: 'Mint capability (governance event)',
|
|
126
|
+
description:
|
|
127
|
+
'Mint a capability through the vault from a MintDelegate and a signed MintRequest. Returns a mint receipt. Requires a vault-issued API key. This is a governed action.',
|
|
128
|
+
inputSchema: {
|
|
129
|
+
delegate: z.record(z.string(), z.unknown()).describe('The vault-issued MintDelegate'),
|
|
130
|
+
request: z.record(z.string(), z.unknown()).describe('The bot-signed MintRequest'),
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
async ({ delegate, request }) => {
|
|
134
|
+
const client = vaultClient();
|
|
135
|
+
if (!client) return fail(NEEDS_KEY);
|
|
136
|
+
try {
|
|
137
|
+
return ok(await client.mint({ delegate, request }));
|
|
138
|
+
} catch (err) {
|
|
139
|
+
return fail(err instanceof Error ? err.message : 'mint failed');
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
return server;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Build the server and connect it over stdio. */
|
|
148
|
+
export async function start() {
|
|
149
|
+
const server = createServer();
|
|
150
|
+
await server.connect(new StdioServerTransport());
|
|
151
|
+
console.error('AgentEnvelope MCP server ready on stdio.');
|
|
152
|
+
}
|