@agentsearchhq/agentsearch-mcp 1.0.0 → 1.1.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.
- package/README.md +8 -4
- package/dist/client.d.ts +23 -1
- package/dist/client.js +31 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +3 -0
- package/dist/server.js +15 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/render.d.ts +3 -0
- package/dist/tools/render.js +108 -0
- package/dist/tools/render.js.map +1 -0
- package/dist/tools/search.d.ts +8 -0
- package/dist/tools/search.js +4 -4
- package/dist/tools/search.js.map +1 -1
- package/dist/version.d.ts +3 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -0
- package/manifest.json +19 -6
- package/package.json +8 -4
- package/server.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# agentsearch-mcp
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) server that exposes **AgentSearch** web search —
|
|
3
|
+
MCP (Model Context Protocol) server that exposes **AgentSearch** web search — plus optional URL extract and JavaScript page rendering (headless browser) — to Cursor, Claude Desktop, and other MCP hosts over **stdio**.
|
|
4
4
|
|
|
5
5
|
[AgentSearch](https://agentsearchhq.com) is a web-search API aimed at agents. You can run it against a **local/self-hosted** AgentSearch instance (`direct` mode) or the **Pocket Network agent portal** (`portal` mode).
|
|
6
6
|
|
|
@@ -9,6 +9,7 @@ MCP (Model Context Protocol) server that exposes **AgentSearch** web search —
|
|
|
9
9
|
body: `{ "query": "...", "max_results": 5 }`
|
|
10
10
|
- Direct search: `POST {AGENTSEARCH_BASE_URL}/v1/search` with the same body
|
|
11
11
|
- Direct extract: `POST {AGENTSEARCH_BASE_URL}/v1/extract`
|
|
12
|
+
- Direct render: `POST {AGENTSEARCH_BASE_URL}/v1/render` (headless Chromium; [OpenAPI spec](https://agentsearchhq.com/specs/render-openapi.json))
|
|
12
13
|
|
|
13
14
|
Pocket explorer: [agentsearch-web-search-v1](https://explorer.pocket.network/service/agentsearch-web-search-v1)
|
|
14
15
|
|
|
@@ -22,8 +23,11 @@ Pocket explorer: [agentsearch-web-search-v1](https://explorer.pocket.network/ser
|
|
|
22
23
|
|------|------|-------------|
|
|
23
24
|
| `agentsearch_web_search` | `query` (string, required), `max_results` (number, optional, default 5, clamped 1–10) | Web search in direct or portal mode. Returns pretty-printed JSON. Use for a query; use extract when you already have a URL. Read-only HTTP. |
|
|
24
25
|
| `agentsearch_extract` | `url` (absolute URL, required), `formats` (string[], optional), `max_chars` (positive integer, optional) | Page extract via `POST /v1/extract`. **Direct mode only** — portal fails before any request. Use when you already have a URL. Read-only HTTP. |
|
|
26
|
+
| `agentsearch_render` | `url` (absolute http(s) URL, required); optional: `formats` (`markdown`\|`text`\|`html`\|`links`, default `["markdown"]`), `max_chars` (1–100000), `screenshot`, `screenshot_format` (`png`\|`jpeg`), `full_page`, `viewport` (`{width 320–1920, height 240–1600}`), `wait_until` (`domcontentloaded`\|`load`\|`networkidle`), `wait_for_selector`, `wait_ms` (0–1500), `block` (`image`\|`media`\|`font`\|`stylesheet`) | Renders a JavaScript-heavy page in headless Chromium via `POST /v1/render` and returns title, status, meta, and the rendered markdown/text/HTML/links (plus optional base64 screenshot). **Direct mode only** — the portal render endpoint isn't live yet, so portal fails before any request. Use when extract returns empty/partial content for an SPA; prefer extract for static pages. Read-only HTTP. |
|
|
25
27
|
|
|
26
|
-
On portal **HTTP 402**, the search tool returns a clear MCP error that **x402 payment is required** (or switch to `AGENTSEARCH_MODE=direct`). In portal mode, `agentsearch_extract`
|
|
28
|
+
On portal **HTTP 402**, the search tool returns a clear MCP error that **x402 payment is required** (or switch to `AGENTSEARCH_MODE=direct`). In portal mode, `agentsearch_extract` and `agentsearch_render` do not call the network; they return an MCP error telling you to switch to direct mode or use search.
|
|
29
|
+
|
|
30
|
+
For `agentsearch_render`, target-site failures (DNS/TLS errors, timeouts, bot walls, robots.txt) come back as a normal result whose JSON has a non-null `error` object (`code`, `message`, `retryable`); bad input (400), oversize body (413), rate limits (429) and backend faults (500) are MCP errors. The backend enforces a ~4.2 s render deadline.
|
|
27
31
|
|
|
28
32
|
---
|
|
29
33
|
|
|
@@ -52,7 +56,7 @@ npm install
|
|
|
52
56
|
npm run build
|
|
53
57
|
```
|
|
54
58
|
|
|
55
|
-
Scripts: `build` → `tsc`, `start` → `node dist/index.js`, `prepare` → runs build (for publish).
|
|
59
|
+
Scripts: `build` → `tsc`, `start` → `node dist/index.js`, `test` → build + `node --test test/*.mjs`, `prepare` → runs build (for publish).
|
|
56
60
|
|
|
57
61
|
Binary: `agentsearch-mcp` → `dist/index.js`
|
|
58
62
|
|
|
@@ -168,7 +172,7 @@ No paid promo — list the package so tools can discover it via registries and u
|
|
|
168
172
|
### npm
|
|
169
173
|
|
|
170
174
|
1. `npm login` (the `@agentsearchhq` org must allow the publisher)
|
|
171
|
-
2. Confirm `name` is `@agentsearchhq/agentsearch-mcp` and `version`
|
|
175
|
+
2. Confirm `name` is `@agentsearchhq/agentsearch-mcp` and `version` matches `manifest.json` / `server.json` (currently `1.1.0`) in `package.json` (`publishConfig.access` is `public`)
|
|
172
176
|
3. `npm publish` (ensure `prepare`/`build` succeed; no secrets in the tarball)
|
|
173
177
|
|
|
174
178
|
### MCP Registry
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP client for AgentSearch search
|
|
2
|
+
* HTTP client for AgentSearch search, extract, and render backends.
|
|
3
3
|
* Modes: direct (local/self-hosted) | portal (Pocket agent portal).
|
|
4
4
|
*/
|
|
5
5
|
export type AgentSearchMode = "direct" | "portal";
|
|
@@ -17,6 +17,27 @@ export interface ExtractRequest {
|
|
|
17
17
|
formats?: string[];
|
|
18
18
|
max_chars?: number;
|
|
19
19
|
}
|
|
20
|
+
export type RenderFormat = "markdown" | "text" | "html" | "links";
|
|
21
|
+
export type RenderBlockType = "image" | "media" | "font" | "stylesheet";
|
|
22
|
+
export type RenderWaitUntil = "domcontentloaded" | "load" | "networkidle";
|
|
23
|
+
/** Mirrors RenderRequest in https://agentsearchhq.com/specs/render-openapi.json */
|
|
24
|
+
export interface RenderRequest {
|
|
25
|
+
url: string;
|
|
26
|
+
formats?: RenderFormat[];
|
|
27
|
+
max_chars?: number;
|
|
28
|
+
screenshot?: boolean;
|
|
29
|
+
screenshot_format?: "png" | "jpeg";
|
|
30
|
+
full_page?: boolean;
|
|
31
|
+
viewport?: {
|
|
32
|
+
width?: number;
|
|
33
|
+
height?: number;
|
|
34
|
+
};
|
|
35
|
+
wait_until?: RenderWaitUntil;
|
|
36
|
+
wait_for_selector?: string | null;
|
|
37
|
+
wait_ms?: number;
|
|
38
|
+
block?: RenderBlockType[];
|
|
39
|
+
}
|
|
40
|
+
export declare const RENDER_PORTAL_UNSUPPORTED_MESSAGE = "agentsearch_render is only supported in AGENTSEARCH_MODE=direct (POST {BASE}/v1/render); the portal render endpoint is not live yet. Switch to direct mode, or use agentsearch_extract / agentsearch_web_search.";
|
|
20
41
|
export declare class AgentSearchHttpError extends Error {
|
|
21
42
|
readonly status: number;
|
|
22
43
|
readonly body: string;
|
|
@@ -26,4 +47,5 @@ export declare class AgentSearchHttpError extends Error {
|
|
|
26
47
|
export declare function loadConfig(): AgentSearchConfig;
|
|
27
48
|
export declare function webSearch(cfg: AgentSearchConfig, req: SearchRequest): Promise<unknown>;
|
|
28
49
|
export declare function extractPage(cfg: AgentSearchConfig, req: ExtractRequest): Promise<unknown>;
|
|
50
|
+
export declare function renderPage(cfg: AgentSearchConfig, req: RenderRequest): Promise<unknown>;
|
|
29
51
|
export declare function clampMaxResults(n: number | undefined, fallback?: number): number;
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP client for AgentSearch search
|
|
2
|
+
* HTTP client for AgentSearch search, extract, and render backends.
|
|
3
3
|
* Modes: direct (local/self-hosted) | portal (Pocket agent portal).
|
|
4
4
|
*/
|
|
5
|
+
export const RENDER_PORTAL_UNSUPPORTED_MESSAGE = "agentsearch_render is only supported in AGENTSEARCH_MODE=direct (POST {BASE}/v1/render); the portal render endpoint is not live yet. Switch to direct mode, or use agentsearch_extract / agentsearch_web_search.";
|
|
5
6
|
export class AgentSearchHttpError extends Error {
|
|
6
7
|
status;
|
|
7
8
|
body;
|
|
@@ -34,6 +35,9 @@ function extractUrl(cfg) {
|
|
|
34
35
|
// Extract is only defined for direct in this package; portal extract may differ.
|
|
35
36
|
return `${cfg.baseUrl}/v1/extract`;
|
|
36
37
|
}
|
|
38
|
+
function renderUrl(cfg) {
|
|
39
|
+
return `${cfg.baseUrl}/v1/render`;
|
|
40
|
+
}
|
|
37
41
|
async function postJson(url, body, apiKey, opts) {
|
|
38
42
|
const headers = {
|
|
39
43
|
"content-type": "application/json",
|
|
@@ -86,6 +90,32 @@ export async function extractPage(cfg, req) {
|
|
|
86
90
|
body.max_chars = req.max_chars;
|
|
87
91
|
return postJson(url, body, cfg.apiKey, { retryWithoutKeyOn401: true });
|
|
88
92
|
}
|
|
93
|
+
const RENDER_FIELDS = [
|
|
94
|
+
"formats",
|
|
95
|
+
"max_chars",
|
|
96
|
+
"screenshot",
|
|
97
|
+
"screenshot_format",
|
|
98
|
+
"full_page",
|
|
99
|
+
"viewport",
|
|
100
|
+
"wait_until",
|
|
101
|
+
"wait_for_selector",
|
|
102
|
+
"wait_ms",
|
|
103
|
+
"block",
|
|
104
|
+
];
|
|
105
|
+
export async function renderPage(cfg, req) {
|
|
106
|
+
if (cfg.mode === "portal") {
|
|
107
|
+
// Portal render endpoint is not live yet: fail before any network call.
|
|
108
|
+
throw new Error(RENDER_PORTAL_UNSUPPORTED_MESSAGE);
|
|
109
|
+
}
|
|
110
|
+
const body = { url: req.url };
|
|
111
|
+
for (const key of RENDER_FIELDS) {
|
|
112
|
+
if (req[key] !== undefined)
|
|
113
|
+
body[key] = req[key];
|
|
114
|
+
}
|
|
115
|
+
return postJson(renderUrl(cfg), body, cfg.apiKey, {
|
|
116
|
+
retryWithoutKeyOn401: true,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
89
119
|
export function clampMaxResults(n, fallback = 5) {
|
|
90
120
|
const v = typeof n === "number" && Number.isFinite(n) ? Math.trunc(n) : fallback;
|
|
91
121
|
return Math.min(10, Math.max(1, v));
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwCH,MAAM,CAAC,MAAM,iCAAiC,GAC5C,kNAAkN,CAAC;AAErN,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,MAAM,CAAS;IACf,IAAI,CAAS;IACb,eAAe,CAAU;IAElC,YAAY,MAAc,EAAE,IAAY;QACtC,MAAM,eAAe,GAAG,MAAM,KAAK,GAAG,CAAC;QACvC,KAAK,CACH,eAAe;YACb,CAAC,CAAC,4JAA4J;YAC9J,CAAC,CAAC,oBAAoB,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CACxD,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;CACF;AAED,MAAM,iBAAiB,GACrB,qEAAqE,CAAC;AAExE,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW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AG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE;QAChD,oBAAoB,EAAE,IAAI;KAC3B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,CAAqB,EAAE,QAAQ,GAAG,CAAC;IACjE,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACjF,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* AgentSearch MCP server — stdio transport.
|
|
4
|
-
* Tools: agentsearch_web_search, agentsearch_extract
|
|
4
|
+
* Tools: agentsearch_web_search, agentsearch_extract, agentsearch_render
|
|
5
5
|
*/
|
|
6
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
6
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
8
|
-
import { registerSearchTools } from "./tools/search.js";
|
|
9
7
|
import { loadConfig } from "./client.js";
|
|
8
|
+
import { createServer } from "./server.js";
|
|
10
9
|
async function main() {
|
|
11
10
|
const cfg = loadConfig();
|
|
12
|
-
const server =
|
|
13
|
-
name: "agentsearch-mcp",
|
|
14
|
-
version: "1.0.0",
|
|
15
|
-
});
|
|
16
|
-
registerSearchTools(server);
|
|
11
|
+
const server = createServer();
|
|
17
12
|
const transport = new StdioServerTransport();
|
|
18
13
|
await server.connect(transport);
|
|
19
14
|
// stdout is reserved for MCP JSON-RPC; log to stderr only
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,KAAK,UAAU,IAAI;IACjB,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,0DAA0D;IAC1D,OAAO,CAAC,KAAK,CACX,4CAA4C,GAAG,CAAC,IAAI,UAAU,GAAG,CAAC,OAAO,GAAG,CAC7E,CAAC;AACJ,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
ADDED
package/dist/server.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { registerSearchTools } from "./tools/search.js";
|
|
3
|
+
import { registerRenderTool } from "./tools/render.js";
|
|
4
|
+
import { SERVER_NAME, SERVER_VERSION } from "./version.js";
|
|
5
|
+
/** Build the MCP server with every AgentSearch tool registered (no transport). */
|
|
6
|
+
export function createServer() {
|
|
7
|
+
const server = new McpServer({
|
|
8
|
+
name: SERVER_NAME,
|
|
9
|
+
version: SERVER_VERSION,
|
|
10
|
+
});
|
|
11
|
+
registerSearchTools(server);
|
|
12
|
+
registerRenderTool(server);
|
|
13
|
+
return server;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE3D,kFAAkF;AAClF,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IACH,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { loadConfig, renderPage } from "../client.js";
|
|
3
|
+
import { errorContent, formatResult } from "./search.js";
|
|
4
|
+
export const RENDER_DESCRIPTION = [
|
|
5
|
+
"Render one absolute http(s) URL in headless Chromium through the AgentSearch Web Render API, so JavaScript runs before content is captured, and return the backend response as pretty-printed JSON text (a non-JSON body is wrapped as {raw: text}).",
|
|
6
|
+
"The response includes the final url, title, status_code, meta (render_ms, chars, truncated, js, lang …), warnings, error, and the rendered page body in each requested format: markdown (default), text, html, and/or links; plus an optional base64 screenshot.",
|
|
7
|
+
"Use this when the page is a JavaScript-heavy app (SPA, client-rendered docs or dashboards) where agentsearch_extract returns empty or partial content; for static pages prefer agentsearch_extract (cheaper and faster), and to find pages from a query use agentsearch_web_search.",
|
|
8
|
+
"Direct mode only: AGENTSEARCH_MODE=portal fails immediately with an MCP error telling you to switch to direct, and no HTTP request is sent (the portal render endpoint is not live yet); direct mode POSTs {AGENTSEARCH_BASE_URL}/v1/render.",
|
|
9
|
+
"Read-only: it loads the page like a browser visit and does not click, submit, or change anything, but it uses the network, has a hard backend deadline of about 4.2 s, and can hit rate limits (HTTP 429).",
|
|
10
|
+
"Target-site failures (DNS, TLS, timeouts, bot walls, robots.txt) come back as a normal result with a non-null error object {code, message, retryable} and empty or partial content; invalid input or a disallowed URL (HTTP 400), an oversized request (413), rate limits (429), and backend faults (500) are MCP errors with the status and a truncated body.",
|
|
11
|
+
"When AGENTSEARCH_API_KEY is set it is sent as a Bearer token, and HTTP 401 is retried once without the key.",
|
|
12
|
+
"Optional fields are forwarded unchanged to the API, which applies its own defaults and limits.",
|
|
13
|
+
].join(" ");
|
|
14
|
+
export function registerRenderTool(server) {
|
|
15
|
+
server.registerTool("agentsearch_render", {
|
|
16
|
+
title: "AgentSearch Web Render",
|
|
17
|
+
description: RENDER_DESCRIPTION,
|
|
18
|
+
annotations: {
|
|
19
|
+
title: "AgentSearch Web Render",
|
|
20
|
+
readOnlyHint: true,
|
|
21
|
+
destructiveHint: false,
|
|
22
|
+
idempotentHint: true,
|
|
23
|
+
openWorldHint: true,
|
|
24
|
+
},
|
|
25
|
+
inputSchema: {
|
|
26
|
+
url: z
|
|
27
|
+
.string()
|
|
28
|
+
.url()
|
|
29
|
+
.max(4096)
|
|
30
|
+
.describe("Absolute public http(s) URL to render (port 80/443)."),
|
|
31
|
+
formats: z
|
|
32
|
+
.array(z.enum(["markdown", "text", "html", "links"]))
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Output formats to return (default ["markdown"]). Add "html" for the rendered DOM, "text" for plain text, "links" for anchors.'),
|
|
35
|
+
max_chars: z
|
|
36
|
+
.number()
|
|
37
|
+
.int()
|
|
38
|
+
.min(1)
|
|
39
|
+
.max(100000)
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("Cap on returned characters per format (1–100000, API default 20000)."),
|
|
42
|
+
screenshot: z
|
|
43
|
+
.boolean()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Also capture a screenshot, returned as base64 (default false)."),
|
|
46
|
+
screenshot_format: z
|
|
47
|
+
.enum(["png", "jpeg"])
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Screenshot encoding (default png; PNG over 1 MB is re-encoded as JPEG)."),
|
|
50
|
+
full_page: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("Capture the full page height, clipped to 4000 px (default false)."),
|
|
54
|
+
viewport: z
|
|
55
|
+
.object({
|
|
56
|
+
width: z
|
|
57
|
+
.number()
|
|
58
|
+
.int()
|
|
59
|
+
.min(320)
|
|
60
|
+
.max(1920)
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Viewport width in px (320–1920, default 1280)."),
|
|
63
|
+
height: z
|
|
64
|
+
.number()
|
|
65
|
+
.int()
|
|
66
|
+
.min(240)
|
|
67
|
+
.max(1600)
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("Viewport height in px (240–1600, default 800)."),
|
|
70
|
+
})
|
|
71
|
+
.optional()
|
|
72
|
+
.describe("Browser viewport size."),
|
|
73
|
+
wait_until: z
|
|
74
|
+
.enum(["domcontentloaded", "load", "networkidle"])
|
|
75
|
+
.optional()
|
|
76
|
+
.describe("Navigation event to wait for before capture (default domcontentloaded)."),
|
|
77
|
+
wait_for_selector: z
|
|
78
|
+
.string()
|
|
79
|
+
.max(300)
|
|
80
|
+
.nullable()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe("CSS selector to wait for (at most 1.5 s) before capture."),
|
|
83
|
+
wait_ms: z
|
|
84
|
+
.number()
|
|
85
|
+
.int()
|
|
86
|
+
.min(0)
|
|
87
|
+
.max(1500)
|
|
88
|
+
.optional()
|
|
89
|
+
.describe("Extra fixed wait in ms after load (0–1500, default 0)."),
|
|
90
|
+
block: z
|
|
91
|
+
.array(z.enum(["image", "media", "font", "stylesheet"]))
|
|
92
|
+
.optional()
|
|
93
|
+
.describe('Resource types to block while rendering (default ["media","font"]).'),
|
|
94
|
+
},
|
|
95
|
+
}, async (args) => {
|
|
96
|
+
try {
|
|
97
|
+
const cfg = loadConfig();
|
|
98
|
+
const data = await renderPage(cfg, args);
|
|
99
|
+
return {
|
|
100
|
+
content: [{ type: "text", text: formatResult(data) }],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
return errorContent(err);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/tools/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,sPAAsP;IACtP,kQAAkQ;IAClQ,qRAAqR;IACrR,8OAA8O;IAC9O,4MAA4M;IAC5M,gWAAgW;IAChW,6GAA6G;IAC7G,gGAAgG;CACjG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE;YACX,KAAK,EAAE,wBAAwB;YAC/B,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,IAAI;SACpB;QACD,WAAW,EAAE;YACX,GAAG,EAAE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AC,wBAAwB,CAAC;YACrC,UAAU,EAAE,CAAC;iBACV,IAAI,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;iBACjD,QAAQ,EAAE;iBACV,QAAQ,CAAC,yEAAyE,CAAC;YACtF,iBAAiB,EAAE,CAAC;iBACjB,MAAM,EAAE;iBACR,GAAG,CAAC,GAAG,CAAC;iBACR,QAAQ,EAAE;iBACV,QAAQ,EAAE;iBACV,QAAQ,CAAC,0DAA0D,CAAC;YACvE,OAAO,EAAE,CAAC;iBACP,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,GAAG,CAAC,CAAC,CAAC;iBACN,GAAG,CAAC,IAAI,CAAC;iBACT,QAAQ,EAAE;iBACV,QAAQ,CAAC,wDAAwD,CAAC;YACrE,KAAK,EAAE,CAAC;iBACL,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;iBACvD,QAAQ,EAAE;iBACV,QAAQ,CAAC,qEAAqE,CAAC;SACnF;KACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACzC,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;aAC/D,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/search.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
export declare function formatResult(data: unknown): string;
|
|
3
|
+
export declare function errorContent(err: unknown): {
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
isError: true;
|
|
9
|
+
};
|
|
2
10
|
export declare function registerSearchTools(server: McpServer): void;
|
package/dist/tools/search.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AgentSearchHttpError, clampMaxResults, loadConfig, webSearch, extractPage, } from "../client.js";
|
|
3
|
-
function formatResult(data) {
|
|
3
|
+
export function formatResult(data) {
|
|
4
4
|
try {
|
|
5
5
|
return JSON.stringify(data, null, 2);
|
|
6
6
|
}
|
|
@@ -8,7 +8,7 @@ function formatResult(data) {
|
|
|
8
8
|
return String(data);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function errorContent(err) {
|
|
11
|
+
export function errorContent(err) {
|
|
12
12
|
let text;
|
|
13
13
|
if (err instanceof AgentSearchHttpError) {
|
|
14
14
|
text = err.message;
|
|
@@ -26,7 +26,7 @@ function errorContent(err) {
|
|
|
26
26
|
}
|
|
27
27
|
const WEB_SEARCH_DESCRIPTION = [
|
|
28
28
|
"Search the web through AgentSearch and return the backend response as pretty-printed JSON text (a non-JSON body is wrapped as {raw: text}).",
|
|
29
|
-
"Use this when you have a query and need hits rather than a page body; if you already have a URL, use agentsearch_extract instead.",
|
|
29
|
+
"Use this when you have a query and need hits rather than a page body; if you already have a URL, use agentsearch_extract instead (or agentsearch_render for JavaScript-heavy pages).",
|
|
30
30
|
"Works in AGENTSEARCH_MODE=direct (default; POST {AGENTSEARCH_BASE_URL}/v1/search) or portal (Pocket).",
|
|
31
31
|
"Read-only HTTP POST: not destructive, but it uses the network and can hit backend rate limits.",
|
|
32
32
|
"Direct mode sends a Bearer token from AGENTSEARCH_API_KEY when that variable is set, and retries once without the key on HTTP 401; portal ignores the key, and HTTP 402 is an MCP error that x402 payment is required (or switch to direct).",
|
|
@@ -35,7 +35,7 @@ const WEB_SEARCH_DESCRIPTION = [
|
|
|
35
35
|
].join(" ");
|
|
36
36
|
const EXTRACT_DESCRIPTION = [
|
|
37
37
|
"Extract the content of one absolute URL through AgentSearch and return the backend response as pretty-printed JSON text (a non-JSON body is wrapped as {raw: text}).",
|
|
38
|
-
"Use this only when you already have the page URL and need its body; to find pages from a query, use agentsearch_web_search instead.",
|
|
38
|
+
"Use this only when you already have the page URL and need its body; to find pages from a query, use agentsearch_web_search instead; if the page is a JavaScript app whose content only appears after scripts run, use agentsearch_render.",
|
|
39
39
|
"Direct mode only: AGENTSEARCH_MODE=portal fails immediately with an MCP error telling you to switch to direct or call search, and no HTTP request is sent; direct mode POSTs {AGENTSEARCH_BASE_URL}/v1/extract.",
|
|
40
40
|
"Read-only HTTP POST: not destructive, but it fetches through AgentSearch and can hit network or backend rate limits.",
|
|
41
41
|
"When AGENTSEARCH_API_KEY is set it is sent as a Bearer token, and HTTP 401 is retried once without the key; HTTP 402 is an MCP error that x402 payment is required (or switch to direct), and any other HTTP failure includes the status and a truncated body.",
|
package/dist/tools/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,SAAS,EACT,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,SAAS,EACT,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,IAAI,CAAC;QACH,OAAO,IAAI,CAA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YACzB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;YACjE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC;qBACzB;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAC7C,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC"}
|
package/manifest.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "agentsearch-mcp",
|
|
4
4
|
"display_name": "AgentSearch MCP",
|
|
5
|
-
"version": "1.
|
|
6
|
-
"description": "MCP server for AgentSearch web search and
|
|
7
|
-
"long_description": "Stdio MCP server that calls AgentSearch web search and, in direct mode, URL extract. Configure AGENTSEARCH_MODE (direct or portal), AGENTSEARCH_BASE_URL, and an optional AGENTSEARCH_API_KEY.",
|
|
5
|
+
"version": "1.1.0",
|
|
6
|
+
"description": "MCP server for AgentSearch web search, page extract, and JavaScript page rendering in headless Chromium (direct API or Pocket portal).",
|
|
7
|
+
"long_description": "Stdio MCP server that calls AgentSearch web search and, in direct mode, URL extract and Web Render (headless Chromium for JavaScript-heavy pages, returning title plus rendered markdown, text, HTML, links and an optional screenshot). Configure AGENTSEARCH_MODE (direct or portal), AGENTSEARCH_BASE_URL, and an optional AGENTSEARCH_API_KEY.",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "AgentSearch",
|
|
10
10
|
"url": "https://github.com/agentsearchhq-coder"
|
|
@@ -21,10 +21,17 @@
|
|
|
21
21
|
"mcp",
|
|
22
22
|
"agentsearch",
|
|
23
23
|
"web-search",
|
|
24
|
-
"pocket-network"
|
|
24
|
+
"pocket-network",
|
|
25
|
+
"render",
|
|
26
|
+
"headless-browser",
|
|
27
|
+
"javascript-rendering"
|
|
25
28
|
],
|
|
26
29
|
"compatibility": {
|
|
27
|
-
"platforms": [
|
|
30
|
+
"platforms": [
|
|
31
|
+
"darwin",
|
|
32
|
+
"win32",
|
|
33
|
+
"linux"
|
|
34
|
+
],
|
|
28
35
|
"runtimes": {
|
|
29
36
|
"node": ">=20"
|
|
30
37
|
}
|
|
@@ -34,7 +41,9 @@
|
|
|
34
41
|
"entry_point": "dist/index.js",
|
|
35
42
|
"mcp_config": {
|
|
36
43
|
"command": "node",
|
|
37
|
-
"args": [
|
|
44
|
+
"args": [
|
|
45
|
+
"${__dirname}/dist/index.js"
|
|
46
|
+
],
|
|
38
47
|
"env": {
|
|
39
48
|
"AGENTSEARCH_MODE": "${user_config.AGENTSEARCH_MODE}",
|
|
40
49
|
"AGENTSEARCH_BASE_URL": "${user_config.AGENTSEARCH_BASE_URL}",
|
|
@@ -50,6 +59,10 @@
|
|
|
50
59
|
{
|
|
51
60
|
"name": "agentsearch_extract",
|
|
52
61
|
"description": "Extract one page from a URL (direct mode only). Use web search to find URLs. Read-only; returns JSON text."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "agentsearch_render",
|
|
65
|
+
"description": "Render one URL in headless Chromium (direct mode only) and return title plus rendered markdown/text/HTML/links as JSON text. Use for JavaScript-heavy pages where extract comes back empty; prefer extract for static pages. Read-only."
|
|
53
66
|
}
|
|
54
67
|
],
|
|
55
68
|
"user_config": {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentsearchhq/agentsearch-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"mcpName": "io.github.agentsearchhq-coder/agentsearch-mcp",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"description": "MCP server for AgentSearch web search
|
|
8
|
+
"description": "MCP server for AgentSearch web search, page extract and JavaScript rendering (headless browser) — direct or Pocket portal",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"bin": {
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
28
|
"mcpb:validate": "mcpb validate manifest.json",
|
|
29
29
|
"mcpb:pack": "npm run build && node scripts/pack-mcpb.mjs",
|
|
30
|
-
"smithery:publish": "node scripts/publish-smithery.mjs"
|
|
30
|
+
"smithery:publish": "node scripts/publish-smithery.mjs",
|
|
31
|
+
"test": "npm run build && node --test \"test/*.mjs\""
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
33
34
|
"node": ">=20"
|
|
@@ -37,7 +38,10 @@
|
|
|
37
38
|
"model-context-protocol",
|
|
38
39
|
"agentsearch",
|
|
39
40
|
"web-search",
|
|
40
|
-
"pocket-network"
|
|
41
|
+
"pocket-network",
|
|
42
|
+
"render",
|
|
43
|
+
"headless-browser",
|
|
44
|
+
"javascript-rendering"
|
|
41
45
|
],
|
|
42
46
|
"license": "MIT",
|
|
43
47
|
"dependencies": {
|
package/server.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
3
|
"name": "io.github.agentsearchhq-coder/agentsearch-mcp",
|
|
4
|
-
"description": "AgentSearch web search
|
|
4
|
+
"description": "AgentSearch web search, page extract and JS rendering (headless Chromium) via MCP stdio.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/agentsearchhq-coder/agentsearch-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.1.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@agentsearchhq/agentsearch-mcp",
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.1.0",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|