single server per transport (#48)

resolves https://github.com/brave/brave-search-mcp-server/issues/47

- Updates SDK to 1.17.3
- Creates a single server instance per transport
- Removes unnecessary ClientLogger (tool execution methods have access to a sendNotification method if so desired)
- Other small syntactic cleanups
This commit is contained in:
Sampson authored and GitHub committed 2025-08-18 10:37:19 -05:00
1 parent 9b6e458c66
commit b64b2fea18
11 files changed
+65 -164

No files matched your search

-3
View File
@@ -6,7 +6,6 @@ import type {
import params, { type QueryParams } from './params.js';
import API from '../../BraveAPI/index.js';
import { stringify } from '../../utils.js';
import ClientLogger from '../../ClientLogger.js';
export const name = 'brave_image_search';
@@ -45,7 +44,6 @@ export const execute = async (params: QueryParams) => {
};
async function fetchImage(url: string): Promise<{ mimeType: string; data: string } | null> {
await ClientLogger.log('info', `Fetching image data from ${url}`);
try {
const response = await fetch(url);
const buffer = await response.arrayBuffer();
@@ -54,7 +52,6 @@ async function fetchImage(url: string): Promise<{ mimeType: string; data: string
mimeType: response.headers.get('content-type') ?? 'image/jpeg',
};
} catch (error) {
await ClientLogger.log('error', `Error fetching image data from ${url}: ${error}`);
return null;
}
}
-3
View File
@@ -1,9 +1,7 @@
import type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
import { summarizerQueryParams, type SummarizerQueryParams } from './params.js';
import API from '../../BraveAPI/index.js';
import { type QueryParams as WebQueryParams } from '../web/params.js';
import { SummarizerSearchApiResponse } from './types.js';
import ClientLogger from '../../ClientLogger.js';
export const name = 'brave_summarizer';
@@ -82,7 +80,6 @@ const pollForSummary = async (
result = response;
}
} catch (error) {
await ClientLogger.log('error', `Error polling for summarizer results: ${error}`);
await new Promise((resolve) => setTimeout(resolve, pollInterval));
}