desearch-mcp-server 0.0.1 → 0.1.3

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/CHANGELOG.md ADDED
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ ## 0.1.3
4
+
5
+ Tool copy no longer states unsourced speed or latency.
6
+
7
+ - `ai-search` description is `AI search and analysis on web using Desearch AI`.
8
+ - `x-search` description is `Search X (Twitter) using Desearch AI. Optional filters narrow by user, date, language, verification, media, and engagement. Sort stays Top.`
9
+ - `ai-search` `model` is `Model to use for the search: NOVA (default) or ORBIT.`
10
+
11
+ Removed from those strings: `Real-time`, `real-time`, and `Nova is 10s model, Orbit is 30s model`. The Vercel section of the README no longer says Orbit searches run about 30 seconds. The 60-second figure there is the `vercel.json` function duration.
12
+
13
+ ## 0.1.2
14
+
15
+ Migration from the published npm package `desearch-mcp-server@0.0.1`.
16
+
17
+ ### npm 0.0.1 versus this release
18
+
19
+ `0.0.1` exposed two tools and called desearch-js methods that 1.5.0 does not have (`AISearch`, `twitterSearch`). Those calls throw. `0.1.2` depends on desearch-js 1.5.0 and calls `aiSearch` and `xSearch`.
20
+
21
+ `0.0.1` did not include `web-links-search` or the other tools below. npm users are not losing a source list they already had.
22
+
23
+ ### Tools
24
+
25
+ | Tool | In 0.0.1 |
26
+ | --- | --- |
27
+ | `ai-search` | Present, under the broken `AISearch` call. Arguments now include date range, `result_type`, and domain filters. `tools` uses short ids (`web`, `twitter`, and the other sources this tool already exposed). Older labels such as `"Web Search"` are accepted and rewritten to the short id before the API call. Default is `["web", "twitter"]`. |
28
+ | `x-search` | Present, under the broken `twitterSearch` call. Optional filters were added later (`user`, dates, language, verification, media, engagement). Sort stays Top. |
29
+ | `web-search` | New. |
30
+ | `web-links-search` | New. `tools` accepts only `web` and defaults to `["web"]`. |
31
+ | `x-links-search` | New. |
32
+ | `x-posts-by-urls`, `x-post-by-id`, `x-posts-by-user`, `x-post-retweeters`, `x-user-posts`, `x-user-replies`, `x-post-replies` | New. |
33
+ | `extract`, `web-crawl` | New. Prefer `extract`. |
34
+ | `x-trends` | New. |
35
+
36
+ The same process can serve MCP Streamable HTTP (`--http` or `MCP_TRANSPORT=http`). Stdio is unchanged: it reads `DESEARCH_API_KEY`.
37
+
38
+ ### `web-links-search` sources
39
+
40
+ Hosted `https://mcp.desearch.ai/mcp` already lists `web-links-search`. After this release, that tool's schema accepts only `web`. `"Web Search"` is rewritten to `web`. Callers that send `hackernews`, `reddit`, `wikipedia`, `youtube`, or `arxiv` fail input validation. The live `POST /desearch/ai/search/links/web` route rejects those ids with HTTP 422 (`supported tools are Web Search`). npm `0.0.1` never shipped this tool, so this is a break for hosted MCP clients, not for existing npm installs.
41
+
42
+ ### Link payloads
43
+
44
+ When `web-links-search` or `ai-search` gets a body with no links (billing fields only, or an empty link list), the tool text includes `message: "no links in response"` and the billing fields. A non-empty link list is returned as the API sent it. The API still sometimes omits links; that fix is in desearch-public-api.
45
+
46
+ ### Docker
47
+
48
+ The image command is `node build/index.js` (stdio). Streamable HTTP is `node build/index.js --http` or `MCP_TRANSPORT=http`.
49
+
50
+ ### Runtime
51
+
52
+ Node.js `>=20.18.1`. Node 22 is supported. Node 18 is not. `desearch-js` loads `undici` at runtime with a range of `>=5`, which a lockfile-free install resolves to undici 8 (Node `>=22.19`, and it crashes on Node 20). This package depends on `undici@^7.29.1` so a clean install stays on undici 7.
53
+
54
+ ### Tool annotations
55
+
56
+ `tools/list` sets MCP tool annotations on every tool:
57
+
58
+ - `readOnlyHint: true` — the tool reads Desearch, the web, or X and does not write caller state
59
+ - `destructiveHint: false` — it does not perform a destructive update
60
+ - `openWorldHint: true` — results come from live external sources
61
+
62
+ These are hints. A call still bills the Desearch API key. Repeating a call is not free.
package/README.md CHANGED
@@ -2,19 +2,34 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/desearch-mcp-server.svg)](https://www.npmjs.com/package/desearch-mcp-server)
4
4
 
5
- A Model Context Protocol (MCP) server lets clients like Claude or Cursor use the Desearch AI for real-time AI X search and web search.
5
+ AI search, X search and web search for AI agents, plus page extraction and X data tools. Bring your own Desearch API key.
6
6
 
7
7
  ## Tools
8
8
 
9
9
  The Desearch MCP server includes the following tools:
10
10
 
11
- - **AI Search**: Performs real-time AI Twitter and web searches with relevant links and summary.
12
- - **X Search**: Real-time tweet search on X.
11
+ - **AI Search** (`ai-search`): Performs AI Twitter and web searches with relevant links and summary. `tools` uses short source ids (`web`, `twitter`, `arxiv`, `wikipedia`, `youtube`, `hackernews`, `reddit`). Older labels such as `Web Search` are still accepted and sent to the API as the short id. Default is `["web", "twitter"]`.
12
+ - **X Search** (`x-search`): Tweet search on X. Arguments: `query` (required), `count` (optional, default 20). Sort stays Top. Optional filters: `user`, `start_date`, `end_date` (YYYY-MM-DD), `lang`, `verified`, `blue_verified`, `is_quote`, `is_video`, `is_image`, `min_retweets`, `min_replies`, `min_likes`.
13
+ - **Web Search** (`web-search`): SERP-style web search. Arguments: `query` (required), `start` (optional pagination offset).
14
+ - **Web Links Search** (`web-links-search`): Web link search. Arguments: `prompt` (required), `tools` (optional, only `web`, default `["web"]`; `Web Search` is accepted and rewritten to `web`), `count` (optional, 10–200). The links/web API rejects other sources, so they are not in the enum.
15
+ - **Extract** (`extract`): Read a public URL as text or HTML. Preferred over crawl. Arguments: `url` (required), `format` (optional, `html` or `text`), `js` (optional), `wait` (optional milliseconds).
16
+ - **Web Crawl** (`web-crawl`): Same arguments as `extract`, on the legacy `/web/crawl` route. The SDK marks `webCrawl` deprecated in favor of `extract`; this tool stays so that route remains reachable. Prefer `extract` for new integrations.
17
+ - **X Links Search** (`x-links-search`): AI search for X post links. Arguments: `prompt` (required), `count` (optional, 10–200).
18
+ - **X Posts By URLs** (`x-posts-by-urls`): Full posts for a list of URLs. Argument: `urls` (required).
19
+ - **X Post By ID** (`x-post-by-id`): One post by ID. Argument: `id` (required).
20
+ - **X Posts By User** (`x-posts-by-user`): Posts by a user. Arguments: `user` (required), `query` (optional), `count` (optional, 1–100).
21
+ - **X Post Retweeters** (`x-post-retweeters`): Users who retweeted a post. Arguments: `id` (required), `cursor` (optional).
22
+ - **X User Posts** (`x-user-posts`): A user's timeline. Arguments: `username` (required), `cursor` (optional).
23
+ - **X User Replies** (`x-user-replies`): Posts and replies by a user. Arguments: `user` (required), `count` (optional, 1–100), `query` (optional).
24
+ - **X Post Replies** (`x-post-replies`): Replies to a post. Arguments: `post_id` (required), `count` (optional, 1–100), `query` (optional).
25
+ - **X Trends** (`x-trends`): Trending topics for a location. Arguments: `woeid` (required), `count` (optional, 30–100).
26
+
27
+ The full SDK method → endpoint → MCP tool map is in [docs/API_MCP_PARITY.md](docs/API_MCP_PARITY.md). Every public `desearch-js` 1.5 method is a tool. `latestTweets` was removed from the SDK (`GET /twitter/latest` in 1.0.1) and is not exposed.
13
28
 
14
29
  ## Prerequisites 📋
15
30
 
16
31
  - An [Desearch API Key](https://console.desearch.ai/api-keys)
17
- - [Node.js](https://nodejs.org/) (v18 or higher)
32
+ - [Node.js](https://nodejs.org/) (v20.18.1 or higher; Node 22 is supported. Node 18 is not.)
18
33
  - [Claude Desktop](https://claude.ai/download) installed
19
34
  - [Cursor IDE](https://www.cursor.com/)
20
35
 
@@ -22,10 +37,126 @@ The Desearch MCP server includes the following tools:
22
37
 
23
38
  ### NPM Installation
24
39
 
40
+ The package name is `desearch-mcp-server`. The first npm publish of this tree is `0.1.2` (the registry still has `0.0.1`). See [CHANGELOG.md](CHANGELOG.md) for the 0.0.1 → 0.1.2 migration. The stdio entry is the `desearch-mcp-server` bin (`build/index.js`), which requires `DESEARCH_API_KEY`.
41
+
25
42
  ```bash
26
43
  npm install -g desearch-mcp-server
27
44
  ```
28
45
 
46
+ Or run it without a global install:
47
+
48
+ ```bash
49
+ npx -y desearch-mcp-server
50
+ ```
51
+
52
+ Cursor or Claude can start that bin directly:
53
+
54
+ ```json
55
+ {
56
+ "mcpServers": {
57
+ "desearch": {
58
+ "command": "npx",
59
+ "args": ["-y", "desearch-mcp-server"],
60
+ "env": {
61
+ "DESEARCH_API_KEY": "your-api-key"
62
+ }
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ `command: "desearch-mcp-server"` (no `args`) is the same entry after the global install above.
69
+
70
+ ### Using Smithery
71
+
72
+ To install the Desearch MCP server for Claude Desktop automatically via [Smithery](https://smithery.ai/servers/desearch/desearch):
73
+
74
+ ```bash
75
+ npx -y @smithery/cli install desearch/desearch --client claude
76
+ ```
77
+
78
+ Or for Cursor IDE:
79
+
80
+ ```bash
81
+ npx -y @smithery/cli install desearch/desearch --client cursor
82
+ ```
83
+
84
+ ### Windsurf
85
+
86
+ Windsurf's Cascade agent reads MCP servers from `mcp_config.json` under the `mcpServers` key. Open it from the Cascade panel: click the `...` (Actions) menu, then `Open MCP config file`. Windsurf builds use `~/.codeium/windsurf/mcp_config.json` (on Windows, `%USERPROFILE%\.codeium\windsurf\mcp_config.json`). Newer builds may open `~/.config/devin/mcp_config.json` instead (Windows: `%APPDATA%\devin\mcp_config.json`); edit whichever file that action opens.
87
+
88
+ Hosted server (no local install). Remote servers use `serverUrl` with `headers`:
89
+
90
+ ```json
91
+ {
92
+ "mcpServers": {
93
+ "desearch": {
94
+ "serverUrl": "https://mcp.desearch.ai/mcp",
95
+ "headers": {
96
+ "x-api-key": "your-api-key"
97
+ }
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ To keep the key out of the file, Windsurf can interpolate an environment variable: `"x-api-key": "${env:DESEARCH_API_KEY}"`.
104
+
105
+ Local stdio alternative:
106
+
107
+ ```json
108
+ {
109
+ "mcpServers": {
110
+ "desearch": {
111
+ "command": "npx",
112
+ "args": ["-y", "desearch-mcp-server"],
113
+ "env": {
114
+ "DESEARCH_API_KEY": "your-api-key"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ Save the file, then refresh the MCP servers list in Cascade.
122
+
123
+ ### Zed
124
+
125
+ Zed calls MCP servers context servers. Open your settings file with the `zed: open settings file` action (or use Settings → AI → MCP Servers → `Add Server`) and add a `context_servers` entry.
126
+
127
+ Hosted server:
128
+
129
+ ```json
130
+ {
131
+ "context_servers": {
132
+ "desearch": {
133
+ "url": "https://mcp.desearch.ai/mcp",
134
+ "headers": {
135
+ "x-api-key": "your-api-key"
136
+ }
137
+ }
138
+ }
139
+ }
140
+ ```
141
+
142
+ Local stdio alternative:
143
+
144
+ ```json
145
+ {
146
+ "context_servers": {
147
+ "desearch": {
148
+ "command": "npx",
149
+ "args": ["-y", "desearch-mcp-server"],
150
+ "env": {
151
+ "DESEARCH_API_KEY": "your-api-key"
152
+ }
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ The server is ready when the dot next to `desearch` in Settings → AI → MCP Servers turns green ("Server is active").
159
+
29
160
  ## Configuration ⚙️
30
161
 
31
162
  ### 1. Configure Cursor IDE to run the Desearch MCP server
@@ -105,6 +236,121 @@ For the changes to take effect:
105
236
  2. Start Claude Desktop again
106
237
  3. You can verify the server by checking status in Settings > Developer > desearch
107
238
 
239
+ ## Remote Streamable HTTP
240
+
241
+ The same server can run over MCP Streamable HTTP for a remote client. Local stdio (`desearch-mcp-server`, Smithery) is unchanged and still reads `DESEARCH_API_KEY` from the environment.
242
+
243
+ Remote requests do not use that environment variable. Discovery does not need a key: `initialize`, `notifications/initialized`, `ping`, `tools/list`, `prompts/list`, `resources/list`, and `resources/templates/list` return 200 so a marketplace scanner can read the tool list. `tools/call` and every other method still require the caller's own Desearch API key, the same key from [console.desearch.ai/api-keys](https://console.desearch.ai/api-keys):
244
+
245
+ - `Authorization: Bearer <DESEARCH_API_KEY>` (preferred)
246
+ - `x-api-key: <DESEARCH_API_KEY>`
247
+
248
+ A bare `Authorization: <DESEARCH_API_KEY>` value is also accepted. The key is not read from the query string. There is no shared server secret and no `WWW-Authenticate` challenge: the hosted process forwards the per-request key to the Desearch API only when a call needs it.
249
+
250
+ The MCP endpoint is `POST /mcp`. Responses are JSON (stateless Streamable HTTP). `GET` and `DELETE` on `/mcp` return `405` because the server does not keep a session or push server-to-client messages. `GET /`, `GET /health`, and `GET /api/health` are unauthenticated health checks.
251
+
252
+ ## Hosted endpoint
253
+
254
+ The public Streamable HTTP endpoint is `https://mcp.desearch.ai/mcp`. Listing the tools does not need a key. Send your Desearch API key on each `tools/call` in the `x-api-key` header. `Authorization: Bearer <key>` is also accepted. Use the key from [console.desearch.ai/api-keys](https://console.desearch.ai/api-keys). The server does not read a key from the query string. Remote requests do not use a process-level `DESEARCH_API_KEY`.
255
+
256
+ Cursor, or any remote MCP client:
257
+
258
+ ```json
259
+ {
260
+ "mcpServers": {
261
+ "desearch": {
262
+ "url": "https://mcp.desearch.ai/mcp",
263
+ "headers": {
264
+ "x-api-key": "your-api-key"
265
+ }
266
+ }
267
+ }
268
+ }
269
+ ```
270
+
271
+ ### Use with Claude (custom connector)
272
+
273
+ Desearch is not in the Claude Connectors Directory yet. You can add the hosted server as a custom connector with your Desearch API key.
274
+
275
+ Sources: [Custom remote MCP connectors](https://claude.com/docs/connectors/custom/remote-mcp) and [connector authentication](https://claude.com/docs/connectors/building/authentication). Request-header authentication is a beta feature in Claude.
276
+
277
+ **Claude.ai / Claude Desktop (organization admin)**
278
+
279
+ 1. Open **Organization settings > Connectors**.
280
+ 2. Select **Add**, then **Custom**. If asked for the connector type, choose **Web**.
281
+ 3. Server URL: `https://mcp.desearch.ai/mcp`
282
+ 4. Sign-in option: **No sign-in**.
283
+ 5. Under **Request headers**, add `x-api-key` with your Desearch API key as the value.
284
+ 6. Select **Add**.
285
+
286
+ The header value is stored once and shared by everyone in the organization who uses the connector.
287
+
288
+ **Claude Code**
289
+
290
+ ```bash
291
+ claude mcp add --transport http desearch https://mcp.desearch.ai/mcp \
292
+ --header "x-api-key: YOUR_DESEARCH_API_KEY"
293
+ ```
294
+
295
+ ### Run locally
296
+
297
+ ```bash
298
+ npm install
299
+ npm run build
300
+ npm run start:http
301
+ ```
302
+
303
+ This listens on `0.0.0.0:3000` (`PORT` and `HOST` override that). `MCP_TRANSPORT=http` is the same as `--http`.
304
+
305
+ ```bash
306
+ curl -sS http://127.0.0.1:3000/mcp \
307
+ -H 'Content-Type: application/json' \
308
+ -H 'Accept: application/json, text/event-stream' \
309
+ -H 'Authorization: Bearer your-api-key' \
310
+ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"smoke","version":"0.0.1"}}}'
311
+ ```
312
+
313
+ Cursor (or any remote MCP client):
314
+
315
+ ```json
316
+ {
317
+ "mcpServers": {
318
+ "desearch": {
319
+ "url": "http://127.0.0.1:3000/mcp",
320
+ "headers": {
321
+ "Authorization": "Bearer your-api-key"
322
+ }
323
+ }
324
+ }
325
+ }
326
+ ```
327
+
328
+ The image default is stdio MCP (`node build/index.js`). Registries such as Glama start the container and speak MCP on stdin/stdout, so the image does not pass `--http` unless you override it. Stdio requires `DESEARCH_API_KEY`. Smithery does not use this image command; `smithery.yaml` starts `node build/index.js` and injects `DESEARCH_API_KEY` itself.
329
+
330
+ Streamable HTTP is an override. Replace the command with `--http`, or set `MCP_TRANSPORT=http` and keep the default command. The image still exposes port 3000 for that mode.
331
+
332
+ ```bash
333
+ docker build -t desearch-mcp .
334
+ # stdio (image default)
335
+ docker run --rm -e DESEARCH_API_KEY=your-api-key -i desearch-mcp
336
+ # Streamable HTTP
337
+ docker run --rm -p 3000:3000 desearch-mcp node build/index.js --http
338
+ # same HTTP mode via env, without replacing the command
339
+ docker run --rm -e MCP_TRANSPORT=http -p 3000:3000 desearch-mcp
340
+ ```
341
+
342
+ ### Deploy on Vercel
343
+
344
+ Vercel fits this server because the handler is stateless and answers each JSON-RPC call in one response. `vercel.json` builds the project, serves `POST /mcp`, and sets the function duration to 60 seconds. Hobby plans cap function duration lower than that, so AI Search tool calls need a plan that allows at least 60 seconds. `initialize` and `tools/list` are short either way.
345
+
346
+ No server-side Desearch API key is required in the Vercel project. After deploy, the endpoint is:
347
+
348
+ `https://<project>.vercel.app/mcp`
349
+
350
+ `https://mcp.desearch.ai/mcp` is the public hostname. This repo does not create DNS records. Clients send `x-api-key`, or `Authorization: Bearer <key>`.
351
+
352
+ The same `node build/index.js --http` process is the fallback if you would rather run a long-lived Node host instead of Vercel. The Docker image defaults to stdio; pass `--http` or set `MCP_TRANSPORT=http` to serve Streamable HTTP from it.
353
+
108
354
  ## Troubleshooting 🔧
109
355
 
110
356
  ### Common Issues
@@ -119,6 +365,7 @@ For the changes to take effect:
119
365
  - Confirm your `DESEARCH_API_KEY` is valid
120
366
  - Check the `DESEARCH_API_KEY` is correctly set in the Cursor or Claude Desktop config
121
367
  - Verify that there are no spaces around the API key
368
+ - For the remote HTTP server, send `Authorization: Bearer <key>` or `x-api-key`. A hosted `DESEARCH_API_KEY` environment variable is not used for those requests.
122
369
 
123
370
  3. **Connection Issues**
124
371
 
@@ -0,0 +1,32 @@
1
+ export interface HttpListenOptions {
2
+ port?: number;
3
+ host?: string;
4
+ }
5
+ export interface RunningHttpServer {
6
+ port: number;
7
+ host: string;
8
+ close: () => Promise<void>;
9
+ }
10
+ /**
11
+ * Desearch API key from the remote client.
12
+ * Prefer `Authorization: Bearer <key>` (what MCP clients send). `x-api-key` is
13
+ * accepted as well. A bare `Authorization: <key>` value is accepted so the same
14
+ * string used as `DESEARCH_API_KEY` for stdio can be sent without a scheme.
15
+ * Query strings are ignored so keys do not land in access logs.
16
+ */
17
+ /**
18
+ * Copy a request onto another path. Used by the Vercel functions, which see
19
+ * the rewritten URL (`/api/mcp`) rather than the public path (`/mcp`).
20
+ */
21
+ export declare function requestWithPathname(request: Request, pathname: string): Request;
22
+ export declare function extractDesearchApiKey(request: Request): string | undefined;
23
+ /**
24
+ * Stateless Streamable HTTP handler.
25
+ * Each POST builds a fresh MCP server tied to that request's API key.
26
+ * JSON responses (not a long-lived SSE session) so the same handler runs
27
+ * in a local Node process and in a Vercel function.
28
+ * GET and DELETE return 405: this server does not push messages or store sessions.
29
+ */
30
+ export declare function handleMcpHttpRequest(request: Request): Promise<Response>;
31
+ export declare function startHttpServer(options?: HttpListenOptions): Promise<RunningHttpServer>;
32
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../http.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;;;;GAMG;AACH;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAa/E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAkB1E;AAkID;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiE9E;AAuDD,wBAAgB,eAAe,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAiD3F"}