@sargonpiraev/hh-mcp-server 1.18.0 → 1.19.0

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/build/main.js CHANGED
@@ -262,25 +262,6 @@ app.get('/oauth/callback/debug', (req, res) => {
262
262
  logger.log(`Facade callback: Redirecting to original client: ${callbackUrl.toString()}`);
263
263
  res.redirect(callbackUrl.toString());
264
264
  });
265
- // Session management middleware
266
- function getOrCreateSession(req) {
267
- let sessionId = req.get('Mcp-Session-Id');
268
- if (!sessionId || !sessions.has(sessionId)) {
269
- sessionId = crypto.randomUUID();
270
- sessions.set(sessionId, {
271
- id: sessionId,
272
- createdAt: new Date(),
273
- lastAccessAt: new Date(),
274
- });
275
- }
276
- else {
277
- const session = sessions.get(sessionId);
278
- if (session) {
279
- session.lastAccessAt = new Date();
280
- }
281
- }
282
- return sessionId;
283
- }
284
265
  // Authorization middleware
285
266
  async function requireAuth(req, res, next) {
286
267
  const authHeader = req.get('Authorization');
@@ -385,56 +366,12 @@ app.post('/mcp', requireAuth, async (req, res) => {
385
366
  }
386
367
  }
387
368
  });
388
- // MCP endpoint - GET for SSE streams
389
- app.get('/mcp', requireAuth, (req, res) => {
390
- const sessionId = getOrCreateSession(req);
391
- res.writeHead(200, {
392
- 'Content-Type': 'text/event-stream',
393
- 'Cache-Control': 'no-cache',
394
- Connection: 'keep-alive',
395
- 'Access-Control-Allow-Origin': req.get('Origin') || '*',
396
- 'Access-Control-Allow-Headers': 'Authorization, Mcp-Session-Id',
397
- 'Mcp-Session-Id': sessionId,
398
- });
399
- // Send initial connection event
400
- res.write(`id: ${Date.now()}\n`);
401
- res.write(`event: connected\n`);
402
- res.write(`data: {"sessionId": "${sessionId}"}\n\n`);
403
- // Handle client disconnect
404
- req.on('close', () => {
405
- res.end();
406
- });
407
- // Keep connection alive
408
- const keepAlive = setInterval(() => {
409
- res.write(`id: ${Date.now()}\n`);
410
- res.write(`event: heartbeat\n`);
411
- res.write(`data: {"timestamp": "${new Date().toISOString()}"}\n\n`);
412
- }, 30000);
413
- req.on('close', () => {
414
- clearInterval(keepAlive);
415
- });
416
- });
417
- // Session termination endpoint
418
- app.delete('/mcp', requireAuth, (req, res) => {
419
- const sessionId = req.get('Mcp-Session-Id');
420
- if (sessionId && sessions.has(sessionId)) {
421
- sessions.delete(sessionId);
422
- res.json({ message: 'Session terminated' });
423
- }
424
- else {
425
- res.status(404).json({ error: 'Session not found' });
426
- }
427
- });
428
- // OAuth endpoints are handled by the authorization server directly:
429
- // - Authorization: https://api.hh.ru/oauth/authorize (adjusted for auth domain)
430
- // - Token: https://api.hh.ru/token
431
- // - Inspector will communicate with the authorization server directly for OAuth flow
432
369
  // Health check endpoint
433
370
  app.get('/health', (req, res) => {
434
371
  res.json({
435
372
  status: 'healthy',
436
373
  timestamp: new Date().toISOString(),
437
- version: '',
374
+ version: '1.0.0',
438
375
  });
439
376
  });
440
377
  async function main() {