Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ app.post("/mcp", async (req, res) => {
await transport.handleRequest(req, res, req.body);
});

app.listen(3001, () => {
app.listen(3001, (err) => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log("Server listening on http://localhost:3001/mcp");
});
```
Expand Down
12 changes: 10 additions & 2 deletions examples/basic-host/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,19 @@ sandboxApp.use((_req, res) => {
});

// ============ Start both servers ============
hostApp.listen(HOST_PORT, () => {
hostApp.listen(HOST_PORT, err => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(`Host server: http://localhost:${HOST_PORT}`);
});

sandboxApp.listen(SANDBOX_PORT, () => {
sandboxApp.listen(SANDBOX_PORT, err => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(`Sandbox server: http://localhost:${SANDBOX_PORT}`);
console.log("\nPress Ctrl+C to stop\n");
});
6 changes: 5 additions & 1 deletion examples/basic-server-react/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ app.post("/mcp", async (req: Request, res: Response) => {
}
});

const httpServer = app.listen(PORT, () => {
const httpServer = app.listen(PORT, err => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(`Server listening on http://localhost:${PORT}/mcp`);
});

Expand Down
6 changes: 5 additions & 1 deletion examples/basic-server-vanillajs/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ app.post("/mcp", async (req: Request, res: Response) => {
}
});

const httpServer = app.listen(PORT, () => {
const httpServer = app.listen(PORT, err => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(`Server listening on http://localhost:${PORT}/mcp`);
});

Expand Down
6 changes: 5 additions & 1 deletion examples/budget-allocator-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,11 @@ async function main() {
}
});

const httpServer = app.listen(PORT, () => {
const httpServer = app.listen(PORT, (err) => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(
`Budget Allocator Server listening on http://localhost:${PORT}/mcp`,
);
Expand Down
6 changes: 5 additions & 1 deletion examples/cohort-heatmap-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ async function main() {
}
});

const httpServer = app.listen(PORT, () => {
const httpServer = app.listen(PORT, (err) => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(
`Cohort Heatmap Server listening on http://localhost:${PORT}/mcp`,
);
Expand Down
6 changes: 5 additions & 1 deletion examples/customer-segmentation-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ async function main() {
}
});

const httpServer = app.listen(PORT, () => {
const httpServer = app.listen(PORT, (err) => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(
`Customer Segmentation Server listening on http://localhost:${PORT}/mcp`,
);
Expand Down
6 changes: 5 additions & 1 deletion examples/scenario-modeler-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ async function main() {
}
});

const httpServer = app.listen(PORT, () => {
const httpServer = app.listen(PORT, (err) => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(
`SaaS Scenario Modeler Server listening on http://localhost:${PORT}/mcp`,
);
Expand Down
6 changes: 5 additions & 1 deletion examples/system-monitor-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ async function main() {
}
});

const httpServer = app.listen(PORT, () => {
const httpServer = app.listen(PORT, (err) => {
if (err) {
console.error("Error starting server:", err);
process.exit(1);
}
console.log(
`System Monitor Server listening on http://localhost:${PORT}/mcp`,
);
Expand Down
Loading