apex-psi-mcp 1.0.0 → 1.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.
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 APEX Intelligence Empire / ROCKYFILMS888 PTY LTD (ABN 71 672 237 795), Victoria, Australia.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ NOTE ON SCOPE: this MIT grant covers the VERIFICATION software in this
24
+ repository only. The PSI-SEAL/1 canonical seal schema is a separately
25
+ copyrighted technical specification, and the APEX PSI Sealing Engine
26
+ (generator) is licensed separately — see LICENSE-ENGINE.txt in the APEX-PSI
27
+ repository. "APEX PSI", "PSI-SEAL" and the seal device are trade marks of
28
+ Apex Intelligence Empire; no right in them is granted here. Verification is
29
+ free forever and requires no account, no fee and no relationship with us.
package/README.md CHANGED
@@ -1,65 +1,73 @@
1
- # APEX PSI MCP Server
2
-
3
- Cryptographic truth infrastructure for AI agents.
4
-
5
- One config line gives any MCP-capable AI agent (Claude, Cursor, Qoder, Cline, Windsurf, and more) five provenance tools: seal, verify, anchor, cite, audit.
6
-
7
- ## Tools
8
-
9
- | Tool | Description |
10
- |------|-------------|
11
- | **seal** | Stamp a cryptographic receipt on content (SHA-256 + Ed25519) |
12
- | **verify** | Verify a receipt is authentic |
13
- | **anchor** | Anchor a receipt to Bitcoin via OpenTimestamps |
14
- | **cite** | Generate a citation for a receipt (APA, BibTeX, MLA) |
15
- | **audit** | Audit a chain of receipts for integrity |
16
-
17
- ## Installation
18
-
19
- Add to your MCP client config:
20
-
21
- ```json
22
- {
23
- "mcpServers": {
24
- "apex-psi": {
25
- "command": "npx",
26
- "args": ["-y", "apex-psi-mcp"]
27
- }
28
- }
29
- }
30
- ```
31
-
32
- Or install locally:
33
-
34
- ```bash
35
- npm install apex-psi-mcp
36
- ```
37
-
38
- ## Configuration
39
-
40
- Environment variables (optional):
41
-
42
- - `APEX_API_BASE` — API endpoint (default: `https://apex-infrastructure.com/api`)
43
- - `APEX_API_KEY` — API key for authenticated access
44
-
45
- ## Usage
46
-
47
- Once installed, your AI agent can:
48
-
49
- 1. **Seal content** — "Seal this document with APEX PSI"
50
- 2. **Verify receipts** — "Verify this receipt is authentic"
51
- 3. **Anchor to Bitcoin** — "Anchor this receipt to the Bitcoin blockchain"
52
- 4. **Generate citations** — "Cite this receipt in APA format"
53
- 5. **Audit chains** — "Audit this chain of receipts"
54
-
55
- Every receipt carries a verify link to `https://apex-infrastructure.com/verify` — sealed arithmetic, public provenance.
56
-
57
- ## Links
58
-
59
- - **Website:** https://apex-infrastructure.com
60
- - **Public Verifier:** https://apex-infrastructure.com/verify
61
- - **npm:** https://www.npmjs.com/package/apex-psi-mcp
62
-
63
- ## License
64
-
65
- MIT
1
+ # APEX PSI MCP Server
2
+
3
+ > **Apex PSI is not a tool and not a product. It is the verification substrate — the layer beneath proof. It does not judge. It does not certify. It only remembers.** This server is an application built on that layer.
4
+
5
+ Cryptographic truth infrastructure for AI agents.
6
+
7
+ One config line gives any MCP-capable AI agent (Claude, Cursor, Qoder, Cline, Windsurf, and more) five provenance tools: seal, verify, anchor, cite, verify_chain.
8
+
9
+ This server proves the existence and integrity of a record at a point in time. It does not judge the truth of a record's contents. It is an independent verification service, not advice.
10
+
11
+ ## Tools
12
+
13
+ | Tool | Description |
14
+ |------|-------------|
15
+ | **seal** | Stamp a cryptographic receipt on content (SHA-256 + Ed25519 + post-quantum LMS-W4) |
16
+ | **verify** | Confirm a receipt's integrity (hash present in the append-only ledger) |
17
+ | **anchor** | Read Bitcoin anchoring status (default), or request anchoring of pending roots |
18
+ | **cite** | Generate a citation for a receipt (APA, BibTeX, MLA) |
19
+ | **verify_chain** | Independently verify a chain of receipts for integrity |
20
+
21
+ ## Installation
22
+
23
+ Add to your MCP client config:
24
+
25
+ ```json
26
+ {
27
+ "mcpServers": {
28
+ "apex-psi": {
29
+ "command": "npx",
30
+ "args": ["-y", "apex-psi-mcp"]
31
+ }
32
+ }
33
+ }
34
+ ```
35
+
36
+ Or install locally:
37
+
38
+ ```bash
39
+ npm install apex-psi-mcp
40
+ ```
41
+
42
+ ## Configuration
43
+
44
+ Environment variables (optional):
45
+
46
+ - `APEX_API_BASE` — API endpoint (default: `https://qhtntebpcribjiwrdtdd.supabase.co/functions/v1`)
47
+ - `APEX_API_KEY` — API key for authenticated access
48
+
49
+ ## Usage
50
+
51
+ Once installed, your AI agent can:
52
+
53
+ 1. **Seal content** — "Seal this document with APEX PSI"
54
+ 2. **Verify receipts** — "Verify this receipt against the ledger"
55
+ 3. **Check anchoring** — "What is the Bitcoin anchor status of this seal?"
56
+ 4. **Generate citations** — "Cite this receipt in APA format"
57
+ 5. **Verify a chain** — "Independently verify this chain of receipts"
58
+
59
+ Every receipt carries a verify link to `https://ai-governance-standard.com/verify` — sealed arithmetic, public provenance.
60
+
61
+ ## Links
62
+
63
+ - **Website:** https://ai-governance-standard.com
64
+ - **Public Verifier:** https://ai-governance-standard.com/verify
65
+ - **npm:** https://www.npmjs.com/package/apex-psi-mcp
66
+
67
+ ## License
68
+
69
+ MIT
70
+
71
+ ## Limits
72
+
73
+ Free hosted allowance: 20 receipts/minute, 100/day. Offline verification is always free (`npm i apex-psi-verifier`). Higher volume: https://ai-governance-standard.com/upgrade
package/dist/index.d.ts CHANGED
@@ -3,8 +3,12 @@
3
3
  * APEX PSI MCP Server
