chore: remove dead code and fix HTTP port-conflict startup (#351)

* 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
This commit is contained in:
Sampson authored and GitHub committed 2026-09-17 07:45:23 -07:00
1 parent 2cf96460c1
commit 50cb919200
21 files changed
+191 -252

No files matched your search

+5 -7
View File
@@ -63,13 +63,11 @@ export const execute = async (params: QueryParams) => {
}
// TODO (Sampson): The following is unnecessarily repetitive.
if (web && web.results?.length > 0) {
for (const entry of formatWebResults(web)) {
response.content.push({
type: 'text' as const,
text: stringify(entry),
});
}
for (const entry of formatWebResults(web)) {
response.content.push({
type: 'text' as const,
text: stringify(entry),
});
}
if (faq && faq.results?.length > 0) {
+2 -25
View File
@@ -71,20 +71,6 @@ export interface WebSearchApiResponse {
rich?: RichCallbackInfo;
}
export interface LocalPoiSearchApiResponse {
/** The type of local POI search API result. The value is always local_pois. */
type: 'local_pois';
/** Location results matching the ids in the request. */
results?: LocationResult[];
}
export interface LocalDescriptionsSearchApiResponse {
/** The type of local description search API result. The value is always local_descriptions. */
type: 'local_descriptions';
/** Location descriptions matching the ids in the request. */
results?: LocationDescription[];
}
interface Query {
/** The original query that was requested. */
original: string;
@@ -154,7 +140,7 @@ interface DiscussionResult extends Omit<SearchResult, 'type'> {
data?: ForumData;
}
export interface ForumData {
interface ForumData {
/** The name of the forum. */
forum_name: string;
/** The number of answers to the post. */
@@ -211,7 +197,7 @@ export interface Search {
family_friendly: boolean;
}
export interface SearchResult extends Result {
interface SearchResult extends Result {
/** A type identifying a web search result. The value is always search_result. */
type: 'search_result';
/** A sub type identifying the web search result type. */
@@ -449,15 +435,6 @@ interface LocationResult extends Result {
timezone_offset?: number;
}
interface LocationDescription {
/** The type of a location description. The value is always local_description. */
type: 'local_description';
/** A Temporary id of the location with this description. */
id: string;
/** AI generated description of the location with the given id. */
description?: string;
}
interface Locations {
/** Location type identifier. The value is always locations. */
type: 'locations';