adds /ping and /invocations endpoints
This commit is contained in:
2 files changed
+20
-1
No files matched your search
+1
-1
@@ -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)",
|
||||
|
||||
@@ -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`);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user