-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (28 loc) · 958 Bytes
/
index.js
File metadata and controls
36 lines (28 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { Hono } from 'hono';
import { serve } from '@hono/node-server';
import dotenv from 'dotenv';
import { loadModules } from './src/core/moduleLoader.js';
import { setupCoreRoutes } from './src/core/routes.js';
import { setupMiddleware } from './src/core/middleware.js';
import { config } from './src/core/config.js';
import { logger } from './src/utils/logger.js';
// Load environment variables from .env file
dotenv.config();
// Initialize the Hono app
const app = new Hono();
// Setup middleware
setupMiddleware(app);
// Setup core routes
setupCoreRoutes(app);
// Load and register all modules
await loadModules(app);
// Start the server
const PORT = process.env.PORT || config.server.port || 3000;
const HOST = process.env.HOST || config.server.host || '0.0.0.0';
serve({
fetch: app.fetch,
port: PORT,
hostname: HOST,
});
logger.info(`MCP server is running at http://${HOST}:${PORT}`);
logger.info(`Environment: ${config.server.env}`);