search1api-mcp 0.5.2 → 0.5.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/README.md CHANGED
@@ -1,8 +1,11 @@
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
- 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.
8
+ The official MCP server for [Search1API](https://s1.dev/?utm_source=mcp) — web search, news, page retrieval, sitemap discovery, and trending topics in one API.
6
9
 
7
10
  ## Authentication
8
11
 
@@ -50,6 +53,12 @@ https://mcp.search1api.com/mcp?apiKey=YOUR_SEARCH1API_KEY
50
53
 
51
54
  ### Cursor
52
55
 
56
+ Install as a Cursor plugin (recommended): this repo includes Agent Plugins `plugin.json` + `mcp.json` (portable) and `.cursor-plugin/plugin.json` (Cursor Marketplace metadata / logo) for Remote MCP with OAuth. Submit or install from [cursor.directory](https://cursor.directory) / the Cursor Marketplace, then sign in when prompted.
57
+
58
+ For local testing, copy the plugin files into `~/.cursor/plugins/local/search1api` (`plugin.json`, `.cursor-plugin/`, `mcp.json`, `assets/`). Do not symlink from outside that directory — Cursor rejects external symlink targets.
59
+
60
+ Or configure manually:
61
+
53
62
  ```json
54
63
  {
55
64
  "mcpServers": {
@@ -187,6 +196,7 @@ Get trending topics from popular platforms.
187
196
 
188
197
  ## Version History
189
198
 
199
+ - v0.5.3: OAuth resource and tool metadata no longer require OIDC session scopes; Smithery and Glama registry badges added
190
200
  - 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
201
  - v0.5.1: Documentation, LobeHub manifest, and MCP Registry metadata synchronized; `robots.txt` served on the transport host
192
202
  - v0.5.0: MCP 2026-07-28 support with automatic protocol negotiation; stateless compatibility for 2025-era HTTP clients; request-level authentication
package/build/http.js CHANGED
@@ -5,9 +5,12 @@ import { hostHeaderValidation, originValidation, toNodeHandler, } from "@modelco
5
5
  import { createMcpHandler, } from "@modelcontextprotocol/server";
6
6
  import express from "express";
7
7
  import { createMcpServer } from "./server.js";
8
+ import { ALL_TOOLS } from "./tools/index.js";
9
+ import { PACKAGE_VERSION } from "./version.js";
8
10
  import { log } from "./utils.js";
9
11
  const API_BASE_URL = process.env.SEARCH1API_API_URL || "https://api.search1api.com";
10
- const AUTHORIZATION_SERVER = "https://clerk.search1api.com";
12
+ const DEFAULT_AUTHORIZATION_SERVER = "https://clerk.s1.dev";
13
+ const OAUTH_DISCOVERY_CACHE_CONTROL = "public, max-age=60, s-maxage=60";
11
14
  const MCP_RESOURCE = "https://mcp.search1api.com/mcp";
12
15
  const MCP_RESOURCE_METADATA = "https://mcp.search1api.com/.well-known/oauth-protected-resource/mcp";
13
16
  /**
@@ -47,6 +50,9 @@ export async function validateCredential(credential) {
47
50
  export function createHttpApp(options = {}) {
48
51
  const app = express();
49
52
  const credentialValidator = options.validateCredential ?? validateCredential;
53
+ const authorizationServer = normalizeAuthorizationServer(options.authorizationServer ??
54
+ process.env.OAUTH_AUTHORIZATION_SERVER ??
55
+ DEFAULT_AUTHORIZATION_SERVER);
50
56
  const allowedHostnames = options.allowedHostnames ?? configuredAllowedHostnames();
51
57
  const allowedOriginHostnames = options.allowedOriginHostnames ?? configuredAllowedOriginHostnames();
52
58
  const validateHost = hostHeaderValidation(allowedHostnames);
@@ -67,7 +73,7 @@ export function createHttpApp(options = {}) {
67
73
  // The service root is documentation, not an MCP transport endpoint. Keep
68
74
  // query parameters so bookmarked campaign/support links remain attributable.
69
75
  app.get("/", (req, res) => {
70
- const target = new URL("https://www.search1api.com/docs/integrations/mcp");
76
+ const target = new URL("https://s1.dev/docs/integrations/mcp");
71
77
  for (const [key, value] of Object.entries(req.query)) {
72
78
  if (typeof value === "string") {
73
79
  target.searchParams.append(key, value);
@@ -83,21 +89,67 @@ export function createHttpApp(options = {}) {
83
89
  .type("text/plain")
84
90
  .send(["User-agent: *", "Disallow: /", "Allow: /.well-known/", ""].join("\n"));
85
91
  });
92
+ // OIDC scopes such as openid and offline_access belong to the client/AS
93
+ // exchange; this resource does not require any resource-specific scope.
86
94
  const protectedResourceMetadata = {
87
95
  resource: MCP_RESOURCE,
88
- authorization_servers: [AUTHORIZATION_SERVER],
96
+ authorization_servers: [authorizationServer],
89
97
  bearer_methods_supported: ["header"],
90
- scopes_supported: ["openid", "offline_access"],
91
- resource_documentation: "https://www.search1api.com/auth.md",
98
+ resource_documentation: "https://s1.dev/auth.md",
92
99
  };
93
100
  app.get([
94
101
  "/.well-known/oauth-protected-resource",
95
102
  "/.well-known/oauth-protected-resource/mcp",
96
103
  ], (_req, res) => {
97
- res.type("application/json").json(protectedResourceMetadata);
104
+ res
105
+ .set("Cache-Control", OAUTH_DISCOVERY_CACHE_CONTROL)
106
+ .type("application/json")
107
+ .json(protectedResourceMetadata);
108
+ });
109
+ // /mcp answers unauthenticated callers with 401 by design, so this card is
110
+ // the only pre-connection description of the server. It is built from
111
+ // ALL_TOOLS, so the advertised tool surface cannot drift from the real one.
112
+ app.get("/.well-known/mcp/server-card.json", (_req, res) => {
113
+ res
114
+ .set("Cache-Control", OAUTH_DISCOVERY_CACHE_CONTROL)
115
+ .type("application/json")
116
+ .json({
117
+ name: "Search1API",
118
+ version: PACKAGE_VERSION,
119
+ description: "Remote MCP server for Search1API. Exposes live web search, news, page reading, sitemap discovery, and trending topics as tools for AI agents.",
120
+ serverUrl: MCP_RESOURCE,
121
+ tools: ALL_TOOLS.map((tool) => ({
122
+ name: tool.name,
123
+ title: tool.title,
124
+ description: tool.description,
125
+ inputSchema: tool.inputSchema,
126
+ annotations: tool.annotations,
127
+ })),
128
+ serverInfo: {
129
+ name: "Search1API",
130
+ title: "Search1API MCP",
131
+ version: PACKAGE_VERSION,
132
+ },
133
+ protocolVersion: "2025-06-18",
134
+ transport: { type: "streamable-http", endpoint: MCP_RESOURCE },
135
+ capabilities: { tools: {} },
136
+ authentication: {
137
+ type: "oauth2",
138
+ protectedResourceMetadata: MCP_RESOURCE_METADATA,
139
+ authorizationServerMetadata: `${authorizationServer}/.well-known/oauth-authorization-server`,
140
+ legacyApiKey: {
141
+ supported: true,
142
+ method: "Authorization: Bearer SEARCH1API_KEY",
143
+ },
144
+ },
145
+ homepage: "https://s1.dev",
146
+ documentation: "https://s1.dev/docs",
147
+ });
98
148
  });
99
149
  app.get("/.well-known/oauth-authorization-server", (_req, res) => {
100
- res.redirect(302, `${AUTHORIZATION_SERVER}/.well-known/oauth-authorization-server`);
150
+ res
151
+ .set("Cache-Control", OAUTH_DISCOVERY_CACHE_CONTROL)
152
+ .redirect(302, `${authorizationServer}/.well-known/oauth-authorization-server`);
101
153
  });
102
154
  app.use("/mcp", (req, res, next) => {
103
155
  if (!validateOrigin(req, res)) {
@@ -125,6 +177,19 @@ export function createHttpApp(options = {}) {
125
177
  close: () => mcpHandler.close(),
126
178
  };
127
179
  }
180
+ function normalizeAuthorizationServer(value) {
181
+ const url = new URL(value.trim());
182
+ const isHttpsOrigin = url.protocol === "https:" &&
183
+ !url.username &&
184
+ !url.password &&
185
+ url.pathname === "/" &&
186
+ !url.search &&
187
+ !url.hash;
188
+ if (!isHttpsOrigin) {
189
+ throw new Error("OAUTH_AUTHORIZATION_SERVER must be a valid HTTPS origin");
190
+ }
191
+ return url.origin;
192
+ }
128
193
  function configuredAllowedHostnames() {
129
194
  const configured = (process.env.MCP_ALLOWED_HOSTS ?? "")
130
195
  .split(",")
@@ -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.2",
3
+ "version": "0.5.4",
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,
@@ -48,7 +48,7 @@
48
48
  "type": "git",
49
49
  "url": "git+https://github.com/superagents-lab/search1api-mcp.git"
50
50
  },
51
- "homepage": "https://github.com/superagents-lab/search1api-mcp#readme",
51
+ "homepage": "https://s1.dev",
52
52
  "bugs": {
53
53
  "url": "https://github.com/superagents-lab/search1api-mcp/issues"
54
54
  },
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.2",
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.2",
21
+ "version": "0.5.3",
22
22
  "transport": {
23
23
  "type": "stdio"
24
24
  },