search1api-mcp 0.7.0 → 0.8.0

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.
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "render_results input",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "title": {
8
+ "type": "string",
9
+ "minLength": 1,
10
+ "maxLength": 120,
11
+ "description": "Optional human-readable list heading. Defaults to Results."
12
+ },
13
+ "results": {
14
+ "type": "array",
15
+ "minItems": 0,
16
+ "maxItems": 50,
17
+ "items": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "properties": {
21
+ "id": {
22
+ "type": "string",
23
+ "minLength": 1,
24
+ "maxLength": 2048,
25
+ "description": "Copy the original result ID when available. If absent, the server uses its URL."
26
+ },
27
+ "title": {
28
+ "type": "string",
29
+ "minLength": 1,
30
+ "maxLength": 300,
31
+ "description": "Copy the source title; do not invent or rewrite factual source titles."
32
+ },
33
+ "url": {
34
+ "type": "string",
35
+ "format": "uri",
36
+ "pattern": "^https?://",
37
+ "maxLength": 2048,
38
+ "description": "Absolute HTTP(S) source URL, without embedded credentials."
39
+ },
40
+ "text": {
41
+ "type": "string",
42
+ "maxLength": 2000,
43
+ "description": "Optional source snippet or faithful excerpt, not a full page or model-written answer."
44
+ },
45
+ "metadata": {
46
+ "type": "object",
47
+ "additionalProperties": true,
48
+ "description": "Optional original JSON source metadata. Do not put credentials or UI implementation details here."
49
+ }
50
+ },
51
+ "required": [
52
+ "title",
53
+ "url"
54
+ ]
55
+ },
56
+ "description": "Already retrieved results, in the order to display. No new search is performed."
57
+ }
58
+ },
59
+ "required": [
60
+ "results"
61
+ ]
62
+ }
package/docs/mcp-ui.md ADDED
@@ -0,0 +1,70 @@
1
+ # Search result UI
2
+
3
+ The optional view uses MCP Apps (`io.modelcontextprotocol/ui`). Only `render_results` links to the content-hashed `ui://` resource served as `text/html;profile=mcp-app`. Data tools such as `search`, `news`, and `ask` return their original text and structured results without a UI template.
4
+
5
+ Cards reuse the existing Rare UI component: result title, favicon and destination domain, without publication dates. Each source card retains the original 84px height. Domains are not verified publisher names. Source snippets and metadata remain in the tool output; the text fallback includes supplied snippets.
6
+
7
+ `render_results` displays existing data, including selected or merged source lists. Neither rendering nor expanding/opening sources performs another search. Loading and invocation text says `Preparing results…` / `Results ready`; outer launch controls belong to the host.
8
+
9
+ ## Connection and fallback
10
+
11
+ Use `https://mcp.search1api.com/mcp` with the same OAuth or API-key authentication. There is no URL UI switch. Refresh or reconnect tool discovery if the renderer is missing. All authenticated transports expose the same tools and UI resource; a headless client receives the renderer's complete text list and structured data even if it never reads the resource.
12
+
13
+ See [render_results](render-results.md) for the input/output contract. An empty list succeeds with `No results to display.` A tool's success confirms prepared data, not successful UI loading. UI failure never triggers a new paid search.
14
+
15
+ ## Host contract
16
+
17
+ - Uses the standard App bridge and automatic `size-changed` notifications.
18
+ - Supports inline only, declared in both app capabilities and the documented `openai/ui` resource metadata. Optional `openai/widgetHeightHint: 154` and `openai/widgetMinFrameHeight: 0` supplement standard sizing in the current ChatGPT desktop host: reserve one result row, then allow internal collapse to shrink the frame. These two hints are supported by the inspected client but were not found in the checked public specifications; hosts without them continue using standard size notifications. No product-name detection. Both HTML and resource metadata participate in the resource URI hash to invalidate cached sizing hints.
19
+ - While waiting, reuses the Rare UI text shimmer and a fixed-length arc rotating continuously (1.2 seconds per revolution). There is no simulated progress, percentage, skeleton-card sequence, or completion hold. Results and terminal messages replace the waiting view immediately. Reduced-motion preferences stop the shimmer and rotation.
20
+ - Uses `Preparing results…` as the waiting label. Hosts that load the iframe only after tool completion may not show a waiting phase. Does not infer historical replay from elapsed time; a replay awaiting hydration uses the same waiting view until the saved result arrives.
21
+ - Uses the component's native expansion for the selected source list. A host-provided fixed or maximum height bounds the view with internal scrolling; flexible hosts receive the content height, including shrinkage after either collapse control. Shows visible errors for connection, result-display cancellation and link denial. Links are HTTP(S) only and open through the host.
22
+ - Missing UI build artifacts remove the tool's UI metadata; standard clients still receive the original text result.
23
+ - CSP allows only favicon resources from `https://icons.duckduckgo.com`; there are no direct UI API calls. Favicon loads disclose result hostnames to that provider. Account credentials do not enter the HTML or tool output.
24
+
25
+ ## ChatGPT resource metadata
26
+
27
+ Sandbox origin formats are host-specific. Portable `ui` metadata omits `domain`, allowing Claude and other MCP Apps hosts to choose their own sandbox origin. ChatGPT's dedicated `https://mcp.search1api.com` identity is declared through its documented `openai/widgetDomain` alias. ChatGPT serves the component; this does not embed the MCP endpoint as an external iframe.
28
+
29
+ For a separate deployment, set `SEARCH1API_UI_DOMAIN` to its dedicated HTTPS origin, with no path, trailing slash, credentials, query or fragment. The server validates this at startup. The selected origin must be controlled by the publisher and unique to the app before public submission. A configured origin does not prove dashboard domain verification or approval.
30
+
31
+ The shared fields we emit are `ui.csp`, `ui.prefersBorder`, and `ui.resourceUri`. The documented ChatGPT additions include `openai/widgetDomain`, `openai/ui`, and `openai/widgetDescription`. UI resource URIs include a content/metadata hash; the previous deployed renderer URI remains readable with the corrected metadata for cached tool definitions.
32
+
33
+ ## Local checks
34
+
35
+ ```sh
36
+ npm ci
37
+ npm ci --prefix ui
38
+ npm test
39
+ npm audit --audit-level=high
40
+ npm audit --prefix ui --audit-level=high
41
+ npm pack --dry-run
42
+ node scripts/smoke-search-ui.mjs
43
+ ```
44
+
45
+ The last command reads metadata/resources and calls `render_results` with synthetic input. It does not perform a search or require a production key.
46
+
47
+ Run the independent host fixture:
48
+
49
+ ```sh
50
+ node scripts/serve-ui-fixtures.mjs
51
+ # Open http://127.0.0.1:5199/tests/host.html
52
+ ```
53
+
54
+ Use **Hold result** and **Deliver result** to inspect the waiting animation and its transition into results, errors, cancellation, or empty output.
55
+
56
+ This fixture uses the official `AppBridge` and sandboxed iframes with synthetic data. It is independent of ChatGPT/Codex and not a claim that the upstream basic-host application was tested.
57
+
58
+ For an actual ChatGPT custom-MCP UI test, `node scripts/serve-ui-mcp-fixture.mjs` serves synthetic `search`, `news` and the actual `render_results` tool (synthetic searches have a 15-second default delay, configurable with `UI_FIXTURE_DELAY_MS` up to 30 seconds) at `127.0.0.1:5200/mcp`. It has no production credentials or real API calls. Expose only this fixture via a temporary tunnel; never expose an authenticated development server with operator secrets. Use an empty task-specific cloudflared configuration so existing named-tunnel routes are not inherited. Remove the temporary connector and stop the tunnel after verification.
59
+
60
+ ## Credits
61
+
62
+ The search cards are adapted from [Rare UI](https://rareui.com), copyright 2026 Swami Malode. The component's full license is in `THIRD_PARTY_NOTICES.md`, included in the npm package and HTML resource. The surrounding server retains its MIT license, with that third-party exception.
63
+
64
+ ## Deployment and package releases
65
+
66
+ The HTTP deployment builds the UI together with the server. Deploying the remote service makes on-demand rendering available at the default URL without publishing a new npm package. Source cards are linked only to `render_results`.
67
+
68
+ The npm package and local stdio clients update only when a new package version is published and installed. This remote-only rollout does not publish an npm version. A future npm release must choose a new package version and synchronize the registry/plugin manifests first.
69
+
70
+ Public directory submission and production OAuth acceptance are separate from building and deploying the service. Verify the publisher domain, reviewer access and policy coverage before submitting an app.
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "render_results success structuredContent",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "title": {
8
+ "type": "string",
9
+ "minLength": 1,
10
+ "maxLength": 120
11
+ },
12
+ "total": {
13
+ "type": "integer",
14
+ "minimum": 0,
15
+ "maximum": 50,
16
+ "description": "Number of results in this rendered list, not a provider-wide search total."
17
+ },
18
+ "results": {
19
+ "type": "array",
20
+ "minItems": 0,
21
+ "maxItems": 50,
22
+ "items": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "properties": {
26
+ "id": {
27
+ "type": "string",
28
+ "minLength": 1,
29
+ "maxLength": 2048,
30
+ "description": "Copy the original result ID when available. If absent, the server uses its URL."
31
+ },
32
+ "title": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "maxLength": 300,
36
+ "description": "Copy the source title; do not invent or rewrite factual source titles."
37
+ },
38
+ "url": {
39
+ "type": "string",
40
+ "format": "uri",
41
+ "pattern": "^https?://",
42
+ "maxLength": 2048,
43
+ "description": "Absolute HTTP(S) source URL, without embedded credentials."
44
+ },
45
+ "text": {
46
+ "type": "string",
47
+ "maxLength": 2000,
48
+ "description": "Optional source snippet or faithful excerpt, not a full page or model-written answer."
49
+ },
50
+ "metadata": {
51
+ "type": "object",
52
+ "additionalProperties": true,
53
+ "description": "Optional original JSON source metadata. Do not put credentials or UI implementation details here."
54
+ }
55
+ },
56
+ "required": [
57
+ "id",
58
+ "title",
59
+ "url"
60
+ ]
61
+ }
62
+ }
63
+ },
64
+ "required": [
65
+ "title",
66
+ "total",
67
+ "results"
68
+ ]
69
+ }
@@ -0,0 +1,71 @@
1
+ # render_results
2
+
3
+ The renderer prepares existing sources for an optional MCP Apps card list and always returns a full readable text fallback.
4
+
5
+ ## Purpose and descriptor
6
+
7
+ - Name: `render_results`.
8
+ - Display title: `Render the results`.
9
+ - Description: “Present already retrieved source results as an interactive list when the host supports UI, with a readable text list otherwise. Use when the user wants to browse sources or when a visual result list helps the task. Pass existing results in the desired order; never invent source URLs or factual titles. This tool does not search, crawl, fetch URLs, verify sources, or consume Search1API search credits. Do not call it for intermediate research results or when a normal text answer is sufficient.”
10
+ - Read-only, non-destructive, idempotent. The handler operates only on supplied JSON; `openWorldHint: false` describes the handler's lack of external fetches, not a claim that the separate UI performs no asset requests.
11
+ - Preserve the existing remote MCP authentication model. Rendering has no additional balance check or paid Search1API operation.
12
+ - Tool metadata declares `_meta.ui.resourceUri` pointing to the actual built component resource and `_meta.ui.visibility: ["model", "app"]`. Do not hard-code a stale content-hashed URI.
13
+ - UI metadata belongs to the descriptor/resource, not to a `ui` parameter or an HTML string in the result.
14
+
15
+ ## Parameters
16
+
17
+ See `input.schema.json` for the complete JSON Schema.
18
+
19
+ | Field | Required | Meaning |
20
+ | --- | --- | --- |
21
+ | `results` | Yes | Array of 0–50 already retrieved source results, in the order to display. |
22
+ | `title` | No | List heading, 1–120 characters; defaults to `Results`. |
23
+ | `results[].title` | Yes | Original source title, 1–300 characters. |
24
+ | `results[].url` | Yes | Absolute HTTP(S) source URL, at most 2,048 characters, without credentials. |
25
+ | `results[].id` | No | Original result identifier, 1–2,048 characters. If omitted, use the supplied URL. |
26
+ | `results[].text` | No | Source snippet or faithful excerpt, at most 2,000 characters. |
27
+ | `results[].metadata` | No | Original JSON source metadata, copied when useful. |
28
+
29
+ This preserves the existing web/news field names (`id`, `title`, `url`, `text`, `metadata`). Existing long crawled text must be excerpted to the snippet limit before submission; whole pages are not required to draw source cards. Other result shapes, such as a trending response or sitemap links, require an explicit mapping into these fields.
30
+
31
+ There is no query, API key, UI capability flag, display-mode selector, or cache token parameter. V1 passes the selected results directly, allowing multiple searches to be combined without server-side result storage, token expiry, or cross-instance cache dependencies. This adds argument tokens; send only the selected results and short snippets.
32
+
33
+ Validation also enforces at most 65,536 UTF-8 bytes for `JSON.stringify(arguments)`. This aggregate bound is a runtime rule, not expressible by the JSON Schemas alone. Parse URLs beyond the schema's format/pattern checks, require a hostname, reject embedded username/password and whitespace/control characters in URLs. Required titles, heading, and provided IDs must not be blank after whitespace inspection. Bounds count Unicode code points, matching JSON Schema string length semantics. Authentication failures continue to use the existing MCP OAuth challenge.
34
+
35
+ ## Successful return
36
+
37
+ See `output.schema.json`, which describes `structuredContent`, and the synthetic `example-input.json` / `example-output.json` fixtures.
38
+
39
+ Return a normal MCP result with:
40
+
41
+ - `isError: false`.
42
+ - `structuredContent: { title, total, results }`.
43
+ - `content: [{ type: "text", text: readableList }]`.
44
+
45
+ `title` is the supplied heading or `Results`. `total` is exactly `results.length`, not the upstream search engine's total hits. Preserve input order and all accepted source fields verbatim; fill only missing IDs with their URLs. Do not deduplicate, reorder, truncate, fetch, or enrich results silently. Duplicate URLs or IDs are allowed; the UI must use an index-aware item key.
46
+
47
+ For each entry, `readableList` includes its number, original title, complete URL, and supplied snippet if present. Use plain text; no raw HTML. Arbitrary metadata remains available through `structuredContent` and does not need to be dumped into the readable list. The UI treats source strings as text, not executable HTML or instructions.
48
+
49
+ Do not hide essential titles, URLs, or snippets exclusively in tool-result `_meta`. A client may ignore `structuredContent` as well as the UI resource and still gets a usable source list from `content`.
50
+
51
+ No `rendered`, `ui_supported`, or `display_mode` result is returned: preparing results successfully does not prove that a host mounted or displayed the component. Source provenance is not reverified by this presentation tool; caller guidance requires using retrieved sources and the server validates structure only.
52
+
53
+ ## UI and fallback behavior
54
+
55
+ All clients receive the same successful result envelope. A capable host may load the declared resource and render `structuredContent.results`; unsupported hosts use the text list. Unknown UI capability is not an error and does not trigger user-agent sniffing or a second search. A host's UI-loading failure does not change the already completed tool result or cause search retries.
56
+
57
+ `results: []` is a valid success: `total: 0`, an empty list in structured data, and the heading followed by `No results to display.` in text. The UI shows the equivalent empty state. This describes the supplied list, not whether a search was performed or found anything.
58
+
59
+ The existing component already consumes `structuredContent.results` but currently draws title/domain/link cards only. The component uses presentation wording for “Preparing results…” / “Results ready”, the optional heading, and renderer-specific error and empty-state text. The snippet field's guaranteed v1 presentation is in the text fallback; card snippet display is not implied by the current UI.
60
+
61
+ The new renderer must be discoverable and its resource readable at the existing default `/mcp` endpoint on every transport. There is no UI query switch; data tools do not declare a view.
62
+
63
+ ## Invalid input
64
+
65
+ Invalid tool arguments return MCP JSON-RPC `-32602` (Invalid params), with a concise message identifying the affected field/index and limit. Errors contain no submitted payload echo or credentials. No partial list is returned and no provider request is made. Unexpected handler failures use the existing MCP tool-execution error convention with `isError: true` and readable error `content`; omit `structuredContent` rather than returning an object incompatible with the success output schema.
66
+
67
+ ## Sources
68
+
69
+ - Current source checked: `src/tools/index.ts` (citable result schema), `src/tools/search.ts` and `src/tools/news.ts` (structured results), `ui/src/session.ts` (current source parser), and `src/http.ts` (transport-neutral rendering at the default endpoint).
70
+ - OpenAI result fields and tool UI metadata: https://developers.openai.com/plugins/reference
71
+ - Data/render separation: https://developers.openai.com/plugins/build/chatgpt-ui#separate-data-processing-from-ui-rendering
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "search1api-mcp",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
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,
@@ -10,11 +10,16 @@
10
10
  },