4
4
  * Cryptographic truth infrastructure for AI agents.
5
5
  *
6
- * 5 tools: seal, verify, anchor, cite, audit
6
+ * 5 tools: seal, verify, anchor, cite, verify_chain
7
7
  * Backend: APEX NOTARY v1.0 (Supabase Edge Functions) — SHA-256 + Ed25519 + LMS-W4-SHA256 (post-quantum)
8
8
  * Override base URL with APEX_API_BASE if self-hosting.
9
+ *
10
+ * Scope: this server anchors the existence and integrity of a record at a point
11
+ * in time. It does not judge the truth of a record's contents. It is an
12
+ * independent verification service, not advice or an attestable opinion.
9
13
  */
10
14
  export {};
package/dist/index.js CHANGED
@@ -3,9 +3,13 @@
3
3
  * APEX PSI MCP Server
4
4
  * Cryptographic truth infrastructure for AI agents.
5
5
  *
6
- * 5 tools: seal, verify, anchor, cite, audit
6
+ * 5 tools: seal, verify, anchor, cite, verify_chain
7
7
  * Backend: APEX NOTARY v1.0 (Supabase Edge Functions) — SHA-256 + Ed25519 + LMS-W4-SHA256 (post-quantum)
8
8
  * Override base URL with APEX_API_BASE if self-hosting.
9
+ *
10
+ * Scope: this server anchors the existence and integrity of a record at a point
11
+ * in time. It does not judge the truth of a record's contents. It is an
12
+ * independent verification service, not advice or an attestable opinion.
9
13
  */
10
14
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
15
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -13,6 +17,7 @@ import { z } from "zod";
13
17
  // Configuration
14
18
  const APEX_API_BASE = (process.env.APEX_API_BASE || "https://qhtntebpcribjiwrdtdd.supabase.co/functions/v1").replace(/\/$/, "");
15
19
  const APEX_API_KEY = process.env.APEX_API_KEY || "";
20
+ const VERSION = "1.1.0";
16
21
  // Helper: make an API call to the Apex PSI backend
17
22
  async function apexApiCall(endpoint, method = "GET", body) {
18
23
  const url = `${APEX_API_BASE}${endpoint}`;
@@ -25,6 +30,9 @@ async function apexApiCall(endpoint, method = "GET", body) {
25
30
  body: body !== undefined ? JSON.stringify(body) : undefined,
26
31
  });
