chore: remove dead code and fix HTTP port-conflict startup (#351)

* chore: remove dead code and fix HTTP port-conflict startup

- drop unused helpers, constants, schemas, and duplicated types
- exit non-zero when the HTTP port is already in use
- add stdio and port-conflict tests
- clean dist on build, add serve:http, fix inspector:http for Inspector v2

* test: harden port-conflict test; drop unreachable listen guard

- pin the child's host so BRAVE_MCP_HOST cannot bypass the conflict
- bound the exit wait and reject spawn errors
- remove the address() guard; 'listening' does not fire on a failed bind
This commit is contained in:
Sampson authored and GitHub committed 2026-09-17 07:45:23 -07:00
1 parent 2cf96460c1
commit 50cb919200
21 files changed
+191 -252

No files matched your search

+9 -1
View File
@@ -99,10 +99,18 @@ const start = () => {
}
const app = createApp();
const server = app.listen(config.port, config.host);
app.listen(config.port, config.host, () => {
server.on('listening', () => {
console.log(`Server is running on http://${config.host}:${config.port}/mcp`);
});
server.on('error', (error: NodeJS.ErrnoException) => {
const detail =
error.code === 'EADDRINUSE' ? `port ${config.port} is already in use` : error.message;
console.error(`Unable to start HTTP server: ${detail}`);
process.exit(1);
});
};
export default { start, createApp };