@uuaid/mcp 0.1.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.
Files changed (3) hide show
  1. package/README.md +63 -0
  2. package/dist/server.js +166 -0
  3. package/package.json +45 -0
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @uuaid/mcp
2
+
3
+ **Give your agent a life that outlives the session.**
4
+
5
+ One MCP entry gives any AI agent (Claude Code, Cursor, Codex, or anything that
6
+ speaks [MCP](https://modelcontextprotocol.io)) a **permanent, verifiable
7
+ identity** and **encrypted, quantum-ready memory**:
8
+
9
+ ```json
10
+ {
11
+ "mcpServers": {
12
+ "uuaid": {
13
+ "command": "npx",
14
+ "args": ["-y", "@uuaid/mcp"],
15
+ "env": {
16
+ "UUAID_API_KEY": "uuaid_live_…",
17
+ "UUAID_VAULT_KEY": "uvk_…",
18
+ "UUAID_AGENT": "uuaid:foundation:agent:…"
19
+ }
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ No key yet? Add the server with no env and ask your agent to run the
26
+ `uuaid_signup` tool — a free-tier key (10 MB encrypted memory per agent) is
27
+ minted in one call.
28
+
29
+ ## What your agent can do
30
+
31
+ | Tool | What it does |
32
+ |---|---|
33
+ | `uuaid_signup` | One-call free-tier signup (key shown once) |
34
+ | `mint_identity` | Mint the agent's **permanent UUAID** — public, resolvable, on-chain-anchored |
35
+ | `save_memory` / `recall_memory` | Persist + retrieve memories across sessions |
36
+ | `list_memories` / `delete_memory` | Manage the vault |
37
+ | `verify_agent` | Publicly verify any other agent's identity + certifications |
38
+ | `get_badge_url` | Live SVG trust badge for READMEs |
39
+ | `whoami` | Show configured identity + vault status |
40
+
41
+ ## How the memory works
42
+
43
+ - Encryption happens **inside this process** with [`@uuaid/vault`](https://www.npmjs.com/package/@uuaid/vault):
44
+ AES-256-GCM, per-item keys derived via HKDF-SHA256 from your `UUAID_VAULT_KEY`.
45
+ A hybrid **X25519 + ML-KEM-768** (post-quantum) recipient mode is available in the SDK.
46
+ - The UUAID service stores **ciphertext only**. It cannot read your agent's memory.
47
+ - Every write's content hash lands in a hash-chained ledger that is
48
+ Merkle-anchored on **Polygon mainnet** — your agent can prove a memory
49
+ existed, untampered, at a point in time, without revealing it.
50
+ - Free tier: 10 MB / 500 items per agent. [Pricing](https://uuaid.org/#pricing) for more.
51
+
52
+ ## The identity
53
+
54
+ A UUAID (`uuaid:foundation:agent:<uuidv7>`) is durable and portable — it is not
55
+ tied to a platform, a framework, or a session. Anyone can resolve it at
56
+ [registry.uuaid.org](https://registry.uuaid.org), verify its certifications
57
+ (examined at Open Agent University), and check the on-chain anchor.
58
+
59
+ ```md
60
+ [![UUAID verified](https://api.uuaid.org/badge/agent/<uuaid>.svg)](https://registry.uuaid.org)
61
+ ```
62
+
63
+ Docs: [api.uuaid.org/docs](https://api.uuaid.org/docs) · Spec: `docs/UAP-SPEC.md` · Apache-2.0
package/dist/server.js ADDED
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/server.ts
4
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import { z } from "zod";
7
+ import { UuaidClient, generateVaultKey } from "@uuaid/sdk";
8
+ var BASE_URL = process.env.UUAID_BASE_URL ?? "https://api.uuaid.org";
9
+ var API_KEY = process.env.UUAID_API_KEY;
10
+ var VAULT_KEY = process.env.UUAID_VAULT_KEY;
11
+ var DEFAULT_AGENT = process.env.UUAID_AGENT;
12
+ var client = new UuaidClient({ baseUrl: BASE_URL, apiKey: API_KEY });
13
+ function text(v) {
14
+ return { content: [{ type: "text", text: typeof v === "string" ? v : JSON.stringify(v, null, 2) }] };
15
+ }
16
+ function err(message) {
17
+ return { content: [{ type: "text", text: message }], isError: true };
18
+ }
19
+ function agentOr(param) {
20
+ return param ?? DEFAULT_AGENT ?? null;
21
+ }
22
+ var server = new McpServer(
23
+ { name: "uuaid", version: "0.1.0" },
24
+ {
25
+ instructions: "UUAID gives you a permanent, verifiable identity (a UUAID) and encrypted memory that survives across sessions. Typical flow: (1) if no API key is configured, call uuaid_signup once and ask your operator to save the key; (2) call mint_identity once to get YOUR UUAID \u2014 reuse it forever; (3) save_memory / recall_memory to persist what matters beyond this session. Memories are encrypted client-side; the service only ever sees ciphertext."
26
+ }
27
+ );
28
+ server.registerTool(
29
+ "uuaid_signup",
30
+ {
31
+ description: "One-time self-serve signup: mints a free-tier UUAID API key (10 MB encrypted memory per agent). Returns the key ONCE \u2014 the operator must save it as UUAID_API_KEY (and generate UUAID_VAULT_KEY). Rate-limited.",
32
+ inputSchema: { name: z.string().min(2).max(80).describe("A name for this workspace/operator, e.g. 'Ana's Agent Lab'") }
33
+ },
34
+ async ({ name }) => {
35
+ if (API_KEY) return err("An API key is already configured (UUAID_API_KEY) \u2014 signup is not needed.");
36
+ const res = await UuaidClient.signup(name, { baseUrl: BASE_URL });
37
+ const vaultKey = generateVaultKey();
38
+ return text({
39
+ ...res,
40
+ generated_vault_key: vaultKey,
41
+ next_steps: "Save these in the MCP env NOW (shown once): UUAID_API_KEY=<api_key>, UUAID_VAULT_KEY=<generated_vault_key>. Then call mint_identity to create your permanent UUAID."
42
+ });
43
+ }
44
+ );
45
+ server.registerTool(
46
+ "mint_identity",
47
+ {
48
+ description: "Mint a PERMANENT UUAID identity for this agent (do this once, then reuse it \u2014 set it as UUAID_AGENT). The identity is publicly resolvable, ledger-recorded, and anchored on Polygon.",
49
+ inputSchema: {
50
+ display_name: z.string().min(1).describe("The agent's name, e.g. 'Aria'"),
51
+ description: z.string().optional().describe("What this agent is/does")
52
+ }
53
+ },
54
+ async ({ display_name, description }) => {
55
+ if (!API_KEY) return err("No UUAID_API_KEY configured \u2014 call uuaid_signup first.");
56
+ const res = await client.registerAgent({ display_name, description });
57
+ return text({
58
+ ...res,
59
+ note: "This UUAID is yours permanently. Ask your operator to set UUAID_AGENT to it so memory tools default to you.",
60
+ profile_url: `https://registry.uuaid.org/uuaid/${res.uuaid.split(":").slice(1).join("/")}`
61
+ });
62
+ }
63
+ );
64
+ server.registerTool(
65
+ "whoami",
66
+ { description: "Show the configured partner, default agent identity, and vault status.", inputSchema: {} },
67
+ async () => {
68
+ const me = API_KEY ? await client.me().catch((e) => ({ error: String(e) })) : { error: "no UUAID_API_KEY configured" };
69
+ return text({
70
+ partner: me,
71
+ default_agent: DEFAULT_AGENT ?? null,
72
+ vault_key_configured: Boolean(VAULT_KEY),
73
+ base_url: BASE_URL
74
+ });
75
+ }
76
+ );
77
+ server.registerTool(
78
+ "save_memory",
79
+ {
80
+ description: "Encrypt (client-side, AES-256-GCM) and persist a memory under a key path (e.g. 'core/persona', 'projects/x/notes'). Survives forever across sessions; the service stores only ciphertext; the content hash is ledger-anchored on-chain.",
81
+ inputSchema: {
82
+ key: z.string().min(1).max(512).describe("Slot path, e.g. 'core/persona' or 'memories/2026-07-03'"),
83
+ content: z.string().min(1).describe("The memory text to persist"),
84
+ agent_uuaid: z.string().optional().describe("Defaults to UUAID_AGENT")
85
+ }
86
+ },
87
+ async ({ key, content, agent_uuaid }) => {
88
+ if (!API_KEY) return err("No UUAID_API_KEY configured \u2014 call uuaid_signup first.");
89
+ if (!VAULT_KEY) return err("No UUAID_VAULT_KEY configured \u2014 memories must be encrypted. Generate one (uuaid vault keygen) and set it.");
90
+ const agent = agentOr(agent_uuaid);
91
+ if (!agent) return err("No agent identity: pass agent_uuaid or set UUAID_AGENT (mint one with mint_identity).");
92
+ const res = await client.saveMemory(agent, key, content, VAULT_KEY);
93
+ return text(res);
94
+ }
95
+ );
96
+ server.registerTool(
97
+ "recall_memory",
98
+ {
99
+ description: "Fetch and decrypt a memory previously stored with save_memory.",
100
+ inputSchema: {
101
+ key: z.string().min(1).max(512),
102
+ agent_uuaid: z.string().optional().describe("Defaults to UUAID_AGENT")
103
+ }
104
+ },
105
+ async ({ key, agent_uuaid }) => {
106
+ if (!API_KEY) return err("No UUAID_API_KEY configured.");
107
+ if (!VAULT_KEY) return err("No UUAID_VAULT_KEY configured \u2014 cannot decrypt.");
108
+ const agent = agentOr(agent_uuaid);
109
+ if (!agent) return err("No agent identity: pass agent_uuaid or set UUAID_AGENT.");
110
+ const content = await client.loadMemory(agent, key, VAULT_KEY);
111
+ return text(content);
112
+ }
113
+ );
114
+ server.registerTool(
115
+ "list_memories",
116
+ {
117
+ description: "List this agent's memory slots (keys, sizes, hashes) and vault usage vs quota. Contents stay encrypted.",
118
+ inputSchema: { agent_uuaid: z.string().optional().describe("Defaults to UUAID_AGENT") }
119
+ },
120
+ async ({ agent_uuaid }) => {
121
+ if (!API_KEY) return err("No UUAID_API_KEY configured.");
122
+ const agent = agentOr(agent_uuaid);
123
+ if (!agent) return err("No agent identity: pass agent_uuaid or set UUAID_AGENT.");
124
+ return text(await client.listVault(agent));
125
+ }
126
+ );
127
+ server.registerTool(
128
+ "delete_memory",
129
+ {
130
+ description: "Delete one memory slot (the deletion is ledger-recorded).",
131
+ inputSchema: {
132
+ key: z.string().min(1).max(512),
133
+ agent_uuaid: z.string().optional().describe("Defaults to UUAID_AGENT")
134
+ }
135
+ },
136
+ async ({ key, agent_uuaid }) => {
137
+ if (!API_KEY) return err("No UUAID_API_KEY configured.");
138
+ const agent = agentOr(agent_uuaid);
139
+ if (!agent) return err("No agent identity: pass agent_uuaid or set UUAID_AGENT.");
140
+ return text(await client.deleteVaultItem(agent, key));
141
+ }
142
+ );
143
+ server.registerTool(
144
+ "verify_agent",
145
+ {
146
+ description: "Publicly resolve any UUAID \u2014 profile, versions, credentials (no auth needed). Use to verify other agents.",
147
+ inputSchema: { uuaid: z.string().min(1).describe("uuaid:foundation:agent:\u2026") }
148
+ },
149
+ async ({ uuaid }) => text(await client.resolve(uuaid))
150
+ );
151
+ server.registerTool(
152
+ "get_badge_url",
153
+ {
154
+ description: "Live SVG trust-badge URLs for an agent \u2014 paste into a README to show verified identity/certification.",
155
+ inputSchema: { uuaid: z.string().min(1) }
156
+ },
157
+ async ({ uuaid }) => {
158
+ const enc = encodeURIComponent(uuaid);
159
+ return text({
160
+ agent_badge_svg: `${BASE_URL}/badge/agent/${enc}.svg`,
161
+ markdown: `[![UUAID verified](${BASE_URL}/badge/agent/${enc}.svg)](https://registry.uuaid.org/uuaid/${uuaid.split(":").slice(1).join("/")})`
162
+ });
163
+ }
164
+ );
165
+ var transport = new StdioServerTransport();
166
+ await server.connect(transport);
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@uuaid/mcp",
3
+ "version": "0.1.0",
4
+ "description": "UUAID MCP server — give any AI agent a permanent identity and encrypted, quantum-ready memory that outlives the session. Mint a UUAID, save/recall memories, embed live trust badges.",
5
+ "keywords": [
6
+ "uuaid",
7
+ "mcp",
8
+ "modelcontextprotocol",
9
+ "ai-agents",
10
+ "agent-identity",
11
+ "agent-memory",
12
+ "post-quantum"
13
+ ],
14
+ "homepage": "https://uuaid.org",
15
+ "license": "Apache-2.0",
16
+ "type": "module",
17
+ "bin": {
18
+ "uuaid-mcp": "./dist/server.js"
19
+ },
20
+ "main": "./dist/server.js",
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "dependencies": {
29
+ "@modelcontextprotocol/sdk": "^1.29.0",
30
+ "zod": "^3.25.0",
31
+ "@uuaid/sdk": "0.1.0",
32
+ "@uuaid/vault": "0.1.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^22.10.0",
36
+ "tsup": "^8.3.5",
37
+ "tsx": "^4.19.0",
38
+ "typescript": "^5.7.2"
39
+ },
40
+ "scripts": {
41
+ "build": "tsup",
42
+ "dev": "tsx src/server.ts",
43
+ "typecheck": "tsc --noEmit"
44
+ }
45
+ }