27
32
  if (!response.ok) {
33
+ if (response.status === 429) {
34
+ throw new Error("APEX PSI free allowance reached (20/min, 100/day). For higher volume: https://ai-governance-standard.com/upgrade");
35
+ }
28
36
  let detail = "";
29
37
  try {
30
38
  detail = (await response.text()).slice(0, 300);
@@ -60,12 +68,12 @@ const receiptSchema = z
60
68
  .describe("An APEX PSI receipt object (as returned by the seal tool)");
61
69
  const server = new McpServer({
62
70
  name: "apex-psi-mcp",
63
- version: "1.0.0",
71
+ version: VERSION,
64
72
  });
65
73
  // Tool: seal
66
74
  server.registerTool("seal", {
67
75
  title: "Seal content",
68
- description: "Stamp a cryptographic receipt on content. Writes to the APEX PSI immutable ledger with SHA-256 hash, Ed25519 signature, and post-quantum LMS-W4-SHA256 signature.",
76
+ description: "Stamp a cryptographic receipt on content. Writes to the APEX PSI append-only ledger with SHA-256 hash, Ed25519 signature, and post-quantum LMS-W4-SHA256 signature. Proves existence and integrity at a point in time — not the truth of the contents.",
69
77
  inputSchema: {
70
78
  content: z.string().max(10000).describe("The content to seal (text, up to 10000 characters)"),
71
79
  context: z.string().optional().describe("Optional context label (e.g. document name, case ID)"),
@@ -76,7 +84,7 @@ server.registerTool("seal", {
76
84
  try {
77
85
  const receipt = await apexApiCall("/notarize", "POST", {
78
86
  decision: content,
79
- model_id: model_id || "apex-psi-mcp/1.0.0",
87
+ model_id: model_id || `apex-psi-mcp/${VERSION}`,
80
88
  context: context || "mcp-seal",
81
89
  predicate: predicate || "sealed-via-mcp",
82
90
  });
@@ -87,7 +95,7 @@ server.registerTool("seal", {
87
95
  receipt_id: receipt.receipt_id,
88
96
  verify_hash: decisionHash,
89
97
  verify_url: `${APEX_API_BASE}/verify-hash?hash=${decisionHash}`,
90
- message: "Content sealed in the APEX PSI immutable ledger",
98
+ message: "Content sealed in the APEX PSI append-only ledger",
91
99
  });
92
100
  }
93
101
  catch (error) {
@@ -96,8 +104,8 @@ server.registerTool("seal", {
96
104
  });
97
105
  // Tool: verify
98
106
  server.registerTool("verify", {
99
- title: "Verify receipt",
100
- description: "Verify a seal against the APEX PSI immutable ledger. Accepts a receipt object (from the seal tool) or a raw SHA-256 hash.",
107
+ title: "Verify a receipt",
108
+ description: "Confirm a seal's integrity against the APEX PSI append-only ledger. Accepts a receipt object (from the seal tool) or a raw SHA-256 hash. Reports whether the hash is present and anchored — integrity, not the truth of the original content.",
101
109
  inputSchema: {
102
110
  hash: z
103
111
  .string()
@@ -119,7 +127,7 @@ server.registerTool("verify", {
119
127
  success: true,
120
128
  verification: result,
121
129
  message: result.verified
122
- ? "Seal verified — hash exists in the APEX PSI immutable ledger"
130
+ ? "Seal verified — hash is present in the APEX PSI append-only ledger"
123
131
  : "Hash not found in the ledger",
124
132
  });
125
133
  }
@@ -127,25 +135,29 @@ server.registerTool("verify", {
127
135
  return mcpError(error);
128
136
  }
129
137
  });
130
- // Tool: anchor
138
+ // Tool: anchor (status by default; explicit request to anchor pending roots)
131
139
  server.registerTool("anchor", {
132
- title: "Anchor to Bitcoin",
133
- description: "Request a Bitcoin anchor of pending ledger Merkle roots via OpenTimestamps. Aggregates unanchored roots and submits them to OTS calendars.",
140
+ title: "Bitcoin anchoring status / request",
141
+ description: "Read the Bitcoin (OpenTimestamps) anchoring state of the ledger's pending Merkle roots, or — only when action:'anchor' is passed explicitly — request that pending roots be aggregated and submitted to the OTS calendars. Defaults to 'status' (read-only) so a routine call never triggers a batch write. An anchor becomes confirmed only when a real Bitcoin block is found.",
134
142
  inputSchema: {
135
143
  action: z
136
144
  .enum(["anchor", "status"])
137
145
  .optional()
138
- .describe("'anchor' submits pending roots; 'status' checks anchor state (default: anchor)"),
146
+ .describe("'status' reads the anchor state (default); 'anchor' explicitly requests anchoring of pending roots"),
139
147
  },
140
148
  }, async ({ action }) => {
141
149
  try {
150
+ const resolved = action || "status";
142
151
  const result = await apexApiCall("/blockchain-anchor", "POST", {
143
- action: action || "anchor",
152
+ action: resolved,
144
153
  });
145
154
  return mcpResult({
146
155
  success: true,
147
156
  anchorResult: result,
148
- message: "Bitcoin anchoring request processed (OpenTimestamps)",
157
+ action: resolved,
158
+ message: resolved === "anchor"
159
+ ? "Bitcoin anchoring requested for pending roots (OpenTimestamps); confirmation follows only on a real block"
160
+ : "Bitcoin anchoring status read (OpenTimestamps)",
149
161
  });
150
162
  }
151
163
  catch (error) {
@@ -177,17 +189,17 @@ server.registerTool("cite", {
177
189
  ` author = {APEX PSI Notary},`,
178
190
  ` title = {Cryptographic Seal ${receiptId}},`,
179
191
  ` year = {${year}},`,
180
- ` howpublished = {APEX PSI Immutable Ledger (${algorithm})},`,
192
+ ` howpublished = {APEX PSI Append-Only Ledger (${algorithm})},`,
181
193
  ` note = {Receipt ${receiptId}, sealed ${date}},`,
182
194
  ` url = {${verifyUrl}}`,
183
195
  `}`,
184
196
  ].join("\n");
185
197
  }
186
198
  else if (fmt === "mla") {
187
- citation = `"Cryptographic Seal ${receiptId}." APEX PSI Immutable Ledger, ${date}, ${verifyUrl}. ${algorithm}.`;
199
+ citation = `"Cryptographic Seal ${receiptId}." APEX PSI Append-Only Ledger, ${date}, ${verifyUrl}. ${algorithm}.`;
188
200
  }
189
201
  else {
190
- citation = `APEX PSI Notary. (${year}). Cryptographic seal ${receiptId} [APEX PSI immutable ledger entry; ${algorithm}]. Retrieved from ${verifyUrl}`;
202
+ citation = `APEX PSI Notary. (${year}). Cryptographic seal ${receiptId} [APEX PSI append-only ledger entry; ${algorithm}]. Retrieved from ${verifyUrl}`;
191
203
  }
192
204
  return mcpResult({
193
205
  success: true,
@@ -201,28 +213,28 @@ server.registerTool("cite", {
201
213
  return mcpError(error);
202
214
  }
203
215
  });
204
- // Tool: audit
205
- server.registerTool("audit", {
206
- title: "Audit receipt chain",
207
- description: "Audit a chain of receipts against the APEX PSI ledger. Checks each hash's presence and integrity, and reports Merkle chain continuity.",
216
+ // Tool: verify_chain (independent verification of a receipt chain)
217
+ server.registerTool("verify_chain", {
218
+ title: "Verify a receipt chain",
219
+ description: "Independently verify a chain of receipts against the APEX PSI ledger. Recomputes each hash's presence and integrity and reports Merkle chain continuity. Returns a verification report — a recomputation result, not an opinion or a certification.",
208
220
  inputSchema: {
209
- receipts: z.array(receiptSchema).min(1).describe("Array of receipt objects to audit (in order)"),
221
+ receipts: z.array(receiptSchema).min(1).describe("Array of receipt objects to verify (in order)"),
210
222
  },
211
223
  }, async ({ receipts }) => {
212
224
  try {
213
- const findings = [];
225
+ const results = [];
214
226
  let previousRoot = "";
215
227
  let chainIntact = true;
216
228
  for (let i = 0; i < receipts.length; i++) {
217
229
  const r = receipts[i];
218
230
  const hash = stripHashPrefix(r.decision_hash ?? r.merkle_leaf ?? r.merkle_root);
219
231
  if (!hash) {
220
- findings.push({ index: i, receipt_id: String(r.receipt_id || "?"), verified: false, found: false, hash: "" });
232
+ results.push({ index: i, receipt_id: String(r.receipt_id || "?"), verified: false, found: false, hash: "" });
221
233
  chainIntact = false;
222
234
  continue;
223
235
  }
224
236
  const result = (await apexApiCall(`/verify-hash?hash=${encodeURIComponent(hash)}`));
225
- findings.push({
237
+ results.push({
226
238
  index: i,
227
239
  receipt_id: String(r.receipt_id || "?"),
228
240
  verified: !!result.verified,
@@ -231,24 +243,24 @@ server.registerTool("audit", {
231
243
  });
232
244
  const root = stripHashPrefix(r.merkle_root);
233
245
  if (previousRoot && root && previousRoot === root && i > 0) {
234
- // Identical consecutive roots are suspicious only if receipts differ; flag for review
246
+ // Identical consecutive roots are noted only; the ledger decides continuity.
235
247
  }
236
248
  previousRoot = root;
237
249
  if (!result.verified)
238
250
  chainIntact = false;
239
251
  }
240
- const verifiedCount = findings.filter((f) => f.verified).length;
252
+ const verifiedCount = results.filter((f) => f.verified).length;
241
253
  return mcpResult({
242
254
  success: true,
243
- auditReport: {
255
+ verification_report: {
244
256
  total: receipts.length,
245
257
  verified: verifiedCount,
246
258
  failed: receipts.length - verifiedCount,
247
259
  chainIntact,
248
- findings,
249
- audited_at: new Date().toISOString(),
260
+ results,
261
+ verified_at: new Date().toISOString(),
250
262
  },
251
- message: `Audit complete: ${verifiedCount}/${receipts.length} receipts verified${chainIntact ? ", chain intact" : ", chain broken"}`,
263
+ message: `Chain verification complete: ${verifiedCount}/${receipts.length} receipts verified${chainIntact ? ", chain intact" : ", chain broken"}`,
252
264
  });
253
265
  }
254
266
  catch (error) {
package/package.json CHANGED
@@ -1,46 +1,47 @@
1
- {
2
- "name": "apex-psi-mcp",
3
- "version": "1.0.0",
4
- "description": "APEX PSI MCP Server - Cryptographic truth infrastructure for AI agents: seal, verify, anchor, cite, audit",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "files": [
8
- "dist",
9
- "README.md"
10
- ],
11
- "bin": {
12
- "apex-psi-mcp": "dist/index.js"
13
- },
14
- "scripts": {
15
- "build": "tsc",
16
- "start": "node dist/index.js",
17
- "dev": "tsx src/index.ts"
18
- },
19
- "keywords": [
20
- "mcp",
21
- "model-context-protocol",
22
- "mcp-server",
23
- "apex-psi",
24
- "cryptographic-verification",
25
- "provenance",
26
- "truth-infrastructure",
27
- "ai-agents"
28
- ],
29
- "author": "APEX PSI",
30
- "license": "MIT",
31
- "homepage": "https://apex-infrastructure.com",
32
- "dependencies": {
33
- "@modelcontextprotocol/sdk": "^1.12.0",
34
- "zod": "^3.23.8"
35
- },
36
- "devDependencies": {
37
- "@types/node": "^20.11.0",
38
- "typescript": "^5.3.3"
39
- },
40
- "engines": {
41
- "node": ">=18.0.0"
42
- },
43
- "publishConfig": {
44
- "access": "public"
45
- }
46
- }
1
+ {
2
+ "name": "apex-psi-mcp",
3
+ "version": "1.1.0",
4
+ "mcpName": "io.github.kawal393/apex-psi-mcp",
5
+ "description": "APEX PSI MCP Server - Cryptographic truth infrastructure for AI agents: seal, verify, anchor, cite, verify_chain",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "bin": {
13
+ "apex-psi-mcp": "dist/index.js"
14
+ },
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "start": "node dist/index.js",
18
+ "dev": "tsx src/index.ts"
19
+ },
20
+ "keywords": [
21
+ "mcp",
22
+ "model-context-protocol",
23
+ "mcp-server",
24
+ "apex-psi",
25
+ "cryptographic-verification",
26
+ "provenance",
27
+ "truth-infrastructure",
28
+ "ai-agents"
29
+ ],
30
+ "author": "APEX PSI",
31
+ "license": "MIT",
32
+ "homepage": "https://ai-governance-standard.com/mcp",
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "^1.12.0",
35
+ "zod": "^3.23.8"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^20.11.0",
39
+ "typescript": "^5.3.3"
40
+ },
41
+ "engines": {
42
+ "node": ">=18.0.0"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ }
47
+ }