@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 {
|
|
238
|
+
import { DetachedTimestampFile } from "@otskit/core";
|
|
239
239
|
function checkBitcoinConfirmation(bytes) {
|
|
240
240
|
try {
|
|
241
|
-
const proof =
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
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 };
|
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-
|
|
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-
|
|
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-
|
|
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 {
|
|
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 =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 {
|