@agentsearchhq/agentsearch-mcp 1.0.0 → 1.1.1
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/.env.example +5 -14
- package/README.md +35 -102
- package/dist/client.d.ts +25 -5
- package/dist/client.js +40 -29
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -10
- 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 +13 -13
- 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 +24 -21
- package/package.json +7 -4
- package/server.json +8 -12
- package/smithery.yaml +6 -11
package/.env.example
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
# AgentSearch MCP configuration
|
|
2
|
-
# Copy to .env for local testing (never commit .env)
|
|
2
|
+
# Copy to .env for local testing (never commit .env).
|
|
3
|
+
# This server talks only to an AgentSearch-compatible API you run yourself.
|
|
3
4
|
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
AGENTSEARCH_MODE=direct
|
|
5
|
+
# Required. Base URL of that API, with no trailing slash. There is no default.
|
|
6
|
+
AGENTSEARCH_BASE_URL=
|
|
7
7
|
|
|
8
|
-
#
|
|
9
|
-
# Default: http://127.0.0.1:8000
|
|
10
|
-
AGENTSEARCH_BASE_URL=http://127.0.0.1:8000
|
|
11
|
-
|
|
12
|
-
# Optional Bearer token for direct mode Authorization header
|
|
13
|
-
# If the server returns 401 with the key, the client retries once without it
|
|
8
|
+
# Optional Bearer token. If the API returns 401 with the key, the client retries once without it.
|
|
14
9
|
AGENTSEARCH_API_KEY=
|
|
15
|
-
|
|
16
|
-
# Portal reference (used when AGENTSEARCH_MODE=portal):
|
|
17
|
-
# POST https://agent.pocket.network/v1/agentsearch-web-search-v1/v1/search
|
|
18
|
-
# body: {"query":"...","max_results":5}
|
package/README.md
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
# agentsearch-mcp
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) server
|
|
3
|
+
MCP (Model Context Protocol) server for people running their own [AgentSearch](https://agentsearchhq.com/?utm_source=github&utm_medium=readme&utm_campaign=mcp)-compatible backend. It exposes web search, page extract, and JavaScript page rendering (headless browser) to Cursor, Claude Desktop, and other MCP hosts over **stdio**.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`AGENTSEARCH_BASE_URL` is required and points at that API. There is no built-in default host.
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
`POST https://agent.pocket.network/v1/agentsearch-web-search-v1/v1/search`
|
|
9
|
-
body: `{ "query": "...", "max_results": 5 }`
|
|
10
|
-
- Direct search: `POST {AGENTSEARCH_BASE_URL}/v1/search` with the same body
|
|
11
|
-
- Direct extract: `POST {AGENTSEARCH_BASE_URL}/v1/extract`
|
|
7
|
+
For pay-per-call access with no backend of your own, use Pocket's official MCP server instead:
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npx -y @pocket-network/agentic-portal-mcp
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That server calls `agentsearch-web-search-v1` and `agentsearch-web-extract-v1` at $0.005/call over x402. Details: https://agentsearchhq.com/?utm_source=github&utm_medium=readme&utm_campaign=mcp
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
This package calls your API directly:
|
|
16
|
+
|
|
17
|
+
- Search: `POST {AGENTSEARCH_BASE_URL}/v1/search` with body `{ "query": "...", "max_results": 5 }`
|
|
18
|
+
- Extract: `POST {AGENTSEARCH_BASE_URL}/v1/extract`
|
|
19
|
+
- Render: `POST {AGENTSEARCH_BASE_URL}/v1/render` (headless Chromium; [OpenAPI spec](https://agentsearchhq.com/specs/render-openapi.json))
|
|
16
20
|
|
|
17
21
|
---
|
|
18
22
|
|
|
@@ -20,23 +24,22 @@ Pocket explorer: [agentsearch-web-search-v1](https://explorer.pocket.network/ser
|
|
|
20
24
|
|
|
21
25
|
| Tool | Args | Description |
|
|
22
26
|
|------|------|-------------|
|
|
23
|
-
| `agentsearch_web_search` | `query` (string, required), `max_results` (number, optional, default 5, clamped 1–
|
|
24
|
-
| `agentsearch_extract` | `url` (absolute URL, required), `formats` (string[], optional), `max_chars` (positive integer, optional) | Page extract via `POST /v1/extract`.
|
|
27
|
+
| `agentsearch_web_search` | `query` (string, required), `max_results` (number, optional, default 5, clamped 1–5) | Web search. Returns pretty-printed JSON. Use for a query; use extract when you already have a URL. Read-only HTTP. |
|
|
28
|
+
| `agentsearch_extract` | `url` (absolute URL, required), `formats` (string[], optional), `max_chars` (positive integer, optional) | Page extract via `POST /v1/extract`. Use when you already have a URL. Read-only HTTP. |
|
|
29
|
+
| `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). Use when extract returns empty/partial content for an SPA; prefer extract for static pages. Read-only HTTP. |
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
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
32
|
|
|
28
33
|
---
|
|
29
34
|
|
|
30
35
|
## Requirements
|
|
31
36
|
|
|
32
37
|
- Node.js **20+**
|
|
33
|
-
-
|
|
38
|
+
- Your own AgentSearch-compatible API. Set `AGENTSEARCH_BASE_URL` to its base URL. The process exits at startup if that variable is missing.
|
|
34
39
|
|
|
35
40
|
---
|
|
36
41
|
|
|
37
|
-
## Install
|
|
38
|
-
|
|
39
|
-
Published package:
|
|
42
|
+
## Install
|
|
40
43
|
|
|
41
44
|
```bash
|
|
42
45
|
npx -y @agentsearchhq/agentsearch-mcp
|
|
@@ -52,7 +55,7 @@ npm install
|
|
|
52
55
|
npm run build
|
|
53
56
|
```
|
|
54
57
|
|
|
55
|
-
Scripts: `build` → `tsc`, `start` → `node dist/index.js`, `prepare` → runs build
|
|
58
|
+
Scripts: `build` → `tsc`, `start` → `node dist/index.js`, `test` → build + `node --test test/*.mjs`, `prepare` → runs build.
|
|
56
59
|
|
|
57
60
|
Binary: `agentsearch-mcp` → `dist/index.js`
|
|
58
61
|
|
|
@@ -60,39 +63,19 @@ Binary: `agentsearch-mcp` → `dist/index.js`
|
|
|
60
63
|
|
|
61
64
|
## Environment variables
|
|
62
65
|
|
|
63
|
-
| Variable |
|
|
64
|
-
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `AGENTSEARCH_API_KEY` | _(empty)_ | Optional `Authorization: Bearer …` for direct; on **401** the client retries once **without** the key |
|
|
66
|
+
| Variable | Required | Notes |
|
|
67
|
+
|----------|----------|--------|
|
|
68
|
+
| `AGENTSEARCH_BASE_URL` | yes | Base URL of your API (no trailing slash). No default. |
|
|
69
|
+
| `AGENTSEARCH_API_KEY` | no | Optional `Authorization: Bearer …`. On **401** the client retries once **without** the key. |
|
|
68
70
|
|
|
69
71
|
See `.env.example`. Never commit a real `.env`.
|
|
70
72
|
|
|
71
73
|
---
|
|
72
74
|
|
|
73
|
-
## Cursor
|
|
75
|
+
## Cursor
|
|
74
76
|
|
|
75
77
|
**Project** (`.cursor/mcp.json`) or **user** (`~/.cursor/mcp.json` / Cursor Settings → MCP):
|
|
76
78
|
|
|
77
|
-
```json
|
|
78
|
-
{
|
|
79
|
-
"mcpServers": {
|
|
80
|
-
"agentsearch": {
|
|
81
|
-
"command": "node",
|
|
82
|
-
"args": [
|
|
83
|
-
"C:/Users/Holla/OneDrive/Desktop/AgentSearch/agentsearch-mcp/dist/index.js"
|
|
84
|
-
],
|
|
85
|
-
"env": {
|
|
86
|
-
"AGENTSEARCH_MODE": "direct",
|
|
87
|
-
"AGENTSEARCH_BASE_URL": "http://127.0.0.1:8000"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
After `npm install && npm run build`, optionally use the bin:
|
|
95
|
-
|
|
96
79
|
```json
|
|
97
80
|
{
|
|
98
81
|
"mcpServers": {
|
|
@@ -100,22 +83,18 @@ After `npm install && npm run build`, optionally use the bin:
|
|
|
100
83
|
"command": "npx",
|
|
101
84
|
"args": ["-y", "@agentsearchhq/agentsearch-mcp"],
|
|
102
85
|
"env": {
|
|
103
|
-
"
|
|
104
|
-
"AGENTSEARCH_BASE_URL": "http://127.0.0.1:8000"
|
|
86
|
+
"AGENTSEARCH_BASE_URL": "https://your-agentsearch-host.example"
|
|
105
87
|
}
|
|
106
88
|
}
|
|
107
89
|
}
|
|
108
90
|
}
|
|
109
91
|
```
|
|
110
92
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Optional API key (direct only):
|
|
93
|
+
Optional API key:
|
|
114
94
|
|
|
115
95
|
```json
|
|
116
96
|
"env": {
|
|
117
|
-
"
|
|
118
|
-
"AGENTSEARCH_BASE_URL": "http://127.0.0.1:8000",
|
|
97
|
+
"AGENTSEARCH_BASE_URL": "https://your-agentsearch-host.example",
|
|
119
98
|
"AGENTSEARCH_API_KEY": "your-key-here"
|
|
120
99
|
}
|
|
121
100
|
```
|
|
@@ -133,13 +112,10 @@ Edit Claude Desktop config (`claude_desktop_config.json`):
|
|
|
133
112
|
{
|
|
134
113
|
"mcpServers": {
|
|
135
114
|
"agentsearch": {
|
|
136
|
-
"command": "
|
|
137
|
-
"args": [
|
|
138
|
-
"C:/Users/Holla/OneDrive/Desktop/AgentSearch/agentsearch-mcp/dist/index.js"
|
|
139
|
-
],
|
|
115
|
+
"command": "npx",
|
|
116
|
+
"args": ["-y", "@agentsearchhq/agentsearch-mcp"],
|
|
140
117
|
"env": {
|
|
141
|
-
"
|
|
142
|
-
"AGENTSEARCH_BASE_URL": "http://127.0.0.1:8000"
|
|
118
|
+
"AGENTSEARCH_BASE_URL": "https://your-agentsearch-host.example"
|
|
143
119
|
}
|
|
144
120
|
}
|
|
145
121
|
}
|
|
@@ -150,58 +126,15 @@ Restart Claude Desktop after saving.
|
|
|
150
126
|
|
|
151
127
|
---
|
|
152
128
|
|
|
153
|
-
## Local run
|
|
129
|
+
## Local run
|
|
154
130
|
|
|
155
131
|
```bash
|
|
156
132
|
npm run build
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
# (process waits on stdin — Ctrl+C to stop)
|
|
133
|
+
AGENTSEARCH_BASE_URL=https://your-agentsearch-host.example node dist/index.js
|
|
134
|
+
# process waits on stdin — Ctrl+C to stop
|
|
160
135
|
```
|
|
161
136
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
## Publish (high level)
|
|
165
|
-
|
|
166
|
-
No paid promo — list the package so tools can discover it via registries and usage.
|
|
167
|
-
|
|
168
|
-
### npm
|
|
169
|
-
|
|
170
|
-
1. `npm login` (the `@agentsearchhq` org must allow the publisher)
|
|
171
|
-
2. Confirm `name` is `@agentsearchhq/agentsearch-mcp` and `version` is `1.0.0` in `package.json` (`publishConfig.access` is `public`)
|
|
172
|
-
3. `npm publish` (ensure `prepare`/`build` succeed; no secrets in the tarball)
|
|
173
|
-
|
|
174
|
-
### MCP Registry
|
|
175
|
-
|
|
176
|
-
1. Ensure `server.json` matches your npm package + stdio transport
|
|
177
|
-
2. Follow the [MCP Registry](https://github.com/modelcontextprotocol/registry) publish flow (authenticate publisher, submit server metadata)
|
|
178
|
-
3. Verify the listing resolves `@agentsearchhq/agentsearch-mcp` / stdio
|
|
179
|
-
|
|
180
|
-
### Smithery
|
|
181
|
-
|
|
182
|
-
Publish with the durable helper (preferred):
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
npm run smithery:publish
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
That runs `scripts/publish-smithery.mjs`, which ensures `agentsearch-mcp.mcpb` exists (`npm run mcpb:pack` if missing), idempotently patches the global Smithery CLI so the deploy payload always includes a tool `inputSchema` object when the MCPB omitted it, then runs `smithery mcp publish ./agentsearch-mcp.mcpb -n agentsearchhq/agentsearch-mcp`.
|
|
189
|
-
|
|
190
|
-
**MCPB note:** `manifest.json` must **omit** tool `inputSchema` — `mcpb validate` rejects it. The publish helper patches the CLI payload side instead.
|
|
191
|
-
|
|
192
|
-
Manual equivalent (after CLI is patched):
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
npm run mcpb:pack
|
|
196
|
-
smithery mcp publish ./agentsearch-mcp.mcpb -n agentsearchhq/agentsearch-mcp
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
`npm run mcpb:pack` compiles TypeScript to `dist/index.js`, installs production dependencies, then writes `agentsearch-mcp.mcpb`. Check the manifest with `npm run mcpb:validate`. `manifest.json` (MCPB 0.3) launches `node ${__dirname}/dist/index.js` and maps optional `AGENTSEARCH_MODE` (default `direct`), `AGENTSEARCH_BASE_URL` (default `http://127.0.0.1:8000`), and sensitive `AGENTSEARCH_API_KEY`. `smithery.yaml` remains as start-command metadata. Dry-run patch detection only: `node scripts/publish-smithery.mjs --dry-patch`.
|
|
200
|
-
|
|
201
|
-
### Glama
|
|
202
|
-
|
|
203
|
-
1. Submit the GitHub (or npm) package to [Glama](https://glama.ai) MCP directory
|
|
204
|
-
2. Link README + tools list; keep env docs in sync
|
|
137
|
+
If `AGENTSEARCH_BASE_URL` is unset, the process prints an error and exits.
|
|
205
138
|
|
|
206
139
|
---
|
|
207
140
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP client for
|
|
3
|
-
*
|
|
2
|
+
* HTTP client for a self-hosted AgentSearch-compatible API
|
|
3
|
+
* (search, extract, and render).
|
|
4
4
|
*/
|
|
5
|
-
export type AgentSearchMode = "direct" | "portal";
|
|
6
5
|
export interface AgentSearchConfig {
|
|
7
|
-
mode: AgentSearchMode;
|
|
8
6
|
baseUrl: string;
|
|
9
7
|
apiKey?: string;
|
|
10
8
|
}
|
|
@@ -17,13 +15,35 @@ export interface ExtractRequest {
|
|
|
17
15
|
formats?: string[];
|
|
18
16
|
max_chars?: number;
|
|
19
17
|
}
|
|
18
|
+
export type RenderFormat = "markdown" | "text" | "html" | "links";
|
|
19
|
+
export type RenderBlockType = "image" | "media" | "font" | "stylesheet";
|
|
20
|
+
export type RenderWaitUntil = "domcontentloaded" | "load" | "networkidle";
|
|
21
|
+
/** Mirrors RenderRequest in https://agentsearchhq.com/specs/render-openapi.json */
|
|
22
|
+
export interface RenderRequest {
|
|
23
|
+
url: string;
|
|
24
|
+
formats?: RenderFormat[];
|
|
25
|
+
max_chars?: number;
|
|
26
|
+
screenshot?: boolean;
|
|
27
|
+
screenshot_format?: "png" | "jpeg";
|
|
28
|
+
full_page?: boolean;
|
|
29
|
+
viewport?: {
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
};
|
|
33
|
+
wait_until?: RenderWaitUntil;
|
|
34
|
+
wait_for_selector?: string | null;
|
|
35
|
+
wait_ms?: number;
|
|
36
|
+
block?: RenderBlockType[];
|
|
37
|
+
}
|
|
38
|
+
export declare const MISSING_BASE_URL_MESSAGE = "AGENTSEARCH_BASE_URL is required. Set it to the base URL of your self-hosted AgentSearch-compatible API (no trailing slash). This package does not call the Pocket portal.";
|
|
20
39
|
export declare class AgentSearchHttpError extends Error {
|
|
21
40
|
readonly status: number;
|
|
22
41
|
readonly body: string;
|
|
23
|
-
readonly paymentRequired: boolean;
|
|
24
42
|
constructor(status: number, body: string);
|
|
25
43
|
}
|
|
26
44
|
export declare function loadConfig(): AgentSearchConfig;
|
|
27
45
|
export declare function webSearch(cfg: AgentSearchConfig, req: SearchRequest): Promise<unknown>;
|
|
28
46
|
export declare function extractPage(cfg: AgentSearchConfig, req: ExtractRequest): Promise<unknown>;
|
|
47
|
+
export declare function renderPage(cfg: AgentSearchConfig, req: RenderRequest): Promise<unknown>;
|
|
48
|
+
/** Backend allows at most 5 hits. Values outside 1–5 are clamped; default is 5. */
|
|
29
49
|
export declare function clampMaxResults(n: number | undefined, fallback?: number): number;
|
package/dist/client.js
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HTTP client for
|
|
3
|
-
*
|
|
2
|
+
* HTTP client for a self-hosted AgentSearch-compatible API
|
|
3
|
+
* (search, extract, and render).
|
|
4
4
|
*/
|
|
5
|
+
export const MISSING_BASE_URL_MESSAGE = "AGENTSEARCH_BASE_URL is required. Set it to the base URL of your self-hosted AgentSearch-compatible API (no trailing slash). This package does not call the Pocket portal.";
|
|
5
6
|
export class AgentSearchHttpError extends Error {
|
|
6
7
|
status;
|
|
7
8
|
body;
|
|
8
|
-
paymentRequired;
|
|
9
9
|
constructor(status, body) {
|
|
10
|
-
|
|
11
|
-
super(paymentRequired
|
|
12
|
-
? `AgentSearch portal returned 402 Payment Required (x402). Use AGENTSEARCH_MODE=direct with a local/self-hosted AgentSearch API, or complete portal payment.`
|
|
13
|
-
: `AgentSearch HTTP ${status}: ${body.slice(0, 500)}`);
|
|
10
|
+
super(`AgentSearch HTTP ${status}: ${body.slice(0, 500)}`);
|
|
14
11
|
this.name = "AgentSearchHttpError";
|
|
15
12
|
this.status = status;
|
|
16
13
|
this.body = body;
|
|
17
|
-
this.paymentRequired = paymentRequired;
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
|
-
const PORTAL_SEARCH_URL = "https://agent.pocket.network/v1/agentsearch-web-search-v1/v1/search";
|
|
21
16
|
export function loadConfig() {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
17
|
+
const raw = process.env.AGENTSEARCH_BASE_URL?.trim() ?? "";
|
|
18
|
+
const baseUrl = raw.replace(/\/+$/, "");
|
|
19
|
+
if (!baseUrl) {
|
|
20
|
+
throw new Error(MISSING_BASE_URL_MESSAGE);
|
|
21
|
+
}
|
|
25
22
|
const apiKey = process.env.AGENTSEARCH_API_KEY?.trim() || undefined;
|
|
26
|
-
return {
|
|
23
|
+
return { baseUrl, apiKey };
|
|
27
24
|
}
|
|
28
25
|
function searchUrl(cfg) {
|
|
29
|
-
if (cfg.mode === "portal")
|
|
30
|
-
return PORTAL_SEARCH_URL;
|
|
31
26
|
return `${cfg.baseUrl}/v1/search`;
|
|
32
27
|
}
|
|
33
28
|
function extractUrl(cfg) {
|
|
34
|
-
// Extract is only defined for direct in this package; portal extract may differ.
|
|
35
29
|
return `${cfg.baseUrl}/v1/extract`;
|
|
36
30
|
}
|
|
31
|
+
function renderUrl(cfg) {
|
|
32
|
+
return `${cfg.baseUrl}/v1/render`;
|
|
33
|
+
}
|
|
37
34
|
async function postJson(url, body, apiKey, opts) {
|
|
38
35
|
const headers = {
|
|
39
36
|
"content-type": "application/json",
|
|
@@ -51,12 +48,9 @@ async function postJson(url, body, apiKey, opts) {
|
|
|
51
48
|
if (res.status === 401 &&
|
|
52
49
|
apiKey &&
|
|
53
50
|
opts?.retryWithoutKeyOn401 !== false) {
|
|
54
|
-
//
|
|
51
|
+
// Some deployments reject a present key; retry once without it.
|
|
55
52
|
return postJson(url, body, undefined, { retryWithoutKeyOn401: false });
|
|
56
53
|
}
|
|
57
|
-
if (res.status === 402) {
|
|
58
|
-
throw new AgentSearchHttpError(402, text);
|
|
59
|
-
}
|
|
60
54
|
if (!res.ok) {
|
|
61
55
|
throw new AgentSearchHttpError(res.status, text || res.statusText);
|
|
62
56
|
}
|
|
@@ -70,24 +64,41 @@ async function postJson(url, body, apiKey, opts) {
|
|
|
70
64
|
}
|
|
71
65
|
}
|
|
72
66
|
export async function webSearch(cfg, req) {
|
|
73
|
-
|
|
74
|
-
const key = cfg.mode === "direct" ? cfg.apiKey : undefined;
|
|
75
|
-
return postJson(url, { query: req.query, max_results: req.max_results }, key, { retryWithoutKeyOn401: cfg.mode === "direct" });
|
|
67
|
+
return postJson(searchUrl(cfg), { query: req.query, max_results: req.max_results }, cfg.apiKey, { retryWithoutKeyOn401: true });
|
|
76
68
|
}
|
|
77
69
|
export async function extractPage(cfg, req) {
|
|
78
|
-
if (cfg.mode === "portal") {
|
|
79
|
-
throw new Error("agentsearch_extract is only supported in AGENTSEARCH_MODE=direct (POST {BASE}/v1/extract). Switch to direct mode or call search only.");
|
|
80
|
-
}
|
|
81
|
-
const url = extractUrl(cfg);
|
|
82
70
|
const body = { url: req.url };
|
|
83
71
|
if (req.formats)
|
|
84
72
|
body.formats = req.formats;
|
|
85
73
|
if (req.max_chars !== undefined)
|
|
86
74
|
body.max_chars = req.max_chars;
|
|
87
|
-
return postJson(
|
|
75
|
+
return postJson(extractUrl(cfg), body, cfg.apiKey, { retryWithoutKeyOn401: true });
|
|
76
|
+
}
|
|
77
|
+
const RENDER_FIELDS = [
|
|
78
|
+
"formats",
|
|
79
|
+
"max_chars",
|
|
80
|
+
"screenshot",
|
|
81
|
+
"screenshot_format",
|
|
82
|
+
"full_page",
|
|
83
|
+
"viewport",
|
|
84
|
+
"wait_until",
|
|
85
|
+
"wait_for_selector",
|
|
86
|
+
"wait_ms",
|
|
87
|
+
"block",
|
|
88
|
+
];
|
|
89
|
+
export async function renderPage(cfg, req) {
|
|
90
|
+
const body = { url: req.url };
|
|
91
|
+
for (const key of RENDER_FIELDS) {
|
|
92
|
+
if (req[key] !== undefined)
|
|
93
|
+
body[key] = req[key];
|
|
94
|
+
}
|
|
95
|
+
return postJson(renderUrl(cfg), body, cfg.apiKey, {
|
|
96
|
+
retryWithoutKeyOn401: true,
|
|
97
|
+
});
|
|
88
98
|
}
|
|
99
|
+
/** Backend allows at most 5 hits. Values outside 1–5 are clamped; default is 5. */
|
|
89
100
|
export function clampMaxResults(n, fallback = 5) {
|
|
90
101
|
const v = typeof n === "number" && Number.isFinite(n) ? Math.trunc(n) : fallback;
|
|
91
|
-
return Math.min(
|
|
102
|
+
return Math.min(5, Math.max(1, v));
|
|
92
103
|
}
|
|
93
104
|
//# sourceMappingURL=client.js.map
|
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;AAqCH,MAAM,CAAC,MAAM,wBAAwB,GACnC,4KAA4K,CAAC;AAE/K,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,MAAM,CAAS;IACf,IAAI,CAAS;IAEtB,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,oBAAoB,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC3D,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;I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CAC9B,GAAsB,EACtB,GAAkB;IAElB,MAAM,IAAI,GAA4B,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;IACvD,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE;QAChD,oBAAoB,EAAE,IAAI;KAC3B,CAAC,CAAC;AACL,CAAC;AAED,mFAAmF;AACnF,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,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
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
|
|
20
|
-
console.error(`agentsearch-mcp listening on stdio (
|
|
15
|
+
console.error(`agentsearch-mcp listening on stdio (base=${cfg.baseUrl})`);
|
|
21
16
|
}
|
|
22
17
|
main().catch((err) => {
|
|
23
|
-
|
|
18
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
19
|
+
console.error(`agentsearch-mcp failed to start: ${message}`);
|
|
24
20
|
process.exit(1);
|
|
25
21
|
});
|
|
26
22
|
//# sourceMappingURL=index.js.map
|
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,OAAO,GAAG,CAC3D,CAAC;AACJ,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,oCAAoC,OAAO,EAAE,CAAC,CAAC;IAC7D,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
|
+
"Requires AGENTSEARCH_BASE_URL (there is no default). POSTs {AGENTSEARCH_BASE_URL}/v1/render. The process exits at startup when that variable is missing.",
|
|
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":"AAA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,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;
|
|
@@ -25,20 +25,20 @@ function errorContent(err) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
const WEB_SEARCH_DESCRIPTION = [
|
|
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.",
|
|
30
|
-
"
|
|
28
|
+
"Search the web through your self-hosted AgentSearch API 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 (or agentsearch_render for JavaScript-heavy pages).",
|
|
30
|
+
"Requires AGENTSEARCH_BASE_URL (there is no default). POSTs {AGENTSEARCH_BASE_URL}/v1/search.",
|
|
31
31
|
"Read-only HTTP POST: not destructive, but it uses the network and can hit backend rate limits.",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"Integers for max_results outside 1–
|
|
32
|
+
"When AGENTSEARCH_API_KEY is set it is sent as a Bearer token, and HTTP 401 is retried once without the key.",
|
|
33
|
+
"HTTP failures are MCP errors with the status and a truncated body.",
|
|
34
|
+
"Integers for max_results outside 1–5 are clamped (default 5), not rejected. The backend allows at most 5.",
|
|
35
35
|
].join(" ");
|
|
36
36
|
const EXTRACT_DESCRIPTION = [
|
|
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.",
|
|
39
|
-
"
|
|
37
|
+
"Extract the content of one absolute URL through your self-hosted AgentSearch API 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; if the page is a JavaScript app whose content only appears after scripts run, use agentsearch_render.",
|
|
39
|
+
"Requires AGENTSEARCH_BASE_URL (there is no default). 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
|
-
"When AGENTSEARCH_API_KEY is set it is sent as a Bearer token, and HTTP 401 is retried once without the key;
|
|
41
|
+
"When AGENTSEARCH_API_KEY is set it is sent as a Bearer token, and HTTP 401 is retried once without the key; any HTTP failure includes the status and a truncated body.",
|
|
42
42
|
'formats, when provided, is forwarded unchanged (for example "markdown" or "text") and is not limited to an enum; max_chars, when set, is a positive integer cap sent to the API rather than applied by this server.',
|
|
43
43
|
].join(" ");
|
|
44
44
|
export function registerSearchTools(server) {
|
|
@@ -54,7 +54,7 @@ export function registerSearchTools(server) {
|
|
|
54
54
|
.number()
|
|
55
55
|
.int()
|
|
56
56
|
.optional()
|
|
57
|
-
.describe("How many hits to request (1–
|
|
57
|
+
.describe("How many hits to request (1–5, default 5). Values outside that range are clamped."),
|
|
58
58
|
},
|
|
59
59
|
}, async ({ query, max_results }) => {
|
|
60
60
|
try {
|
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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AAO,EAAE,SAAS,EAAE,EAAE,EAAE;QACpC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "agentsearch-mcp",
|
|
4
|
-
"display_name": "AgentSearch
|
|
5
|
-
"version": "1.
|
|
6
|
-
"description": "MCP server for AgentSearch web search and
|
|
7
|
-
"long_description": "Stdio MCP server
|
|
4
|
+
"display_name": "AgentSearch (agentsearchhq.com)",
|
|
5
|
+
"version": "1.1.1",
|
|
6
|
+
"description": "MCP server for a self-hosted AgentSearch API: web search, page extract, and JavaScript page rendering in headless Chromium.",
|
|
7
|
+
"long_description": "Stdio MCP server for people running their own AgentSearch-compatible API. It calls web search, URL extract, and Web Render (headless Chromium for JavaScript-heavy pages, returning title plus rendered markdown, text, HTML, links, and an optional screenshot). AGENTSEARCH_BASE_URL is required. AGENTSEARCH_API_KEY is optional.",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "AgentSearch",
|
|
10
10
|
"url": "https://github.com/agentsearchhq-coder"
|
|
@@ -21,10 +21,16 @@
|
|
|
21
21
|
"mcp",
|
|
22
22
|
"agentsearch",
|
|
23
23
|
"web-search",
|
|
24
|
-
"
|
|
24
|
+
"render",
|
|
25
|
+
"headless-browser",
|
|
26
|
+
"javascript-rendering"
|
|
25
27
|
],
|
|
26
28
|
"compatibility": {
|
|
27
|
-
"platforms": [
|
|
29
|
+
"platforms": [
|
|
30
|
+
"darwin",
|
|
31
|
+
"win32",
|
|
32
|
+
"linux"
|
|
33
|
+
],
|
|
28
34
|
"runtimes": {
|
|
29
35
|
"node": ">=20"
|
|
30
36
|
}
|
|
@@ -34,9 +40,10 @@
|
|
|
34
40
|
"entry_point": "dist/index.js",
|
|
35
41
|
"mcp_config": {
|
|
36
42
|
"command": "node",
|
|
37
|
-
"args": [
|
|
43
|
+
"args": [
|
|
44
|
+
"${__dirname}/dist/index.js"
|
|
45
|
+
],
|
|
38
46
|
"env": {
|
|
39
|
-
"AGENTSEARCH_MODE": "${user_config.AGENTSEARCH_MODE}",
|
|
40
47
|
"AGENTSEARCH_BASE_URL": "${user_config.AGENTSEARCH_BASE_URL}",
|
|
41
48
|
"AGENTSEARCH_API_KEY": "${user_config.AGENTSEARCH_API_KEY}"
|
|
42
49
|
}
|
|
@@ -45,32 +52,28 @@
|
|
|
45
52
|
"tools": [
|
|
46
53
|
{
|
|
47
54
|
"name": "agentsearch_web_search",
|
|
48
|
-
"description": "Search the web via
|
|
55
|
+
"description": "Search the web via your self-hosted AgentSearch API and return JSON text. Use extract when you already have a URL. Read-only."
|
|
49
56
|
},
|
|
50
57
|
{
|
|
51
58
|
"name": "agentsearch_extract",
|
|
52
|
-
"description": "Extract one page from a URL
|
|
59
|
+
"description": "Extract one page from a URL. Use web search to find URLs. Read-only; returns JSON text."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "agentsearch_render",
|
|
63
|
+
"description": "Render one URL in headless Chromium 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
64
|
}
|
|
54
65
|
],
|
|
55
66
|
"user_config": {
|
|
56
|
-
"AGENTSEARCH_MODE": {
|
|
57
|
-
"type": "string",
|
|
58
|
-
"title": "AgentSearch mode",
|
|
59
|
-
"description": "direct (local or self-hosted API) or portal (Pocket Network). Default direct.",
|
|
60
|
-
"default": "direct",
|
|
61
|
-
"required": false
|
|
62
|
-
},
|
|
63
67
|
"AGENTSEARCH_BASE_URL": {
|
|
64
68
|
"type": "string",
|
|
65
69
|
"title": "AgentSearch base URL",
|
|
66
|
-
"description": "
|
|
67
|
-
"
|
|
68
|
-
"required": false
|
|
70
|
+
"description": "Required base URL of your self-hosted AgentSearch API, without a trailing slash.",
|
|
71
|
+
"required": true
|
|
69
72
|
},
|
|
70
73
|
"AGENTSEARCH_API_KEY": {
|
|
71
74
|
"type": "string",
|
|
72
75
|
"title": "AgentSearch API key",
|
|
73
|
-
"description": "Optional Bearer token
|
|
76
|
+
"description": "Optional Bearer token. Leave blank if the API does not require a key.",
|
|
74
77
|
"sensitive": true,
|
|
75
78
|
"required": false
|
|
76
79
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentsearchhq/agentsearch-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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 a self-hosted AgentSearch API: web search, page extract, and JavaScript page rendering",
|
|
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,9 @@
|
|
|
37
38
|
"model-context-protocol",
|
|
38
39
|
"agentsearch",
|
|
39
40
|
"web-search",
|
|
40
|
-
"
|
|
41
|
+
"render",
|
|
42
|
+
"headless-browser",
|
|
43
|
+
"javascript-rendering"
|
|
41
44
|
],
|
|
42
45
|
"license": "MIT",
|
|
43
46
|
"dependencies": {
|
package/server.json
CHANGED
|
@@ -1,36 +1,32 @@
|
|
|
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
|
-
"
|
|
4
|
+
"title": "AgentSearch (agentsearchhq.com)",
|
|
5
|
+
"description": "AgentSearch web search, page extract and JS page render for agents. Self-hosted API via stdio.",
|
|
6
|
+
"websiteUrl": "https://agentsearchhq.com/?utm_source=mcp-registry&utm_medium=directory&utm_campaign=listing",
|
|
5
7
|
"repository": {
|
|
6
8
|
"url": "https://github.com/agentsearchhq-coder/agentsearch-mcp",
|
|
7
9
|
"source": "github"
|
|
8
10
|
},
|
|
9
|
-
"version": "1.
|
|
11
|
+
"version": "1.1.1",
|
|
10
12
|
"packages": [
|
|
11
13
|
{
|
|
12
14
|
"registryType": "npm",
|
|
13
15
|
"identifier": "@agentsearchhq/agentsearch-mcp",
|
|
14
|
-
"version": "1.
|
|
16
|
+
"version": "1.1.1",
|
|
15
17
|
"transport": {
|
|
16
18
|
"type": "stdio"
|
|
17
19
|
},
|
|
18
20
|
"environmentVariables": [
|
|
19
|
-
{
|
|
20
|
-
"name": "AGENTSEARCH_MODE",
|
|
21
|
-
"description": "direct | portal (default direct)",
|
|
22
|
-
"isRequired": false,
|
|
23
|
-
"format": "string"
|
|
24
|
-
},
|
|
25
21
|
{
|
|
26
22
|
"name": "AGENTSEARCH_BASE_URL",
|
|
27
|
-
"description": "Base URL
|
|
28
|
-
"isRequired":
|
|
23
|
+
"description": "Base URL of your AgentSearch API deployment (no trailing slash)",
|
|
24
|
+
"isRequired": true,
|
|
29
25
|
"format": "string"
|
|
30
26
|
},
|
|
31
27
|
{
|
|
32
28
|
"name": "AGENTSEARCH_API_KEY",
|
|
33
|
-
"description": "Optional Bearer token for
|
|
29
|
+
"description": "Optional Bearer token for your AgentSearch API",
|
|
34
30
|
"isRequired": false,
|
|
35
31
|
"isSecret": true,
|
|
36
32
|
"format": "string"
|
package/smithery.yaml
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
# Smithery
|
|
1
|
+
# Smithery start command for a self-hosted AgentSearch-compatible API.
|
|
2
2
|
startCommand:
|
|
3
3
|
type: stdio
|
|
4
4
|
configSchema:
|
|
5
5
|
type: object
|
|
6
|
+
required:
|
|
7
|
+
- agentsearchBaseUrl
|
|
6
8
|
properties:
|
|
7
|
-
agentsearchMode:
|
|
8
|
-
type: string
|
|
9
|
-
enum: [direct, portal]
|
|
10
|
-
default: direct
|
|
11
|
-
description: direct local API or Pocket portal
|
|
12
9
|
agentsearchBaseUrl:
|
|
13
10
|
type: string
|
|
14
|
-
|
|
15
|
-
description: Base URL for direct mode
|
|
11
|
+
description: Base URL of your self-hosted AgentSearch API (no trailing slash). Required.
|
|
16
12
|
agentsearchApiKey:
|
|
17
13
|
type: string
|
|
18
|
-
description: Optional Bearer token for
|
|
14
|
+
description: Optional Bearer token for your AgentSearch API
|
|
19
15
|
commandFunction: |-
|
|
20
16
|
(config) => ({
|
|
21
17
|
command: 'node',
|
|
22
18
|
args: ['dist/index.js'],
|
|
23
19
|
env: {
|
|
24
|
-
|
|
25
|
-
AGENTSEARCH_BASE_URL: config.agentsearchBaseUrl ?? 'http://127.0.0.1:8000',
|
|
20
|
+
AGENTSEARCH_BASE_URL: config.agentsearchBaseUrl,
|
|
26
21
|
...(config.agentsearchApiKey
|
|
27
22
|
? { AGENTSEARCH_API_KEY: config.agentsearchApiKey }
|
|
28
23
|
: {})
|