mcp-hub-001: Project scaffolding and core server
This commit is contained in:
parent
2b557e1eca
commit
60d92af13b
6 changed files with 916 additions and 0 deletions
4
src/config.js
Normal file
4
src/config.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
PORT: parseInt(process.env.PORT, 10) || 3000,
|
||||
HUB_SECRET: process.env.HUB_SECRET || 'dev-secret',
|
||||
};
|
||||
6
src/index.js
Normal file
6
src/index.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
const app = require('./server');
|
||||
const config = require('./config');
|
||||
|
||||
app.listen(config.PORT, () => {
|
||||
console.log(`MCP relay hub listening on port ${config.PORT}`);
|
||||
});
|
||||
23
src/server.js
Normal file
23
src/server.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
app.use((req, res, next) => {
|
||||
const start = Date.now();
|
||||
res.on('finish', () => {
|
||||
console.log(`${req.method} ${req.path} ${res.statusCode} ${Date.now() - start}ms`);
|
||||
});
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({
|
||||
status: 'ok',
|
||||
uptime: process.uptime(),
|
||||
connectedBackends: 0,
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
Loading…
Add table
Add a link
Reference in a new issue