Files
brave-search-mcp-server/package.json
T
Sampson e8b62148ad fix: advertise tool schemas as JSON Schema 2020-12 (#335)
* 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.
2026-08-20 10:41:28 -05:00

56 lines
1.6 KiB
JSON

{
"name": "@brave/brave-search-mcp-server",
"mcpName": "io.github.brave/brave-search-mcp-server",
"version": "2.1.0",
"description": "Brave Search MCP Server: web results, images, videos, rich results, AI summaries, and more.",
"keywords": [
"api",
"brave",
"mcp",
"search"
],
"license": "MIT",
"author": "Brave Software, Inc. (https://brave.com)",
"homepage": "https://github.com/brave/brave-search-mcp-server",
"bugs": "https://github.com/brave/brave-search-mcp-server/issues",
"repository": {
"type": "git",
"url": "https://github.com/brave/brave-search-mcp-server.git"
},
"type": "module",
"module": "dist/server.js",
"bin": {
"brave-search-mcp-server": "dist/index.js"
},
"files": [
"dist"
],
"scripts": {
"build": "tsc && shx chmod +x dist/*.js",
"prepare": "npm run format && npm run build",
"watch": "tsc --watch",
"format": "prettier --write \"src/**/*.ts\"",
"format:check": "prettier --check \"src/**/*.ts\"",
"test": "node --import tsx --test \"src/**/*.test.ts\"",
"inspector": "npx @modelcontextprotocol/inspector",
"inspector:http": "npx @modelcontextprotocol/inspector --transport http"
},
"dependencies": {
"@modelcontextprotocol/sdk": "1.30.0",
"commander": "14.0.3",
"dotenv": "17.3.1",
"express": "5.2.1",
"zod": "4.3.6"
},
"devDependencies": {
"@types/express": "5.0.6",
"@types/node": "24.10.13",
"ajv": "8.20.0",
"prettier": "3.8.1",
"semver": "7.7.3",
"shx": "0.4.0",
"tsx": "4.22.4",
"typescript": "5.9.3"
}
}