mcp-searxng 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http-server.d.ts +5 -0
- package/dist/http-server.js +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -5
- package/dist/url-reader.js +6 -2
- package/package.json +1 -1
package/dist/http-server.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import express from "express";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the bind host from the MCP_HTTP_HOST environment variable.
|
|
5
|
+
* Falls back to "0.0.0.0" (all interfaces) when the variable is absent or whitespace-only.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveBindHost(envValue: string | undefined): string;
|
|
3
8
|
export declare function createHttpServer(createMcpServer: () => McpServer): Promise<express.Application>;
|
package/dist/http-server.js
CHANGED
|
@@ -6,6 +6,17 @@ import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
|
6
6
|
import { logMessage } from "./logging.js";
|
|
7
7
|
import { packageVersion } from "./index.js";
|
|
8
8
|
import { getHttpSecurityConfig, isOriginAllowed, isRequestAuthorized, validateHttpSecurityConfig, } from "./http-security.js";
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the bind host from the MCP_HTTP_HOST environment variable.
|
|
11
|
+
* Falls back to "0.0.0.0" (all interfaces) when the variable is absent or whitespace-only.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveBindHost(envValue) {
|
|
14
|
+
const trimmed = envValue?.trim();
|
|
15
|
+
if (!trimmed) {
|
|
16
|
+
return "0.0.0.0";
|
|
17
|
+
}
|
|
18
|
+
return trimmed;
|
|
19
|
+
}
|
|
9
20
|
export async function createHttpServer(createMcpServer) {
|
|
10
21
|
const app = express();
|
|
11
22
|
const security = getHttpSecurityConfig();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
declare const packageVersion = "1.0
|
|
3
|
+
declare const packageVersion = "1.1.0";
|
|
4
4
|
export { packageVersion };
|
|
5
5
|
export declare function isWebUrlReadArgs(args: unknown): args is {
|
|
6
6
|
url: string;
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,9 @@ import { logMessage, setLogLevel, getCurrentLogLevel } from "./logging.js";
|
|
|
8
8
|
import { performWebSearch } from "./search.js";
|
|
9
9
|
import { fetchAndConvertToMarkdown } from "./url-reader.js";
|
|
10
10
|
import { createConfigResource, createHelpResource } from "./resources.js";
|
|
11
|
-
import { createHttpServer } from "./http-server.js";
|
|
11
|
+
import { createHttpServer, resolveBindHost } from "./http-server.js";
|
|
12
12
|
// Use a static version string that will be updated by the version script
|
|
13
|
-
const packageVersion = "1.0
|
|
13
|
+
const packageVersion = "1.1.0";
|
|
14
14
|
// Export the version for use in other modules
|
|
15
15
|
export { packageVersion };
|
|
16
16
|
// Type guard for URL reading args
|
|
@@ -195,10 +195,12 @@ async function main() {
|
|
|
195
195
|
console.error(`Invalid HTTP port: ${httpPort}. Must be between 1-65535.`);
|
|
196
196
|
process.exit(1);
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
const host = resolveBindHost(process.env.MCP_HTTP_HOST);
|
|
199
|
+
console.log(`Starting HTTP transport on ${host}:${port}`);
|
|
199
200
|
const app = await createHttpServer(createMcpServer);
|
|
200
|
-
const httpServer = app.listen(port, () => {
|
|
201
|
-
console.log(`HTTP server listening on
|
|
201
|
+
const httpServer = app.listen(port, host, () => {
|
|
202
|
+
console.log(`HTTP server listening on ${host}:${port}`);
|
|
203
|
+
// Health/MCP URLs shown as localhost for developer convenience
|
|
202
204
|
console.log(`Health check: http://localhost:${port}/health`);
|
|
203
205
|
console.log(`MCP endpoint: http://localhost:${port}/mcp`);
|
|
204
206
|
});
|
package/dist/url-reader.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isIP } from "node:net";
|
|
2
2
|
import { NodeHtmlMarkdown } from "node-html-markdown";
|
|
3
|
+
import { fetch as undiciFetch } from "undici";
|
|
3
4
|
import { createProxyAgent, createDefaultAgent, ProxyType } from "./proxy.js";
|
|
4
5
|
import { logMessage } from "./logging.js";
|
|
5
6
|
import { urlCache } from "./cache.js";
|
|
@@ -195,8 +196,11 @@ export async function fetchAndConvertToMarkdown(mcpServer, url, timeoutMs = 1000
|
|
|
195
196
|
}
|
|
196
197
|
let response;
|
|
197
198
|
try {
|
|
198
|
-
// Fetch the URL with the abort signal
|
|
199
|
-
|
|
199
|
+
// Fetch the URL with the abort signal.
|
|
200
|
+
// Use undici's own fetch so it shares the same internal version as the
|
|
201
|
+
// Agent/ProxyAgent dispatcher — avoids the Node.js bundled-undici vs
|
|
202
|
+
// npm-undici version mismatch that breaks Content-Encoding decompression.
|
|
203
|
+
response = await undiciFetch(url, requestOptions);
|
|
200
204
|
}
|
|
201
205
|
catch (error) {
|
|
202
206
|
const context = {
|