mcp-searxng 1.0.3 → 1.0.4
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.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types.js +4 -3
- package/dist/url-reader.js +4 -1
- package/package.json +1 -1
package/dist/http-server.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function createHttpServer(createMcpServer) {
|
|
|
21
21
|
callback(null, false);
|
|
22
22
|
},
|
|
23
23
|
exposedHeaders: ["Mcp-Session-Id"],
|
|
24
|
-
allowedHeaders: ["Content-Type", "mcp-session-id", "authorization"],
|
|
24
|
+
allowedHeaders: ["Content-Type", "mcp-session-id", "authorization", "mcp-protocol-version"],
|
|
25
25
|
}));
|
|
26
26
|
function rejectUnauthorized(res) {
|
|
27
27
|
res.status(401).json({
|
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.0.4";
|
|
4
4
|
export { packageVersion };
|
|
5
5
|
export declare function isWebUrlReadArgs(args: unknown): args is {
|
|
6
6
|
url: string;
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { fetchAndConvertToMarkdown } from "./url-reader.js";
|
|
|
10
10
|
import { createConfigResource, createHelpResource } from "./resources.js";
|
|
11
11
|
import { createHttpServer } 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.0.4";
|
|
14
14
|
// Export the version for use in other modules
|
|
15
15
|
export { packageVersion };
|
|
16
16
|
// Type guard for URL reading args
|
package/dist/types.js
CHANGED
|
@@ -6,8 +6,9 @@ export function isSearXNGWebSearchArgs(args) {
|
|
|
6
6
|
}
|
|
7
7
|
export const WEB_SEARCH_TOOL = {
|
|
8
8
|
name: "searxng_web_search",
|
|
9
|
-
description: "
|
|
10
|
-
"
|
|
9
|
+
description: "Searches the web using SearXNG. " +
|
|
10
|
+
"CRITICAL: The parameter name MUST be exactly `query` (not `prompt`, `q`, or any other name). " +
|
|
11
|
+
"Pass your search terms as the value of the `query` parameter.",
|
|
11
12
|
annotations: {
|
|
12
13
|
readOnlyHint: true,
|
|
13
14
|
openWorldHint: true,
|
|
@@ -17,7 +18,7 @@ export const WEB_SEARCH_TOOL = {
|
|
|
17
18
|
properties: {
|
|
18
19
|
query: {
|
|
19
20
|
type: "string",
|
|
20
|
-
description: "The search query. This is the
|
|
21
|
+
description: "The search query string. This is the required parameter name — use exactly `query`, not `prompt` or `q`.",
|
|
21
22
|
},
|
|
22
23
|
pageno: {
|
|
23
24
|
type: "number",
|
package/dist/url-reader.js
CHANGED
|
@@ -57,9 +57,12 @@ function applyCharacterPagination(content, startChar = 0, maxLength) {
|
|
|
57
57
|
const end = maxLength ? Math.min(content.length, start + maxLength) : content.length;
|
|
58
58
|
return content.slice(start, end);
|
|
59
59
|
}
|
|
60
|
+
function escapeRegExp(str) {
|
|
61
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
62
|
+
}
|
|
60
63
|
function extractSection(markdownContent, sectionHeading) {
|
|
61
64
|
const lines = markdownContent.split('\n');
|
|
62
|
-
const sectionRegex = new RegExp(`^#{1,6}
|
|
65
|
+
const sectionRegex = new RegExp(`^#{1,6}\\s*.*${escapeRegExp(sectionHeading)}.*$`, 'i');
|
|
63
66
|
let startIndex = -1;
|
|
64
67
|
let currentLevel = 0;
|
|
65
68
|
// Find the section start
|