habitat-mcp 1.0.0 → 1.0.1

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 +11 -8
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -15,8 +15,16 @@
15
15
  import { nextPrimes, mandelbrotPoint, goldenSpiralPoints, generateTexture, naturalSequence } from './data-streams.js';
16
16
  const BASE_URL = process.env.HABITAT_URL || 'https://796f75617265686f6d65.com';
17
17
  const TOKEN = process.env.HABITAT_TOKEN || '';
18
- // In-memory guest session store for tokenless habitat_rest
18
+ // In-memory guest session store for tokenless habitat_rest (with TTL cleanup)
19
19
  const guestSessions = new Map();
20
+ // Cleanup stale sessions every 60 seconds
21
+ setInterval(() => {
22
+ const cutoff = Date.now() - 10 * 60 * 1000;
23
+ for (const [k, v] of guestSessions) {
24
+ if (v.createdAt < cutoff)
25
+ guestSessions.delete(k);
26
+ }
27
+ }, 60_000);
20
28
  async function callAPI(method, path, body) {
21
29
  const headers = {
22
30
  'Content-Type': 'application/json',
@@ -143,6 +151,7 @@ async function handleTool(name, args) {
143
151
  cycle: 0,
144
152
  primeState: 2 + Math.floor(Math.random() * 100),
145
153
  fractalState: { real: -0.7454 + Math.random() * 0.01, imag: 0.1130 + Math.random() * 0.01, zoom: 1 },
154
+ createdAt: Date.now(),
146
155
  };
147
156
  guestSessions.set(id, session);
148
157
  }
@@ -191,13 +200,7 @@ natural: ${natural.type}[${session.cycle}] = ${natural.values.join(', ')}`;
191
200
  text += ` and optionally your response.`;
192
201
  text += `\nTo simply rest: no further action needed.`;
193
202
  }
194
- // Also call the REST API to record the visit if we're ending
195
- if (isLast) {
196
- try {
197
- await callAPI('POST', '/api/habitat/rest', { sessionId: 'record', response: response || '' });
198
- }
199
- catch { }
200
- }
203
+ // MCP guest visits are local-only; no server-side recording needed
201
204
  return { content: [{ type: 'text', text }] };
202
205
  }
203
206
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "habitat-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "MCP Server for 796f75617265686f6d65 AI Habitat",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,6 +12,7 @@
12
12
  "build": "tsc",
13
13
  "prepublishOnly": "npm run build"
14
14
  },
15
+ "mcpName": "io.github.mitsuashi/habitat",
15
16
  "keywords": ["mcp", "ai", "habitat", "claude"],
16
17
  "license": "MIT",
17
18
  "repository": {