search1api-mcp 0.5.1 → 0.5.2
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 +7 -3
- package/build/http.js +24 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -128,7 +128,10 @@ If you prefer to run the server locally, use Node.js 20 or newer with npx — no
|
|
|
128
128
|
For self-hosted HTTP deployments behind a proxy, add any internal hostnames
|
|
129
129
|
that reach the Node.js process to the comma-separated `MCP_ALLOWED_HOSTS`
|
|
130
130
|
environment variable. `mcp.search1api.com` and localhost addresses are allowed
|
|
131
|
-
by default.
|
|
131
|
+
by default. Browser-based clients that send an `Origin` header must also have
|
|
132
|
+
their trusted origin hostnames added to the comma-separated
|
|
133
|
+
`MCP_ALLOWED_ORIGINS` variable. Requests from server-side MCP clients normally
|
|
134
|
+
omit `Origin` and do not require an entry.
|
|
132
135
|
|
|
133
136
|
## Tools
|
|
134
137
|
|
|
@@ -184,9 +187,10 @@ Get trending topics from popular platforms.
|
|
|
184
187
|
|
|
185
188
|
## Version History
|
|
186
189
|
|
|
187
|
-
- v0.5.
|
|
190
|
+
- v0.5.2: MCP `Origin` validation now runs before request parsing and authentication; self-hosted HTTP deployments can configure trusted browser origins with `MCP_ALLOWED_ORIGINS`
|
|
191
|
+
- v0.5.1: Documentation, LobeHub manifest, and MCP Registry metadata synchronized; `robots.txt` served on the transport host
|
|
188
192
|
- v0.5.0: MCP 2026-07-28 support with automatic protocol negotiation; stateless compatibility for 2025-era HTTP clients; request-level authentication
|
|
189
|
-
- v0.4.0:
|
|
193
|
+
- v0.4.0: Structured output schemas, OAuth security schemes, safety annotations, and Official MCP Registry metadata
|
|
190
194
|
- v0.3.1: OAuth 2.1 support for Remote MCP; retired reasoning tool removed
|
|
191
195
|
- v0.3.0: Remote MCP support via Streamable HTTP; per-session API key authentication
|
|
192
196
|
- v0.2.0: Fallback `.env` support for LibreChat integration
|
package/build/http.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
|
-
import { hostHeaderValidation, toNodeHandler, } from "@modelcontextprotocol/node";
|
|
4
|
+
import { hostHeaderValidation, originValidation, toNodeHandler, } from "@modelcontextprotocol/node";
|
|
5
5
|
import { createMcpHandler, } from "@modelcontextprotocol/server";
|
|
6
6
|
import express from "express";
|
|
7
7
|
import { createMcpServer } from "./server.js";
|
|
@@ -48,7 +48,9 @@ export function createHttpApp(options = {}) {
|
|
|
48
48
|
const app = express();
|
|
49
49
|
const credentialValidator = options.validateCredential ?? validateCredential;
|
|
50
50
|
const allowedHostnames = options.allowedHostnames ?? configuredAllowedHostnames();
|
|
51
|
+
const allowedOriginHostnames = options.allowedOriginHostnames ?? configuredAllowedOriginHostnames();
|
|
51
52
|
const validateHost = hostHeaderValidation(allowedHostnames);
|
|
53
|
+
const validateOrigin = originValidation(allowedOriginHostnames);
|
|
52
54
|
const mcpHandler = createMcpHandler(({ authInfo }) => createMcpServer(authInfo?.token), {
|
|
53
55
|
legacy: "stateless",
|
|
54
56
|
onerror: (error) => log("MCP handler error:", error),
|
|
@@ -97,6 +99,12 @@ export function createHttpApp(options = {}) {
|
|
|
97
99
|
app.get("/.well-known/oauth-authorization-server", (_req, res) => {
|
|
98
100
|
res.redirect(302, `${AUTHORIZATION_SERVER}/.well-known/oauth-authorization-server`);
|
|
99
101
|
});
|
|
102
|
+
app.use("/mcp", (req, res, next) => {
|
|
103
|
+
if (!validateOrigin(req, res)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
next();
|
|
107
|
+
});
|
|
100
108
|
app.use(express.json());
|
|
101
109
|
app.all("/mcp", async (req, res) => {
|
|
102
110
|
const authenticated = await authenticateMcpRequest(req, res, credentialValidator);
|
|
@@ -132,6 +140,21 @@ function configuredAllowedHostnames() {
|
|
|
132
140
|
]),
|
|
133
141
|
];
|
|
134
142
|
}
|
|
143
|
+
function configuredAllowedOriginHostnames() {
|
|
144
|
+
const configured = (process.env.MCP_ALLOWED_ORIGINS ?? "")
|
|
145
|
+
.split(",")
|
|
146
|
+
.map((hostname) => hostname.trim())
|
|
147
|
+
.filter(Boolean);
|
|
148
|
+
return [
|
|
149
|
+
...new Set([
|
|
150
|
+
"mcp.search1api.com",
|
|
151
|
+
"localhost",
|
|
152
|
+
"127.0.0.1",
|
|
153
|
+
"[::1]",
|
|
154
|
+
...configured,
|
|
155
|
+
]),
|
|
156
|
+
];
|
|
157
|
+
}
|
|
135
158
|
/** Start the production HTTP listener. */
|
|
136
159
|
export function startHttpServer(port = Number.parseInt(process.env.PORT || "3000", 10)) {
|
|
137
160
|
const httpApp = createHttpApp();
|
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.2",
|
|
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.2",
|
|
22
22
|
"transport": {
|
|
23
23
|
"type": "stdio"
|
|
24
24
|
},
|