Merge pull request #14 from brave/sampson-ping/invocations

adds /ping and /invocations endpoints
This commit is contained in:
Harold Spencer Jr. authored and GitHub committed 2025-07-08 17:16:41 -07:00
commit f98dd89886
2 files changed
+20 -1

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@brave/brave-search-mcp-server",
"version": "1.0",
"version": "1.1",
"description": "MCP server for Brave Search. Uses the Brave Search API to return results from the web, including ranked links, images, and videos, as well as AI summaries of pages, rich results, and more.",
"license": "MIT",
"author": "Brave Software, Inc. (https://brave.com)",
+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`);
});