fix: http port validation (#312)

* 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.
This commit is contained in:
Sampson authored and GitHub committed 2026-06-24 07:58:51 -05:00
1 parent feeab77f13
commit e3f77ced06
5 files changed
+56 -3

No files matched your search

+2 -2
View File
@@ -62,7 +62,7 @@ Searches for videos with comprehensive metadata and thumbnail information.
- `freshness` (string, optional): Time filter ("pd", "pw", "pm", "py", or date range)
### Image Search (`brave_image_search`)
Searches for images with automatic fetching and base64 encoding for direct display.
Searches for images with metadata including URLs, dimensions, and confidence scores.
**Parameters:**
- `query` (string, required): Search terms (max 400 chars, 50 words)
@@ -171,7 +171,7 @@ The server supports the following environment variables:
- `BRAVE_API_KEY`: Your Brave Search API key (required)
- `BRAVE_MCP_TRANSPORT`: Transport mode ("http" or "stdio", default: "stdio")
- `BRAVE_MCP_PORT`: HTTP server port (default: 8000)
- `BRAVE_MCP_PORT`: HTTP server port (default: 8080)
- `BRAVE_MCP_HOST`: HTTP server host (default: "0.0.0.0")
- `BRAVE_MCP_LOG_LEVEL`: Desired logging level("debug", "info", "notice", "warning", "error", "critical", "alert", or "emergency", default: "info")
- `BRAVE_MCP_ENABLED_TOOLS`: When used, specifies a space-separated whitelist for supported tools