mirror of
https://github.com/samanhappy/mcphub.git
synced 2026-01-02 12:48:49 -05:00
feat: add group management functionality (#12)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import express from 'express';
|
||||
import config from './config/index.js';
|
||||
import { initMcpServer, registerAllTools } from './services/mcpService.js';
|
||||
import { initMcpServer } from './services/mcpService.js';
|
||||
import { initMiddlewares } from './middlewares/index.js';
|
||||
import { initRoutes } from './routes/index.js';
|
||||
import { handleSseConnection, handleSseMessage } from './services/sseService.js';
|
||||
@@ -20,17 +20,24 @@ export class AppServer {
|
||||
try {
|
||||
// Migrate user data from users.json to mcp_settings.json if needed
|
||||
migrateUserData();
|
||||
|
||||
|
||||
// Initialize default admin user if no users exist
|
||||
await initializeDefaultUser();
|
||||
|
||||
const mcpServer = await initMcpServer(config.mcpHubName, config.mcpHubVersion);
|
||||
await registerAllTools(mcpServer, true);
|
||||
|
||||
initMiddlewares(this.app);
|
||||
initRoutes(this.app);
|
||||
this.app.get('/sse', (req, res) => handleSseConnection(req, res));
|
||||
this.app.post('/messages', handleSseMessage);
|
||||
console.log('Server initialized successfully');
|
||||
|
||||
initMcpServer(config.mcpHubName, config.mcpHubVersion)
|
||||
.then(() => {
|
||||
console.log('MCP server initialized successfully');
|
||||
this.app.get('/sse/:groupId?', (req, res) => handleSseConnection(req, res));
|
||||
this.app.post('/messages', handleSseMessage);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error initializing MCP server:', error);
|
||||
throw error;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error initializing server:', error);
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user