0nmcp 2.0.0 → 2.2.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 +162 -60
- package/catalog.js +756 -0
- package/cli.js +274 -0
- package/index.js +8 -1
- package/lib/stats.json +1 -1
- package/package.json +44 -2
- package/vault/deed-collector.js +286 -0
- package/vault/deed-importer.js +277 -0
- package/vault/deed.js +319 -0
- package/vault/tools-deed.js +257 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// 0nMCP — Vault: Business Deed MCP Tools
|
|
3
|
+
// ============================================================
|
|
4
|
+
// 6 MCP tools for the Business Deed digital asset transfer system.
|
|
5
|
+
//
|
|
6
|
+
// Patent Pending: US Provisional Patent Application #63/990,046
|
|
7
|
+
// ============================================================
|
|
8
|
+
|
|
9
|
+
import { BusinessDeed } from "./deed.js";
|
|
10
|
+
import { collectCredentials, validateCollected } from "./deed-collector.js";
|
|
11
|
+
import { LAYER_NAMES } from "./layers.js";
|
|
12
|
+
|
|
13
|
+
const deed = new BusinessDeed();
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Register Business Deed tools on an MCP server.
|
|
17
|
+
*
|
|
18
|
+
* @param {import("@modelcontextprotocol/sdk/server/mcp.js").McpServer} server
|
|
19
|
+
* @param {import("zod").ZodType} z
|
|
20
|
+
*/
|
|
21
|
+
export function registerDeedTools(server, z) {
|
|
22
|
+
|
|
23
|
+
// ─── deed_create ────────────────────────────────────────────
|
|
24
|
+
server.tool(
|
|
25
|
+
"deed_create",
|
|
26
|
+
`Create a Business Deed — package an entire business's digital assets into a single
|
|
27
|
+
encrypted, verifiable .0nv container file. Includes API keys, credentials, workflows,
|
|
28
|
+
configs, and AI data across 7 semantic layers with Argon2id double-encryption for secrets.
|
|
29
|
+
|
|
30
|
+
This is the digital equivalent of signing over a business deed — one file that proves
|
|
31
|
+
ownership, packages all operational credentials, and enables instant activation.
|
|
32
|
+
|
|
33
|
+
Lifecycle: CREATE > PACKAGE > ESCROW > ACCEPT > IMPORT
|
|
34
|
+
|
|
35
|
+
Patent Pending: US Provisional Patent Application #63/990,046
|
|
36
|
+
|
|
37
|
+
Example: deed_create({
|
|
38
|
+
name: "My SaaS Business",
|
|
39
|
+
passphrase: "secure-pass",
|
|
40
|
+
credentials: { stripe: { apiKey: "sk_..." }, github: { token: "ghp_..." } },
|
|
41
|
+
envVars: { DATABASE_URL: "postgres://..." }
|
|
42
|
+
})`,
|
|
43
|
+
{
|
|
44
|
+
name: z.string().describe("Business name"),
|
|
45
|
+
passphrase: z.string().describe("Encryption passphrase for the deed"),
|
|
46
|
+
domain: z.string().optional().describe("Business domain (e.g., example.com)"),
|
|
47
|
+
description: z.string().optional().describe("Business description"),
|
|
48
|
+
valuation: z.number().optional().describe("Business valuation amount"),
|
|
49
|
+
currency: z.string().optional().describe("Currency code (default: USD)"),
|
|
50
|
+
creatorName: z.string().optional().describe("Creator's name"),
|
|
51
|
+
creatorEmail: z.string().optional().describe("Creator's email"),
|
|
52
|
+
credentials: z.record(z.record(z.string())).optional().describe("Service credentials: { service: { field: value } }"),
|
|
53
|
+
workflows: z.array(z.any()).optional().describe("Workflow definitions to include"),
|
|
54
|
+
envVars: z.record(z.string()).optional().describe("Environment variables to include"),
|
|
55
|
+
mcpConfigs: z.record(z.any()).optional().describe("MCP server configurations"),
|
|
56
|
+
siteProfiles: z.record(z.any()).optional().describe("Site/CRO profiles"),
|
|
57
|
+
aiBrain: z.record(z.any()).optional().describe("AI agent data, prompts, memory"),
|
|
58
|
+
output: z.string().optional().describe("Output .0nv file path"),
|
|
59
|
+
},
|
|
60
|
+
async (params) => {
|
|
61
|
+
try {
|
|
62
|
+
const result = await deed.create(params);
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
66
|
+
success: true,
|
|
67
|
+
...result,
|
|
68
|
+
patent: "US Provisional #63/990,046",
|
|
69
|
+
}, null, 2) }],
|
|
70
|
+
};
|
|
71
|
+
} catch (err) {
|
|
72
|
+
return {
|
|
73
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
74
|
+
success: false, error: err.message,
|
|
75
|
+
}, null, 2) }],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// ─── deed_open ──────────────────────────────────────────────
|
|
82
|
+
server.tool(
|
|
83
|
+
"deed_open",
|
|
84
|
+
`Open and decrypt a Business Deed (.0nv file).
|
|
85
|
+
Verifies Ed25519 signature and Seal of Truth, then decrypts all layers.
|
|
86
|
+
Returns credentials, workflows, configs, and deed metadata.
|
|
87
|
+
|
|
88
|
+
Example: deed_open({ file: "deed-abc123.0nv", passphrase: "secure-pass" })`,
|
|
89
|
+
{
|
|
90
|
+
file: z.string().describe("Path to .0nv deed file"),
|
|
91
|
+
passphrase: z.string().describe("Decryption passphrase"),
|
|
92
|
+
layers: z.array(z.string()).optional().describe("Only decrypt these layers (default: all)"),
|
|
93
|
+
},
|
|
94
|
+
async ({ file, passphrase, layers: onlyLayers }) => {
|
|
95
|
+
try {
|
|
96
|
+
const result = await deed.open(file, passphrase, onlyLayers || null);
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
100
|
+
success: true,
|
|
101
|
+
...result,
|
|
102
|
+
}, null, 2) }],
|
|
103
|
+
};
|
|
104
|
+
} catch (err) {
|
|
105
|
+
return {
|
|
106
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
107
|
+
success: false, error: err.message,
|
|
108
|
+
}, null, 2) }],
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
// ─── deed_inspect ───────────────────────────────────────────
|
|
115
|
+
server.tool(
|
|
116
|
+
"deed_inspect",
|
|
117
|
+
`Inspect a Business Deed without decrypting.
|
|
118
|
+
Shows business name, services, layer info, seal verification, and transfer history.
|
|
119
|
+
No passphrase required — all metadata is public.
|
|
120
|
+
|
|
121
|
+
Example: deed_inspect({ file: "deed-abc123.0nv" })`,
|
|
122
|
+
{
|
|
123
|
+
file: z.string().describe("Path to .0nv deed file"),
|
|
124
|
+
},
|
|
125
|
+
async ({ file }) => {
|
|
126
|
+
try {
|
|
127
|
+
const result = deed.inspect(file);
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
131
|
+
success: true,
|
|
132
|
+
...result,
|
|
133
|
+
}, null, 2) }],
|
|
134
|
+
};
|
|
135
|
+
} catch (err) {
|
|
136
|
+
return {
|
|
137
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
138
|
+
success: false, error: err.message,
|
|
139
|
+
}, null, 2) }],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
// ─── deed_verify ────────────────────────────────────────────
|
|
146
|
+
server.tool(
|
|
147
|
+
"deed_verify",
|
|
148
|
+
`Verify a Business Deed's Seal of Truth and Ed25519 signature.
|
|
149
|
+
Confirms the deed is authentic, unmodified, and from the original creator.
|
|
150
|
+
Also checks the transfer registry for chain of custody.
|
|
151
|
+
|
|
152
|
+
Example: deed_verify({ file: "deed-abc123.0nv" })`,
|
|
153
|
+
{
|
|
154
|
+
file: z.string().describe("Path to .0nv deed file"),
|
|
155
|
+
},
|
|
156
|
+
async ({ file }) => {
|
|
157
|
+
try {
|
|
158
|
+
const result = deed.verify(file);
|
|
159
|
+
|
|
160
|
+
return {
|
|
161
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
162
|
+
success: true,
|
|
163
|
+
...result,
|
|
164
|
+
}, null, 2) }],
|
|
165
|
+
};
|
|
166
|
+
} catch (err) {
|
|
167
|
+
return {
|
|
168
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
169
|
+
success: false, error: err.message,
|
|
170
|
+
}, null, 2) }],
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// ─── deed_accept ────────────────────────────────────────────
|
|
177
|
+
server.tool(
|
|
178
|
+
"deed_accept",
|
|
179
|
+
`Accept a Business Deed transfer — buyer signs acceptance with chain of custody.
|
|
180
|
+
Creates a new deed container with updated transfer history and optionally re-encrypts
|
|
181
|
+
with a new passphrase for the buyer.
|
|
182
|
+
|
|
183
|
+
Example: deed_accept({
|
|
184
|
+
file: "deed-abc123.0nv",
|
|
185
|
+
passphrase: "seller-pass",
|
|
186
|
+
buyerName: "New Owner",
|
|
187
|
+
buyerEmail: "buyer@example.com"
|
|
188
|
+
})`,
|
|
189
|
+
{
|
|
190
|
+
file: z.string().describe("Path to .0nv deed file"),
|
|
191
|
+
passphrase: z.string().describe("Current deed passphrase"),
|
|
192
|
+
buyerName: z.string().describe("Buyer's name"),
|
|
193
|
+
buyerEmail: z.string().describe("Buyer's email"),
|
|
194
|
+
newPassphrase: z.string().optional().describe("New passphrase for re-encrypted deed"),
|
|
195
|
+
output: z.string().optional().describe("Output path for accepted deed"),
|
|
196
|
+
},
|
|
197
|
+
async ({ file, passphrase, buyerName, buyerEmail, newPassphrase, output }) => {
|
|
198
|
+
try {
|
|
199
|
+
const result = await deed.accept(
|
|
200
|
+
file,
|
|
201
|
+
passphrase,
|
|
202
|
+
{ name: buyerName, email: buyerEmail },
|
|
203
|
+
newPassphrase || null,
|
|
204
|
+
output || null
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
209
|
+
success: true,
|
|
210
|
+
...result,
|
|
211
|
+
}, null, 2) }],
|
|
212
|
+
};
|
|
213
|
+
} catch (err) {
|
|
214
|
+
return {
|
|
215
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
216
|
+
success: false, error: err.message,
|
|
217
|
+
}, null, 2) }],
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
// ─── deed_import ────────────────────────────────────────────
|
|
224
|
+
server.tool(
|
|
225
|
+
"deed_import",
|
|
226
|
+
`Import a Business Deed — decrypt and write credentials to live system config.
|
|
227
|
+
Writes .0n connection files, .env file, MCP configs, workflows, and AI brain data.
|
|
228
|
+
The deed's Seal of Truth and signature are verified before import.
|
|
229
|
+
|
|
230
|
+
Example: deed_import({ file: "deed-abc123.0nv", passphrase: "secure-pass" })`,
|
|
231
|
+
{
|
|
232
|
+
file: z.string().describe("Path to .0nv deed file"),
|
|
233
|
+
passphrase: z.string().describe("Decryption passphrase"),
|
|
234
|
+
targetDir: z.string().optional().describe("Target directory (default: ~/.0n/)"),
|
|
235
|
+
},
|
|
236
|
+
async ({ file, passphrase, targetDir }) => {
|
|
237
|
+
try {
|
|
238
|
+
const result = await deed.importDeed(file, passphrase, targetDir || null);
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
242
|
+
success: true,
|
|
243
|
+
...result,
|
|
244
|
+
}, null, 2) }],
|
|
245
|
+
};
|
|
246
|
+
} catch (err) {
|
|
247
|
+
return {
|
|
248
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
249
|
+
success: false, error: err.message,
|
|
250
|
+
}, null, 2) }],
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export const DEED_TOOL_COUNT = 6;
|