@otskit/mcp 0.1.1 → 0.1.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.
@@ -235,13 +235,14 @@ async function createTimestamp(input, db, config) {
235
235
  // src/tools/upgrade-timestamp.ts
236
236
  import { readFileSync as readFileSync2 } from "fs";
237
237
  import { OpenTimestampsClient as OpenTimestampsClient2, UpgradeError } from "@otskit/client";
238
- import { deserializeOTS, hasConfirmedAttestation, getEarliestBitcoinBlock } from "@otskit/core";
238
+ import { DetachedTimestampFile } from "@otskit/core";
239
239
  function checkBitcoinConfirmation(bytes) {
240
240
  try {
241
- const proof = deserializeOTS(new Uint8Array(bytes));
242
- const confirmed = hasConfirmedAttestation(proof.attestations);
243
- if (confirmed) {
244
- const block = getEarliestBitcoinBlock(proof.attestations);
241
+ const proof = DetachedTimestampFile.deserialize(new Uint8Array(bytes));
242
+ const attestations = proof.timestamp.getAttestations();
243
+ const bitcoin = attestations.filter((a) => a.kind === "bitcoin");
244
+ if (bitcoin.length > 0) {
245
+ const block = Math.min(...bitcoin.map((a) => a.height));
245
246
  return { confirmed: true, block };
246
247
  }
247
248
  return { confirmed: false };
@@ -6,7 +6,7 @@ import {
6
6
  loadConfig,
7
7
  upgradeTimestamp,
8
8
  verifyTimestamp
9
- } from "./chunk-XG7E5YXZ.js";
9
+ } from "./chunk-6IPLIM6I.js";
10
10
  import "./chunk-YFSUDT24.js";
11
11
 
12
12
  // src/cli.ts
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ Commands:
18
18
  }
19
19
  switch (command) {
20
20
  case "serve": {
21
- const { runServer } = await import("./server-KWTBEIKF.js");
21
+ const { runServer } = await import("./server-NCO7JIUI.js");
22
22
  await runServer();
23
23
  break;
24
24
  }
@@ -29,7 +29,7 @@ switch (command) {
29
29
  case "check-pending":
30
30
  case "backup":
31
31
  case "scheduler": {
32
- const { runCli } = await import("./cli-KXB6JLHY.js");
32
+ const { runCli } = await import("./cli-GQMURR5I.js");
33
33
  await runCli(command, args);
34
34
  break;
35
35
  }
@@ -7,7 +7,7 @@ import {
7
7
  loadConfig,
8
8
  upgradeTimestamp,
9
9
  verifyTimestamp
10
- } from "./chunk-XG7E5YXZ.js";
10
+ } from "./chunk-6IPLIM6I.js";
11
11
  import "./chunk-YFSUDT24.js";
12
12
 
13
13
  // src/server.ts
@@ -17,7 +17,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprot
17
17
 
18
18
  // src/tools/inspect-timestamp.ts
19
19
  import { readFileSync, statSync } from "fs";
20
- import { deserializeOTS, hasConfirmedAttestation, getEarliestBitcoinBlock } from "@otskit/core";
20
+ import { DetachedTimestampFile } from "@otskit/core";
21
21
  function inspectTimestamp(input, db, _config) {
22
22
  const record = getStamp(db, input.id);
23
23
  if (!record) return { error: "not_found", details: `No stamp with id ${input.id}` };
@@ -34,10 +34,14 @@ function inspectTimestamp(input, db, _config) {
34
34
  let hasBitcoin = false;
35
35
  let bitcoinBlock = null;
36
36
  try {
37
- const proof = deserializeOTS(new Uint8Array(proofBytes));
38
- attestationCount = proof.attestations.length;
39
- hasBitcoin = hasConfirmedAttestation(proof.attestations);
40
- if (hasBitcoin) bitcoinBlock = getEarliestBitcoinBlock(proof.attestations) ?? null;
37
+ const proof = DetachedTimestampFile.deserialize(new Uint8Array(proofBytes));
38
+ const attestations = proof.timestamp.getAttestations();
39
+ attestationCount = attestations.length;
40
+ hasBitcoin = attestations.some((a) => a.kind === "bitcoin");
41
+ if (hasBitcoin) {
42
+ const blocks = attestations.filter((a) => a.kind === "bitcoin").map((a) => a.height);
43
+ bitcoinBlock = blocks.length > 0 ? Math.min(...blocks) : null;
44
+ }
41
45
  } catch {
42
46
  }
43
47
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otskit/mcp",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "OpenTimestamps MCP server — stamp, upgrade, verify via AI agents",
5
5
  "type": "module",
6
6
  "engines": { "node": ">=18" },