apex-psi-mcp 1.2.0 → 1.2.2

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 (2) hide show
  1. package/dist/index.js +56 -6
  2. package/package.json +6 -2
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
17
17
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
18
+ import { readFileSync } from "node:fs";
18
19
  import { z } from "zod";
19
20
  // Configuration
20
21
  const APEX_API_BASE = (process.env.APEX_API_BASE || "https://qhtntebpcribjiwrdtdd.supabase.co/functions/v1").replace(/\/$/, "");
@@ -22,7 +23,26 @@ const APEX_API_KEY = process.env.APEX_API_KEY || "";
22
23
  // Human-facing site. The API host is a Supabase function and is not a page a
23
24
  // person can open, so every link handed back to a user points here instead.
24
25
  const APEX_SITE_BASE = (process.env.APEX_SITE_BASE || "https://www.ai-governance-standard.com").replace(/\/$/, "");
25
- const VERSION = "1.1.2";
26
+ // The version this server announces is the version it ships, read from the same
27
+ // package.json npm published. It was a literal here until 16 Nov, and the literal was
28
+ // still "1.1.2" when 1.2.0 went out — so every MCP client was told the server was
29
+ // 1.1.2 while the registry said 1.2.0. scripts/server-version-check.mjs now fails the
30
+ // build if these two ever disagree again.
31
+ const VERSION = readPackageVersion();
32
+ function readPackageVersion() {
33
+ try {
34
+ const pkgUrl = new URL("../package.json", import.meta.url);
35
+ const pkg = JSON.parse(readFileSync(pkgUrl, "utf8"));
36
+ if (typeof pkg.version === "string" && pkg.version.length > 0)
37
+ return pkg.version;
38
+ console.error("apex-psi-mcp: package.json carries no version; announcing 0.0.0-unknown");
39
+ return "0.0.0-unknown";
40
+ }
41
+ catch {
42
+ console.error("apex-psi-mcp: package.json could not be read; announcing 0.0.0-unknown");
43
+ return "0.0.0-unknown";
44
+ }
45
+ }
26
46
  // Helper: make an API call to the Apex PSI backend