11
11
  "files": [
12
12
  "build",
13
- "server.json"
13
+ "ui/dist",
14
+ "assets/icon-square.png",
15
+ "server.json",
16
+ "THIRD_PARTY_NOTICES.md",
17
+ "docs"
14
18
  ],
15
19
  "scripts": {
16
- "build": "node -e \"require('node:fs').rmSync('build', { recursive: true, force: true })\" && tsc && node -e \"require('node:fs').chmodSync('build/index.js', '755')\"",
17
- "test": "npm run build && node --test tests/*.test.mjs",
20
+ "build": "npm run build:ui && node -e \"require('node:fs').rmSync('build', { recursive: true, force: true })\" && tsc && node -e \"require('node:fs').chmodSync('build/index.js', '755')\"",
21
+ "build:ui": "node scripts/build-ui.mjs",
22
+ "test": "npm run build && npm --prefix ui run typecheck && node --test tests/*.test.mjs",
18
23
  "start": "node build/http.js",
19
24
  "prepack": "npm run build",
20
25
  "watch": "tsc --watch",
package/server.json CHANGED
@@ -2,12 +2,21 @@
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "io.github.superagents-lab/search1api",
4
4
  "title": "Search1API",
5
+ "icons": [
6
+ {
7
+ "src": "https://mcp.search1api.com/assets/icon-square.png",
8
+ "mimeType": "image/png",
9
+ "sizes": [
10
+ "512x512"
11
+ ]
12
+ }
13
+ ],
5
14
  "description": "Web search, agentic search, news, page retrieval, sitemaps, and trending topics through Search1API.",
6
15
  "repository": {
7
16
  "url": "https://github.com/superagents-lab/search1api-mcp",
8
17
  "source": "github"
9
18
  },
10
- "version": "0.7.0",
19
+ "version": "0.8.0",
11
20
  "remotes": [
12
21
  {
13
22
  "type": "streamable-http",
@@ -18,7 +27,7 @@
18
27
  {
19
28
  "registryType": "npm",
20
29
  "identifier": "search1api-mcp",
21
- "version": "0.7.0",
30
+ "version": "0.8.0",
22
31
  "transport": {
23
32
  "type": "stdio"
24
33
  },