@otskit/mcp 0.1.1 → 0.1.3

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
@@ -6,6 +6,7 @@ if (!command || command === "--help" || command === "help") {
6
6
  process.stderr.write(`Usage: ots-mcp <command>
7
7
  Commands:
8
8
  serve Start MCP server (stdio transport)
9
+ install-claude Install MCP in Claude Desktop config (auto-setup)
9
10
  stamp <hash> Stamp a SHA-256 hash
10
11
  upgrade <id> Upgrade a pending stamp
11
12
  verify <id> Verify a stamp
@@ -18,10 +19,15 @@ Commands:
18
19
  }
19
20
  switch (command) {
20
21
  case "serve": {
21
- const { runServer } = await import("./server-KWTBEIKF.js");
22
+ const { runServer } = await import("./server-NCO7JIUI.js");
22
23
  await runServer();
23
24
  break;
24
25
  }
26
+ case "install-claude": {
27
+ const { installClaude } = await import("./install-claude-UKSS65BW.js");
28
+ installClaude();
29
+ break;
30
+ }
25
31
  case "stamp":
26
32
  case "upgrade":
27
33
  case "verify":
@@ -29,7 +35,7 @@ switch (command) {
29
35
  case "check-pending":
30
36
  case "backup":
31
37
  case "scheduler": {
32
- const { runCli } = await import("./cli-KXB6JLHY.js");
38
+ const { runCli } = await import("./cli-GQMURR5I.js");
33
39
  await runCli(command, args);
34
40
  break;
35
41
  }
@@ -0,0 +1,44 @@
1
+ // src/install-claude.ts
2
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
3
+ import { join } from "path";
4
+ function getConfigPath() {
5
+ if (process.platform === "win32") {
6
+ return join(process.env.APPDATA ?? "", "Claude", "claude_desktop_config.json");
7
+ } else if (process.platform === "darwin") {
8
+ return join(process.env.HOME ?? "", "Library", "Application Support", "Claude", "claude_desktop_config.json");
9
+ } else {
10
+ return join(process.env.HOME ?? "", ".config", "Claude", "claude_desktop_config.json");
11
+ }
12
+ }
13
+ function installClaude() {
14
+ const configPath = getConfigPath();
15
+ const configDir = join(configPath, "..");
16
+ if (!existsSync(configDir)) {
17
+ mkdirSync(configDir, { recursive: true });
18
+ }
19
+ let config = {};
20
+ if (existsSync(configPath)) {
21
+ try {
22
+ config = JSON.parse(readFileSync(configPath, "utf8"));
23
+ } catch {
24
+ process.stderr.write(`Warning: could not parse existing config, creating new one
25
+ `);
26
+ }
27
+ }
28
+ const mcpServers = config.mcpServers ?? {};
29
+ mcpServers["otskit"] = {
30
+ command: "npx",
31
+ args: ["-y", "@otskit/mcp", "serve"]
32
+ };
33
+ config.mcpServers = mcpServers;
34
+ writeFileSync(configPath, JSON.stringify(config, null, 2), "utf8");
35
+ process.stdout.write(`\u2713 OTSkit MCP installed in Claude Desktop
36
+ `);
37
+ process.stdout.write(` Config: ${configPath}
38
+ `);
39
+ process.stdout.write(` Restart Claude Desktop to apply changes.
40
+ `);
41
+ }
42
+ export {
43
+ installClaude
44
+ };
@@ -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.3",
4
4
  "description": "OpenTimestamps MCP server — stamp, upgrade, verify via AI agents",
5
5
  "type": "module",
6
6
  "engines": { "node": ">=18" },