adds /ping and /invocations endpoints

This commit is contained in:
Sampson committed 2025-07-08 15:35:48 -05:00
1 parent 65c569f01e
commit beab641192
2 files changed
+20 -1

No files matched your search

+19
View File
@@ -62,6 +62,25 @@ export const start = () => {
}
});
app.all('/ping', (req: Request, res: Response) => {
res.status(200).json({ message: 'pong' });
});
app.all('/invocations', async (req: Request, res: Response) => {
try {
const transport = await getTransport(req, transports, req.headers['mcp-session-id']);
await transport.handleRequest(req, res, req.body);
} catch (error) {
if (!res.headersSent) {
res.status(500).json({
id: null,
jsonrpc: '2.0',
error: { code: -32603, message: 'Internal server error' },
});
}
}
});
app.listen(config.port, config.host, () => {
console.error(`Server is running on http://${config.host}:${config.port}/mcp`);
});