search1api-mcp 0.5.3 → 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
@@ -5,7 +5,7 @@
5
5
 
6
6
  [中文文档](./README_zh.md)
7
7
 
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.
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.
9
9
 
10
10
  ## Authentication
11
11
 
@@ -53,6 +53,12 @@ https://mcp.search1api.com/mcp?apiKey=YOUR_SEARCH1API_KEY
53
53
 
54
54
  ### Cursor
55
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
+
56
62
  ```json
57
63
  {
58
64
  "mcpServers": {
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);
@@ -87,18 +93,63 @@ export function createHttpApp(options = {}) {
87
93
  // exchange; this resource does not require any resource-specific scope.
88
94
  const protectedResourceMetadata = {
89
95
  resource: MCP_RESOURCE,
90
- authorization_servers: [AUTHORIZATION_SERVER],
96
+ authorization_servers: [authorizationServer],
91
97
  bearer_methods_supported: ["header"],
92
- resource_documentation: "https://www.search1api.com/auth.md",
98
+ resource_documentation: "https://s1.dev/auth.md",
93
99
  };
94
100
  app.get([
95
101
  "/.well-known/oauth-protected-resource",
96
102
  "/.well-known/oauth-protected-resource/mcp",
97
103
  ], (_req, res) => {
98
- 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
+ });
99
148
  });
100
149
  app.get("/.well-known/oauth-authorization-server", (_req, res) => {
101
- 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`);
102
153
  });
103
154
  app.use("/mcp", (req, res, next) => {
104
155
  if (!validateOrigin(req, res)) {
@@ -126,6 +177,19 @@ export function createHttpApp(options = {}) {
126
177
  close: () => mcpHandler.close(),
127
178
  };
128
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
+ }
129
193
  function configuredAllowedHostnames() {
130
194
  const configured = (process.env.MCP_ALLOWED_HOSTS ?? "")
131
195
  .split(",")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "search1api-mcp",
3
- "version": "0.5.3",
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
  },