search1api-mcp 0.5.1 → 0.5.3

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # Search1API MCP Server
2
2
 
3
+ [![smithery badge](https://smithery.ai/badge/superagents-lab/search1api-mcp)](https://smithery.ai/servers/superagents-lab/search1api-mcp)
4
+ [![Glama](https://img.shields.io/badge/Glama-listed-6C5CE7)](https://glama.ai/mcp/servers/superagents-lab/search1api-mcp)
5
+
3
6
  [中文文档](./README_zh.md)
4
7
 
5
8
  The official MCP server for [Search1API](https://www.search1api.com/?utm_source=mcp) — web search, news, page retrieval, sitemap discovery, and trending topics in one API.
@@ -128,7 +131,10 @@ If you prefer to run the server locally, use Node.js 20 or newer with npx — no
128
131
  For self-hosted HTTP deployments behind a proxy, add any internal hostnames
129
132
  that reach the Node.js process to the comma-separated `MCP_ALLOWED_HOSTS`
130
133
  environment variable. `mcp.search1api.com` and localhost addresses are allowed
131
- by default.
134
+ by default. Browser-based clients that send an `Origin` header must also have
135
+ their trusted origin hostnames added to the comma-separated
136
+ `MCP_ALLOWED_ORIGINS` variable. Requests from server-side MCP clients normally
137
+ omit `Origin` and do not require an entry.
132
138
 
133
139
  ## Tools
134
140
 
@@ -184,9 +190,11 @@ Get trending topics from popular platforms.
184
190
 
185
191
  ## Version History
186
192
 
187
- - v0.5.1: Duplicate `fetch` tool removed; pass search result URLs directly to `crawl`
193
+ - v0.5.3: OAuth resource and tool metadata no longer require OIDC session scopes; Smithery and Glama registry badges added
194
+ - 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`
195
+ - v0.5.1: Documentation, LobeHub manifest, and MCP Registry metadata synchronized; `robots.txt` served on the transport host
188
196
  - 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: Initial `search`/`fetch` compatibility, structured output schemas, OAuth security schemes, safety annotations, and Official MCP Registry metadata
197
+ - v0.4.0: Structured output schemas, OAuth security schemes, safety annotations, and Official MCP Registry metadata
190
198
  - v0.3.1: OAuth 2.1 support for Remote MCP; retired reasoning tool removed
191
199
  - v0.3.0: Remote MCP support via Streamable HTTP; per-session API key authentication
192
200
  - 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),
@@ -81,11 +83,12 @@ export function createHttpApp(options = {}) {
81
83
  .type("text/plain")
82
84
  .send(["User-agent: *", "Disallow: /", "Allow: /.well-known/", ""].join("\n"));
83
85
  });
86
+ // OIDC scopes such as openid and offline_access belong to the client/AS
87
+ // exchange; this resource does not require any resource-specific scope.
84
88
  const protectedResourceMetadata = {
85
89
  resource: MCP_RESOURCE,
86
90
  authorization_servers: [AUTHORIZATION_SERVER],
87
91
  bearer_methods_supported: ["header"],
88
- scopes_supported: ["openid", "offline_access"],
89
92
  resource_documentation: "https://www.search1api.com/auth.md",
90
93
  };
91
94
  app.get([
@@ -97,6 +100,12 @@ export function createHttpApp(options = {}) {
97
100
  app.get("/.well-known/oauth-authorization-server", (_req, res) => {
98
101
  res.redirect(302, `${AUTHORIZATION_SERVER}/.well-known/oauth-authorization-server`);
99
102
  });
103
+ app.use("/mcp", (req, res, next) => {
104
+ if (!validateOrigin(req, res)) {
105
+ return;
106
+ }
107
+ next();
108
+ });
100
109
  app.use(express.json());
101
110
  app.all("/mcp", async (req, res) => {
102
111
  const authenticated = await authenticateMcpRequest(req, res, credentialValidator);
@@ -132,6 +141,21 @@ function configuredAllowedHostnames() {
132
141
  ]),
133
142
  ];
134
143
  }
144
+ function configuredAllowedOriginHostnames() {
145
+ const configured = (process.env.MCP_ALLOWED_ORIGINS ?? "")
146
+ .split(",")
147
+ .map((hostname) => hostname.trim())
148
+ .filter(Boolean);
149
+ return [
150
+ ...new Set([
151
+ "mcp.search1api.com",
152
+ "localhost",
153
+ "127.0.0.1",
154
+ "[::1]",
155
+ ...configured,
156
+ ]),
157
+ ];
158
+ }
135
159
  /** Start the production HTTP listener. */
136
160
  export function startHttpServer(port = Number.parseInt(process.env.PORT || "3000", 10)) {
137
161
  const httpApp = createHttpApp();
@@ -1,15 +1,17 @@
1
1
  const AUTHENTICATED_READ_ONLY_WEB = {
2
+ // Authentication is required, but the API does not enforce a
3
+ // resource-specific OAuth scope for these tools.
2
4
  securitySchemes: [
3
5
  {
4
6
  type: "oauth2",
5
- scopes: ["openid", "offline_access"],
7
+ scopes: [],
6
8
  },
7
9
  ],
8
10
  _meta: {
9
11
  securitySchemes: [
10
12
  {
11
13
  type: "oauth2",
12
- scopes: ["openid", "offline_access"],
14
+ scopes: [],
13
15
  },
14
16
  ],
15
17
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "search1api-mcp",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "mcpName": "io.github.superagents-lab/search1api",
5
5
  "description": "A Model Context Protocol (MCP) server that provides search and crawl functionality using Search1API",
6
6
  "private": false,
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.1",
10
+ "version": "0.5.3",
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.1",
21
+ "version": "0.5.3",
22
22
  "transport": {
23
23
  "type": "stdio"
24
24
  },