feat(mcp): implement MCP infrastructure

- Add `mcp_settings` table to database schema
- Enable internal MCP API endpoint via middleware header authentication
- Introduce runtime log directory and capture utilities for diagnostics
- Update build pipeline to capture build logs
This commit is contained in:
Team Dark Devil committed 2026-11-21 23:00:29 +06:00
1 parent ae9b554189
commit b2669e2ad5
19 files changed
+3280 -20

No files matched your search

+28 -4
View File
@@ -7,6 +7,7 @@
const path = require('node:path');
const { spawn } = require('node:child_process');
const { appendRuntimeLogLine } = require('../server/runtimeLogCapture');
const webPort = String(process.env.PORT || '3000');
const nextBin = require.resolve('next/dist/bin/next');
@@ -19,18 +20,41 @@ console.log('\x1b[36m%s\x1b[0m', ` - Port ${webPort}: Next.js 15 Web & Admin Co
console.log('\x1b[36m%s\x1b[0m', ' - Port 4000: Ingestion & Socket.IO Streaming Engine');
console.log('\x1b[36m%s\x1b[0m', '=======================================================\n');
const childEnv = {
...process.env,
DATASTACK_LOG_CAPTURED_BY_RUNNER: '1',
};
const nextProc = spawn(process.execPath, [nextBin, 'dev', '-p', webPort, '-H', '0.0.0.0'], {
stdio: 'inherit',
stdio: ['inherit', 'pipe', 'pipe'],
shell: false,
env: { ...process.env },
env: childEnv,
});
const serverProc = spawn(process.execPath, [serverEntry], {
stdio: 'inherit',
stdio: ['inherit', 'pipe', 'pipe'],
shell: false,
env: { ...process.env },
env: childEnv,
});
function wireStreamCapture(proc, serviceName) {
if (proc.stdout) {
proc.stdout.on('data', (chunk) => {
process.stdout.write(chunk);
appendRuntimeLogLine(serviceName, 'stdout', chunk.toString('utf8'));
});
}
if (proc.stderr) {
proc.stderr.on('data', (chunk) => {
process.stderr.write(chunk);
appendRuntimeLogLine(serviceName, 'stderr', chunk.toString('utf8'));
});
}
}
wireStreamCapture(nextProc, 'web');
wireStreamCapture(serverProc, 'ingestion');
let shuttingDown = false;
let exitedChildren = 0;
let nextExited = false;