@helm-protocol/ttt-mcp 0.1.5 → 0.1.6
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/dist/index.js +54 -3
- package/dist/tools.js +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
7
7
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
8
|
+
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
9
|
+
const http_1 = require("http");
|
|
8
10
|
const zod_1 = require("zod");
|
|
9
11
|
const tools_1 = require("./tools");
|
|
10
12
|
const server = new mcp_js_1.McpServer({
|
|
@@ -108,9 +110,58 @@ server.tool("pot_health", "Check PoT system health: time source status, subgraph
|
|
|
108
110
|
});
|
|
109
111
|
// ---------- Start Server ----------
|
|
110
112
|
async function main() {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
const port = process.env.PORT ? parseInt(process.env.PORT, 10) : null;
|
|
114
|
+
if (port) {
|
|
115
|
+
// HTTP mode for Docker/Glama — StreamableHTTP transport
|
|
116
|
+
const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
|
|
117
|
+
sessionIdGenerator: undefined,
|
|
118
|
+
});
|
|
119
|
+
await server.connect(transport);
|
|
120
|
+
const httpServer = (0, http_1.createServer)(async (req, res) => {
|
|
121
|
+
// Health check for Docker/Glama container probes
|
|
122
|
+
if (req.method === "GET" && (req.url === "/health" || req.url === "/ping")) {
|
|
123
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
124
|
+
res.end(JSON.stringify({ status: "ok", server: "ttt-mcp", version: "0.1.5" }));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// SDK requires both application/json and text/event-stream in Accept.
|
|
128
|
+
// Glama sends only application/json — Hono reads rawHeaders (not headers),
|
|
129
|
+
// so we must patch rawHeaders directly.
|
|
130
|
+
const accept = req.headers["accept"] ?? "";
|
|
131
|
+
if (!accept.includes("text/event-stream")) {
|
|
132
|
+
const newAccept = accept
|
|
133
|
+
? `${accept}, text/event-stream`
|
|
134
|
+
: "application/json, text/event-stream";
|
|
135
|
+
req.headers["accept"] = newAccept;
|
|
136
|
+
const raw = req.rawHeaders;
|
|
137
|
+
const idx = raw.findIndex((h, i) => i % 2 === 0 && h.toLowerCase() === "accept");
|
|
138
|
+
if (idx >= 0) {
|
|
139
|
+
raw[idx + 1] = newAccept;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
raw.push("Accept", newAccept);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
await transport.handleRequest(req, res);
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
if (!res.headersSent) {
|
|
150
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
151
|
+
res.end(JSON.stringify({ error: "Internal server error" }));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
httpServer.listen(port, () => {
|
|
156
|
+
console.error(`[ttt-mcp] OpenTTT MCP Server (HTTP) on port ${port}`);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// stdio mode for npx/Claude Desktop usage
|
|
161
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
162
|
+
await server.connect(transport);
|
|
163
|
+
console.error("[ttt-mcp] OpenTTT MCP Server running on stdio");
|
|
164
|
+
}
|
|
114
165
|
}
|
|
115
166
|
main().catch((err) => {
|
|
116
167
|
console.error("[ttt-mcp] Fatal:", err);
|
package/dist/tools.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// @helm-protocol/ttt-mcp — Tool implementations for Proof of Time MCP Server
|
|
3
|
-
// Uses OpenTTT SDK: TimeSynthesis,
|
|
3
|
+
// Uses OpenTTT SDK: TimeSynthesis, IntegrityPipeline, PotSigner, AdaptiveSwitch
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.potGenerate = potGenerate;
|
|
6
6
|
exports.potVerify = potVerify;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helm-protocol/ttt-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "MCP Server for OpenTTT — Proof of Time tools for AI agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/Helm-Protocol/
|
|
33
|
-
"directory": "mcp"
|
|
32
|
+
"url": "https://github.com/Helm-Protocol/openttt-mcp"
|
|
34
33
|
},
|
|
35
|
-
"homepage": "https://github.com/Helm-Protocol/
|
|
34
|
+
"homepage": "https://github.com/Helm-Protocol/openttt-mcp#readme",
|
|
36
35
|
"engines": {
|
|
37
36
|
"node": ">=18"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
39
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
41
|
-
"openttt": "^0.1.3"
|
|
40
|
+
"openttt": "^0.1.3",
|
|
41
|
+
"zod": "^3.25.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.11.19",
|