27
47
  async function apexApiCall(endpoint, method = "GET", body) {
28
48
  const url = `${APEX_API_BASE}${endpoint}`;
@@ -105,7 +125,13 @@ const server = new McpServer({
105
125
  // Tool: seal
106
126
  server.registerTool("seal", {
107
127
  title: "Seal content",
108
- description: "Record content in the APEX PSI append-only ledger and return a receipt: SHA-256 hash, an Ed25519 signature over the Merkle leaf, and post-quantum ML-DSA-65 (plus LMS-W4-SHA256 when a slot is available — the receipt's own algorithm field states which). Proves that this content existed and has not changed since the timestamp. It never proves the contents are true. Free tier: 20 operations/minute, 100/day, no account needed.",
128
+ description: "Record content in the APEX PSI append-only ledger and return a receipt: SHA-256 hash, an Ed25519 signature over the Merkle leaf, and post-quantum ML-DSA-65 (plus LMS-W4-SHA256 when a slot is available — the receipt's own algorithm field states which). Proves that this content existed and has not changed since the timestamp. It never proves the contents are true. Free tier: 20 operations/minute, 100/day, no account needed. Side effect: it appends one record to the public ledger; nothing is edited or deleted. Output: a receipt in JSON, with the hash, the signature algorithms that receipt carries, and a URL anyone can check. A failure returns a tool error whose text is JSON: { success: false, error }.",
129
+ annotations: {
130
+ readOnlyHint: false,
131
+ destructiveHint: false,
132
+ idempotentHint: false,
133
+ openWorldHint: true,
134
+ },
109
135
  inputSchema: {
110
136
  content: z.string().max(10000).describe("The content to seal (text, up to 10000 characters)"),
111
137
  context: z.string().optional().describe("Optional context label (e.g. document name, case ID)"),
@@ -138,7 +164,13 @@ server.registerTool("seal", {
138
164
  // Tool: verify
139
165
  server.registerTool("verify", {
140
166
  title: "Verify a receipt",
141
- 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.",
167
+ 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. Read-only: nothing is written and no record changes. Output: a JSON report stating whether the hash was found and whether it is anchored. A failure returns a tool error whose text is JSON: { success: false, error }.",
168
+ annotations: {
169
+ readOnlyHint: true,
170
+ destructiveHint: false,
171
+ idempotentHint: true,
172
+ openWorldHint: true,
173
+ },
142
174
  inputSchema: {
143
175
  hash: z
144
176
  .string()
@@ -173,7 +205,13 @@ server.registerTool("verify", {
173
205
  // Tool: anchor (status by default; explicit request to anchor pending roots)
174
206
  server.registerTool("anchor", {
175
207
  title: "Bitcoin anchoring history",
176
- description: "Read the Bitcoin (OpenTimestamps) anchoring record for the ledger's Merkle roots. Defaults to action:'history', which is read-only and returns each anchor transaction with its txid, block height, confirmation state and how many ledger entries it covers. Pass action:'verify' with a txid to check one transaction, or action:'anchor' to explicitly request that pending roots be aggregated and submitted to the OTS calendars. Defaults to 'history' so a routine call never triggers a batch write. An anchor counts as confirmed only when a real Bitcoin block contains it.",
208
+ description: "Read the Bitcoin (OpenTimestamps) anchoring record for the ledger's Merkle roots. Defaults to action:'history', which is read-only and returns each anchor transaction with its txid, block height, confirmation state and how many ledger entries it covers. Pass action:'verify' with a txid to check one transaction, or action:'anchor' to explicitly request that pending roots be aggregated and submitted to the OTS calendars. Defaults to 'history' so a routine call never triggers a batch write. An anchor counts as confirmed only when a real Bitcoin block contains it. Read-only for action 'history' and 'verify'; only action 'anchor' writes, by submitting pending roots to the OTS calendars. Output: a JSON list of anchor transactions with txid, block height and confirmation state. A failure returns a tool error whose text is JSON: { success: false, error }.",
209
+ annotations: {
210
+ readOnlyHint: false,
211
+ destructiveHint: false,
212
+ idempotentHint: false,
213
+ openWorldHint: true,
214
+ },
177
215
  inputSchema: {
178
216
  action: z
179
217
  .enum(["history", "verify", "anchor"])
@@ -212,7 +250,13 @@ server.registerTool("anchor", {
212
250
  // Tool: cite
213
251
  server.registerTool("cite", {
214
252
  title: "Generate citation",
215
- description: "Generate a citation for a sealed receipt in APA, BibTeX, or MLA format, citing the APEX PSI ledger entry.",
253
+ description: "Generate a citation for a sealed receipt in APA, BibTeX, or MLA format, citing the APEX PSI ledger entry. Read-only and entirely local: it formats a citation from the receipt you pass in and makes no network call. Output: the citation string in the format you asked for.",
254
+ annotations: {
255
+ readOnlyHint: true,
256
+ destructiveHint: false,
257
+ idempotentHint: true,
258
+ openWorldHint: false,
259
+ },
216
260
  inputSchema: {
217
261
  receipt: receiptSchema.describe("A receipt object as returned by the seal tool"),
218
262
  format: z.enum(["apa", "bibtex", "mla"]).optional().describe("Citation format (default: apa)"),
@@ -266,7 +310,13 @@ server.registerTool("cite", {
266
310
  // Tool: verify_chain (independent verification of a receipt chain)
267
311
  server.registerTool("verify_chain", {
268
312
  title: "Verify a receipt chain",
269
- 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.",
313
+ 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. Read-only: it only looks receipts up and recomputes the chain; nothing is written. Output: a JSON report per receipt (found, verified) and an overall chain-intact verdict. A failure returns a tool error whose text is JSON: { success: false, error }.",
314
+ annotations: {
315
+ readOnlyHint: true,
316
+ destructiveHint: false,
317
+ idempotentHint: true,
318
+ openWorldHint: true,
319
+ },
270
320
  inputSchema: {
271
321
  receipts: z.array(receiptSchema).min(1).describe("Array of receipt objects to verify (in order)"),
272
322
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apex-psi-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "mcpName": "io.github.kawal393/apex-psi-mcp",
5
5
  "description": "APEX PSI MCP server - append-only evidence receipts for AI decisions and documents: seal a record, verify a hash against the public ledger, check a chain, cite a receipt, read Bitcoin anchoring status. Verification is free and needs no account.",
6
6
  "type": "module",
@@ -21,8 +21,12 @@
21
21
  "start": "node dist/index.js",
22
22
  "dev": "tsx src/index.ts",
23
23
  "check:roundtrip": "node scripts/roundtrip-check.mjs",
24
- "check:all": "npm run build && node scripts/roundtrip-check.mjs && node scripts/anchor-tool-check.mjs && node scripts/card-copy-check.mjs && node scripts/registry-card-check.mjs && node scripts/gate-check.mjs",
24
+ "check:all": "npm run build && node scripts/roundtrip-check.mjs && node scripts/anchor-tool-check.mjs && node scripts/card-copy-check.mjs && node scripts/registry-card-check.mjs && node scripts/gate-check.mjs && node scripts/server-version-check.mjs",
25
25
  "check:registry-card": "node scripts/registry-card-check.mjs",
26
+ "check:card-copy": "node scripts/card-copy-check.mjs",
27
+ "check:version": "node scripts/server-version-check.mjs",
28
+ "check:version:selftest": "node scripts/server-version-check.mjs --self-test",
29
+ "check:card-copy:selftest": "node scripts/card-copy-check.mjs --self-test",
26
30
  "check:gate": "node scripts/gate-check.mjs"
27
31
  },
28
32
  "keywords": [