search1api-mcp 0.5.0 → 0.5.1
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/README.md +5 -11
- package/build/http.js +8 -0
- package/build/tools/handlers.js +1 -4
- package/build/tools/index.js +2 -35
- package/build/types.js +0 -7
- package/package.json +1 -1
- package/server.json +2 -2
- package/build/tools/fetch.js +0 -49
package/README.md
CHANGED
|
@@ -133,9 +133,9 @@ by default.
|
|
|
133
133
|
## Tools
|
|
134
134
|
|
|
135
135
|
### search
|
|
136
|
-
Search the web using Search1API. Results
|
|
137
|
-
`id`/`title`/`url`
|
|
138
|
-
|
|
136
|
+
Search the web using Search1API. Results include a citable
|
|
137
|
+
`id`/`title`/`url` structure. Pass a result URL to `crawl` when you need the
|
|
138
|
+
full page.
|
|
139
139
|
|
|
140
140
|
| Parameter | Required | Default | Description |
|
|
141
141
|
|-----------|----------|---------|-------------|
|
|
@@ -147,13 +147,6 @@ knowledge.
|
|
|
147
147
|
| `exclude_sites` | No | [] | Sites to exclude |
|
|
148
148
|
| `time_range` | No | - | day, month, year |
|
|
149
149
|
|
|
150
|
-
### fetch
|
|
151
|
-
Retrieve the full readable contents of a result returned by `search`.
|
|
152
|
-
|
|
153
|
-
| Parameter | Required | Description |
|
|
154
|
-
|-----------|----------|-------------|
|
|
155
|
-
| `id` | Yes | Result ID returned by `search` (the canonical page URL) |
|
|
156
|
-
|
|
157
150
|
### news
|
|
158
151
|
Search for news articles.
|
|
159
152
|
|
|
@@ -191,8 +184,9 @@ Get trending topics from popular platforms.
|
|
|
191
184
|
|
|
192
185
|
## Version History
|
|
193
186
|
|
|
187
|
+
- v0.5.1: Duplicate `fetch` tool removed; pass search result URLs directly to `crawl`
|
|
194
188
|
- v0.5.0: MCP 2026-07-28 support with automatic protocol negotiation; stateless compatibility for 2025-era HTTP clients; request-level authentication
|
|
195
|
-
- v0.4.0:
|
|
189
|
+
- v0.4.0: Initial `search`/`fetch` compatibility, structured output schemas, OAuth security schemes, safety annotations, and Official MCP Registry metadata
|
|
196
190
|
- v0.3.1: OAuth 2.1 support for Remote MCP; retired reasoning tool removed
|
|
197
191
|
- v0.3.0: Remote MCP support via Streamable HTTP; per-session API key authentication
|
|
198
192
|
- v0.2.0: Fallback `.env` support for LibreChat integration
|
package/build/http.js
CHANGED
|
@@ -73,6 +73,14 @@ export function createHttpApp(options = {}) {
|
|
|
73
73
|
}
|
|
74
74
|
res.redirect(301, target.toString());
|
|
75
75
|
});
|
|
76
|
+
// /mcp is a transport endpoint that answers unauthenticated crawlers with
|
|
77
|
+
// 401, so search engines gain nothing from walking this host. Keep the OAuth
|
|
78
|
+
// discovery documents reachable for agents.
|
|
79
|
+
app.get("/robots.txt", (_req, res) => {
|
|
80
|
+
res
|
|
81
|
+
.type("text/plain")
|
|
82
|
+
.send(["User-agent: *", "Disallow: /", "Allow: /.well-known/", ""].join("\n"));
|
|
83
|
+
});
|
|
76
84
|
const protectedResourceMetadata = {
|
|
77
85
|
resource: MCP_RESOURCE,
|
|
78
86
|
authorization_servers: [AUTHORIZATION_SERVER],
|
package/build/tools/handlers.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { INVALID_PARAMS, ProtocolError, } from "@modelcontextprotocol/server";
|
|
2
2
|
import { log } from "../utils.js";
|
|
3
3
|
import { handleSearch } from "./search.js";
|
|
4
|
-
import { handleFetch } from "./fetch.js";
|
|
5
4
|
import { handleCrawl } from "./crawl.js";
|
|
6
5
|
import { handleSitemap } from "./sitemap.js";
|
|
7
6
|
import { handleNews } from "./news.js";
|
|
8
7
|
import { handleTrending } from "./trending.js";
|
|
9
|
-
import { SEARCH_TOOL,
|
|
8
|
+
import { SEARCH_TOOL, CRAWL_TOOL, SITEMAP_TOOL, NEWS_TOOL, TRENDING_TOOL, } from "./index.js";
|
|
10
9
|
/**
|
|
11
10
|
* Dispatch request based on tool name
|
|
12
11
|
* @param toolName Name of the tool
|
|
@@ -19,8 +18,6 @@ export async function handleToolCall(toolName, args, apiKey) {
|
|
|
19
18
|
switch (toolName) {
|
|
20
19
|
case SEARCH_TOOL.name:
|
|
21
20
|
return await handleSearch(args, apiKey);
|
|
22
|
-
case FETCH_TOOL.name:
|
|
23
|
-
return await handleFetch(args, apiKey);
|
|
24
21
|
case CRAWL_TOOL.name:
|
|
25
22
|
return await handleCrawl(args, apiKey);
|
|
26
23
|
case SITEMAP_TOOL.name:
|
package/build/tools/index.js
CHANGED
|
@@ -57,25 +57,11 @@ const SEARCH_OUTPUT_SCHEMA = {
|
|
|
57
57
|
},
|
|
58
58
|
required: ["results"],
|
|
59
59
|
};
|
|
60
|
-
const FETCH_OUTPUT_SCHEMA = {
|
|
61
|
-
type: "object",
|
|
62
|
-
properties: {
|
|
63
|
-
id: { type: "string" },
|
|
64
|
-
title: { type: "string" },
|
|
65
|
-
text: { type: "string" },
|
|
66
|
-
url: { type: "string", format: "uri" },
|
|
67
|
-
metadata: {
|
|
68
|
-
type: "object",
|
|
69
|
-
additionalProperties: true,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
required: ["id", "title", "text", "url"],
|
|
73
|
-
};
|
|
74
60
|
// Search tool definition
|
|
75
61
|
export const SEARCH_TOOL = {
|
|
76
62
|
name: "search",
|
|
77
63
|
title: "Search the web",
|
|
78
|
-
description: "Search the live public web when the user needs current information, sources, or research. Returns citable results with id, title, URL, and text. Pass a result
|
|
64
|
+
description: "Search the live public web when the user needs current information, sources, or research. Returns citable results with id, title, URL, and text. Pass a result URL to crawl to retrieve the full page.",
|
|
79
65
|
...AUTHENTICATED_READ_ONLY_WEB,
|
|
80
66
|
inputSchema: {
|
|
81
67
|
type: "object",
|
|
@@ -129,24 +115,6 @@ export const SEARCH_TOOL = {
|
|
|
129
115
|
},
|
|
130
116
|
outputSchema: SEARCH_OUTPUT_SCHEMA,
|
|
131
117
|
};
|
|
132
|
-
// Fetch tool definition for ChatGPT deep research and company knowledge.
|
|
133
|
-
export const FETCH_TOOL = {
|
|
134
|
-
name: "fetch",
|
|
135
|
-
title: "Fetch a search result",
|
|
136
|
-
description: "Retrieve the full readable contents of a result returned by search. Pass the result id, which is the canonical page URL. Returns id, title, full text, URL, and metadata.",
|
|
137
|
-
...AUTHENTICATED_READ_ONLY_WEB,
|
|
138
|
-
inputSchema: {
|
|
139
|
-
type: "object",
|
|
140
|
-
properties: {
|
|
141
|
-
id: {
|
|
142
|
-
type: "string",
|
|
143
|
-
description: "Result id returned by search; for web results this is the canonical URL",
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
required: ["id"],
|
|
147
|
-
},
|
|
148
|
-
outputSchema: FETCH_OUTPUT_SCHEMA,
|
|
149
|
-
};
|
|
150
118
|
// News tool definition
|
|
151
119
|
export const NEWS_TOOL = {
|
|
152
120
|
name: "news",
|
|
@@ -209,7 +177,7 @@ export const NEWS_TOOL = {
|
|
|
209
177
|
export const CRAWL_TOOL = {
|
|
210
178
|
name: "crawl",
|
|
211
179
|
title: "Read a web page",
|
|
212
|
-
description: "Extract the readable title and full text from a
|
|
180
|
+
description: "Extract the readable title and full text from a public URL supplied by the user or returned by search.",
|
|
213
181
|
...AUTHENTICATED_READ_ONLY_WEB,
|
|
214
182
|
inputSchema: {
|
|
215
183
|
type: "object",
|
|
@@ -307,7 +275,6 @@ export const TRENDING_TOOL = {
|
|
|
307
275
|
};
|
|
308
276
|
export const ALL_TOOLS = [
|
|
309
277
|
SEARCH_TOOL,
|
|
310
|
-
FETCH_TOOL,
|
|
311
278
|
NEWS_TOOL,
|
|
312
279
|
CRAWL_TOOL,
|
|
313
280
|
SITEMAP_TOOL,
|
package/build/types.js
CHANGED
|
@@ -62,13 +62,6 @@ export function isValidSearchArgs(args) {
|
|
|
62
62
|
}
|
|
63
63
|
return true;
|
|
64
64
|
}
|
|
65
|
-
export function isValidFetchArgs(args) {
|
|
66
|
-
if (typeof args !== "object" || args === null) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
const { id } = args;
|
|
70
|
-
return typeof id === "string" && id.trim().length > 0;
|
|
71
|
-
}
|
|
72
65
|
export function isValidCrawlArgs(args) {
|
|
73
66
|
if (typeof args !== 'object' || args === null) {
|
|
74
67
|
return false;
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "https://github.com/superagents-lab/search1api-mcp",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.5.
|
|
10
|
+
"version": "0.5.1",
|
|
11
11
|
"remotes": [
|
|
12
12
|
{
|
|
13
13
|
"type": "streamable-http",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
{
|
|
19
19
|
"registryType": "npm",
|
|
20
20
|
"identifier": "search1api-mcp",
|
|
21
|
-
"version": "0.5.
|
|
21
|
+
"version": "0.5.1",
|
|
22
22
|
"transport": {
|
|
23
23
|
"type": "stdio"
|
|
24
24
|
},
|
package/build/tools/fetch.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { INVALID_PARAMS, ProtocolError, } from "@modelcontextprotocol/server";
|
|
2
|
-
import { makeRequest } from "../api.js";
|
|
3
|
-
import { API_CONFIG } from "../config.js";
|
|
4
|
-
import { isValidFetchArgs, } from "../types.js";
|
|
5
|
-
import { formatError, log } from "../utils.js";
|
|
6
|
-
/**
|
|
7
|
-
* ChatGPT-compatible fetch implementation. Search result IDs are canonical
|
|
8
|
-
* URLs, so fetch can pass the ID directly to the crawl endpoint.
|
|
9
|
-
*/
|
|
10
|
-
export async function handleFetch(args, apiKey) {
|
|
11
|
-
if (!isValidFetchArgs(args)) {
|
|
12
|
-
throw new ProtocolError(INVALID_PARAMS, "Invalid fetch arguments");
|
|
13
|
-
}
|
|
14
|
-
const { id } = args;
|
|
15
|
-
log("Fetching search result:", id);
|
|
16
|
-
try {
|
|
17
|
-
const response = await makeRequest(API_CONFIG.ENDPOINTS.CRAWL, { url: id }, apiKey);
|
|
18
|
-
const result = {
|
|
19
|
-
id,
|
|
20
|
-
title: response.results.title,
|
|
21
|
-
text: response.results.content,
|
|
22
|
-
url: response.results.link || id,
|
|
23
|
-
metadata: {
|
|
24
|
-
source: "search1api",
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
structuredContent: result,
|
|
29
|
-
content: [
|
|
30
|
-
{
|
|
31
|
-
type: "text",
|
|
32
|
-
text: JSON.stringify(result),
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
log("Fetch error:", error);
|
|
39
|
-
return {
|
|
40
|
-
content: [
|
|
41
|
-
{
|
|
42
|
-
type: "text",
|
|
43
|
-
text: `Fetch API error: ${formatError(error)}`,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
isError: true,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|