diff --git a/package.json b/package.json index 944fb05..38b7f61 100644 --- a/package.json +++ b/package.json @@ -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)", diff --git a/src/protocols/http.ts b/src/protocols/http.ts index c354f96..43879cd 100644 --- a/src/protocols/http.ts +++ b/src/protocols/http.ts @@ -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`); });