* chore: remove dead code and fix HTTP port-conflict startup
- drop unused helpers, constants, schemas, and duplicated types
- exit non-zero when the HTTP port is already in use
- add stdio and port-conflict tests
- clean dist on build, add serve:http, fix inspector:http for Inspector v2
* test: harden port-conflict test; drop unreachable listen guard
- pin the child's host so BRAVE_MCP_HOST cannot bypass the conflict
- bound the exit wait and reject spawn errors
- remove the address() guard; 'listening' does not fire on a failed bind
count's schema said to combine with offset for pagination, but the
image api has no offset at all — you just raise count (max 200). agents
were inventing a param that never existed.
* refactor(tools): pass Zod schemas to registerTool instead of raw shapes
registerTool accepts either a ZodObject or a raw shape, and passing the
schema itself keeps each tool definition closer to how its schema is
declared. The advertised JSON Schema is unchanged either way.
* fix(server): advertise tool schemas as JSON Schema 2020-12
The SDK converts our Zod schemas on every tools/list with a hardcoded
draft-07 target: mcp.js calls toJsonSchemaCompat() without a `target`, and
mapMiniTarget(undefined) falls back to 'draft-7'. No registerTool option
overrides it, so every schema we advertised declared draft-07.
Clients that validate against 2020-12 reject those definitions outright,
which takes down the whole tool list rather than a single tool. Separately,
brave_place_search's coordinates tuple emitted draft-07's array-form
`items`, which is invalid under 2020-12 where positional validation moved
to `prefixItems`.
SEP-1613 §5 requires servers to generate 2020-12 by default, so re-emit the
schemas on the tools/list response. Each correction is conditional, so this
decays to a no-op once the SDK emits 2020-12 itself.
Refs: https://github.com/modelcontextprotocol/typescript-sdk/issues/2084
* test(server): assert advertised schemas are valid JSON Schema 2020-12
Compile every tool's inputSchema and outputSchema from a real tools/list
response with a 2020-12 validator. This runs against the wire format rather
than our Zod definitions because the SDK performs the conversion itself: the
Zod schemas can be correct while the advertised JSON Schema is not.
Compiling resolves whichever dialect a schema declares, so a single check
covers both failure modes - a draft-07 declaration, and keywords that are
invalid under 2020-12. The SDK's own default client validator is Ajv
draft-07 with schema validation disabled, so it accepts output that 2020-12
clients reject; add ajv as a devDependency to check the dialect explicitly.
* feat: support reading Brave API key from a file
* chore: add secret file template and gitignore local keys
* docs: document optional Docker Compose secrets workflow
* fix: trim whitespace API keys and exclude secrets from Docker build
* docs: clarify container paths for BRAVE_API_KEY_FILE
* test: cover API key file config and expand Docker build context ignores
* test: isolate getOptions tests from local env vars
* docs: clarify optional use of BRAVE_API_KEY_FILE
* docs: document BRAVE_API_KEY_FILE in AWS Marketplace catalog template
* fix: validate and parse HTTP port as integer
Commander leaves --port as a string, so invalid values like abc previously
passed numeric range checks. Parse ports strictly before starting HTTP transport.
* test: add parsePort unit tests and npm test script
Introduce node:test coverage for HTTP port parsing edge cases using the
existing tsx dev dependency.
* docs: correct README port default and image search description
Align BRAVE_MCP_PORT default with runtime behavior (8080) and remove the
outdated v1.x base64 image search note.
Improves place_search schemas for better documentation. Avoids double-validation by deferring to MCP SDK for validation of response against outputSchema.
No longer attempts to calculate tool names as module-load time, but instead defers it until the values are needed. Additionally, this change updates the schema to support optional tool exposure when using smithery.ai.
Allows administrators to specify either a whitelist or a blacklist for determining which tools are desired. This work introduces new command-line arguments `--enabled-tools` and `--disabled-tools`, which cannot be used together. Likewise, this work also considers environment variables `BRAVE_MCP_ENABLED_TOOLS` and `BRAVE_MCP_DISABLED_TOOLS` as another means of communicating desired or undesired tools. See https://github.com/brave/brave-search-mcp-server/issues/62 for more on the motivation behind this feature.
Tool now more closely resembles the documented response shape of the image API endpoint. This tool also no longer preemptively loads base64-encoded image data. The images tool now uses a structured content response. Following the suggestion in https://modelcontextprotocol.io/specification/2025-06-18/server/tools#output-schema, we also provide an Output Schema, enabling clients to validate the response. As a result of this work, the Images tool requires a slightly different registration approach. For this reason, registration can now be handled via a local "register" method in each tool module. When tools were registered externally in a for-loop, the type system was unable to infer the shape of each tool due to the overloaded union (resulting from only the Image tool having an OutputSchema export).
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