deepseek-web-retrieval 0.0.0-stage → 0.2.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/CHANGELOG.md +55 -0
- package/LICENSE +21 -0
- package/README.md +96 -2
- package/dist/cli.js +865 -0
- package/docs/hosts.jsonc +129 -0
- package/docs/integration.md +159 -0
- package/docs/mcp-compatibility.md +252 -0
- package/docs/opencode-v2.md +246 -0
- package/docs/pi.md +181 -0
- package/examples/opencode.global.jsonc +25 -0
- package/examples/opencode.project.jsonc +24 -0
- package/examples/pi.mcp.jsonc +18 -0
- package/index.ts +2 -0
- package/package.json +67 -4
- package/src/core/auth.ts +8 -0
- package/src/core/client.ts +336 -0
- package/src/core/constants.ts +25 -0
- package/src/core/domains.ts +153 -0
- package/src/core/format.ts +97 -0
- package/src/core/index.ts +9 -0
- package/src/core/options.ts +109 -0
- package/src/core/search.ts +86 -0
- package/src/core/types.ts +83 -0
- package/src/core/url.ts +42 -0
- package/src/mcp/auth.ts +12 -0
- package/src/mcp/cli.ts +23 -0
- package/src/mcp/config.ts +81 -0
- package/src/mcp/format.ts +31 -0
- package/src/mcp/server.ts +139 -0
- package/src/opencode/auth.ts +69 -0
- package/src/opencode/plugin.ts +150 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
## 0.2.0
|
|
6
|
+
|
|
7
|
+
- Make `docs/hosts.jsonc` the single source of truth for host facts: the
|
|
8
|
+
integration.md host table is generated from it (`bun run docs:matrix`, drift fails
|
|
9
|
+
tests), CI matrices and the e2e Docker build args derive from it, and narrative
|
|
10
|
+
docs reference it instead of restating version locks
|
|
11
|
+
- Add a local-only end-to-end script (`bun run test:e2e`): a keyless real
|
|
12
|
+
`pi mcp list` handshake against the built server, and a headless `opencode run`
|
|
13
|
+
scenario that makes real billed requests; never run in CI. Agents run inside
|
|
14
|
+
Docker with versions pinned by `test/e2e/Dockerfile` (`--local` opts out)
|
|
15
|
+
- Add an MCP server adapter (`src/mcp/`) exposing `deepseek_web_search` and `deepseek_fetch`
|
|
16
|
+
over stdio, serving MCP clients from revision 2024-11-05 through 2026-07-28
|
|
17
|
+
- Support `DEEPSEEK_*` environment variable configuration in the MCP server, mapped onto the
|
|
18
|
+
shared option pipeline
|
|
19
|
+
- Add the Pi guide (`docs/pi.md`) and `examples/pi.mcp.jsonc`; Pi 1.3.0 is the first
|
|
20
|
+
supported MCP host
|
|
21
|
+
- Add `docs/mcp-compatibility.md`, a primary-source review of MCP protocol compatibility
|
|
22
|
+
across the hosts in the support matrix
|
|
23
|
+
- Add a Node build (`dist/cli.js`) with a `deepseek-web-retrieval` bin entry and Node 20+
|
|
24
|
+
engines, alongside the existing Bun workflow
|
|
25
|
+
- Cover the MCP server with SDK client personas pinned to 2024-11-05, 2025-06-18,
|
|
26
|
+
2025-11-25, and 2026-07-28, plus a real stdio smoke test of the built entry
|
|
27
|
+
- Enforce the fetch host policy inside the core client so direct core consumers cannot bypass it
|
|
28
|
+
- Fail fast on a missing API key before the fetch permission prompt, and reject non-string `url` inputs
|
|
29
|
+
- Move OpenCode-specific missing-key guidance out of the agent-agnostic core
|
|
30
|
+
- Document that `maxResults: 0` returns no results
|
|
31
|
+
- Cover response body reads with the request timeout and cancellation signal
|
|
32
|
+
- Reject successful API responses larger than 5 MiB
|
|
33
|
+
- Reject search queries that exceed 128 characters after adding search operators
|
|
34
|
+
- Block IPv4-mapped IPv6 private addresses in the fetch host policy
|
|
35
|
+
- Truncate API error bodies by Unicode code points
|
|
36
|
+
- Move OpenCode-specific setup and usage into `docs/opencode-v2.md`
|
|
37
|
+
- Add `docs/integration.md` with a version-locked host support matrix
|
|
38
|
+
- Calibrate the OpenCode v2 install and uninstall guide against verified behavior:
|
|
39
|
+
plugin hot reload, `plugin add` not selecting the provider, and `plugin remove` leftovers
|
|
40
|
+
|
|
41
|
+
## 0.1.0
|
|
42
|
+
|
|
43
|
+
Initial public-ready release.
|
|
44
|
+
|
|
45
|
+
- DeepSeek Search provider for OpenCode v2 (`websearch.provider = "deepseek"`)
|
|
46
|
+
- `deepseek_fetch` tool backed by DeepSeek Fetch
|
|
47
|
+
- Optional drop-in `webfetch` replacement
|
|
48
|
+
- Reuse of the active DeepSeek credential stored in OpenCode
|
|
49
|
+
- `DEEPSEEK_API_KEY` fallback and `apiKeySource` control
|
|
50
|
+
- Summary-only search with rerank/authority filtering and URL deduplication
|
|
51
|
+
- Markdown-only fetch with a configurable character cap
|
|
52
|
+
- Domain allow/deny lists and private-host blocking
|
|
53
|
+
- Bounded retries for 408, 425, 429, and 5xx responses with `Retry-After`
|
|
54
|
+
- Unicode-safe truncation and secret redaction in errors
|
|
55
|
+
- Unit tests and CI
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 deepseek-web-retrieval contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,97 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DeepSeek Web Retrieval
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Bringing [DeepSeek's in-house Search and Fetch APIs](https://api-docs.deepseek.com/guides/search) to coding agents.**
|
|
4
|
+
|
|
5
|
+
An adapter layer for coding agents. The core is agent-agnostic; each adapter exposes the
|
|
6
|
+
same retrieval behavior to a specific agent. OpenCode v2 has a native plugin adapter, and
|
|
7
|
+
an MCP server covers MCP-capable hosts, with Pi as the first guided host. Guides for other
|
|
8
|
+
coding agents are in progress.
|
|
9
|
+
|
|
10
|
+
This is an unofficial community project. It is not affiliated with OpenCode or DeepSeek.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
Shipped adapters:
|
|
15
|
+
|
|
16
|
+
- [OpenCode v2 setup and usage](docs/opencode-v2.md) — native plugin API
|
|
17
|
+
- [Pi setup and usage](docs/pi.md) — MCP server over stdio
|
|
18
|
+
|
|
19
|
+
The MCP server works with any host that supports MCP tools over stdio; Pi is the first
|
|
20
|
+
host with a shipped guide. For how other coding agents integrate—native websearch
|
|
21
|
+
providers, native fetch tools, MCP, or wrappers—see the
|
|
22
|
+
[integration model](docs/integration.md) with its version-locked host support matrix, and
|
|
23
|
+
the [MCP compatibility research](docs/mcp-compatibility.md). A host is listed as supported
|
|
24
|
+
only after an adapter and guide exist.
|
|
25
|
+
|
|
26
|
+
For shared search, fetch, retry, and privacy behavior, see below.
|
|
27
|
+
|
|
28
|
+
## General behavior
|
|
29
|
+
|
|
30
|
+
### Search
|
|
31
|
+
|
|
32
|
+
- Sends `need_content: false` and returns DeepSeek's `summary`, falling back to `snippet`.
|
|
33
|
+
- Filters by `rerank_score` and `authority`, deduplicates URLs, and returns at most five
|
|
34
|
+
results by default.
|
|
35
|
+
- The final query, including `blockedDomains`, `includeDomains`, and `language` operators,
|
|
36
|
+
must be 128 characters or fewer. Longer queries are rejected locally.
|
|
37
|
+
- An empty result set is normal and is not an error.
|
|
38
|
+
|
|
39
|
+
### Fetch
|
|
40
|
+
|
|
41
|
+
- DeepSeek Fetch returns Markdown only. `format: "text"` and `format: "html"` are rejected.
|
|
42
|
+
- Output is capped at 16,000 characters by default, including the title. A
|
|
43
|
+
`[content truncated]` marker is added when the limit leaves room for it.
|
|
44
|
+
- If the page already starts with the same title as a top-level heading, no duplicate title
|
|
45
|
+
is added.
|
|
46
|
+
- Responses larger than 5 MiB are rejected before parsing.
|
|
47
|
+
- URLs must be absolute `http://` or `https://` URLs with a host, no embedded credentials,
|
|
48
|
+
and at most 8,192 characters.
|
|
49
|
+
- The core supports allowed/blocked domain lists and private-host blocking. DeepSeek does
|
|
50
|
+
not render JavaScript and cannot reach private networks; PDFs, images, and other binary
|
|
51
|
+
files are unsupported.
|
|
52
|
+
|
|
53
|
+
### Timeouts and retries
|
|
54
|
+
|
|
55
|
+
Request timeouts include reading the response body. Retryable responses are 408, 425, 429,
|
|
56
|
+
and 5xx; `Retry-After` is honored up to 10 seconds. Other failures, including 401, timeouts,
|
|
57
|
+
and network errors, fail without retrying.
|
|
58
|
+
|
|
59
|
+
### No automatic fallback
|
|
60
|
+
|
|
61
|
+
If no API key is available, Search and Fetch fail. If DeepSeek is unavailable, returns an
|
|
62
|
+
error, or times out, the request fails. The tool does not silently switch to another search
|
|
63
|
+
provider or fetch implementation.
|
|
64
|
+
|
|
65
|
+
### Privacy and cost
|
|
66
|
+
|
|
67
|
+
Queries and URLs are sent to `https://api.deepseek.com`. The API key is sent only as a
|
|
68
|
+
Bearer token to DeepSeek. Search and Fetch are billed per successful request; check current
|
|
69
|
+
DeepSeek pricing and rate limits before enabling a team deployment. A 429 means you should
|
|
70
|
+
wait, reduce concurrency, or increase retries.
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
bun install
|
|
76
|
+
bun run typecheck
|
|
77
|
+
bun test
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The test suite mocks the DeepSeek HTTP API and the OpenCode plugin host, and drives the
|
|
81
|
+
MCP server with SDK clients pinned to each supported protocol revision. Real API calls
|
|
82
|
+
require a funded DeepSeek account. Shared retrieval logic lives in `src/core/`; adapters
|
|
83
|
+
live in `src/<agent>/` (the cross-host MCP server lives in `src/mcp/`). Adapter docs live
|
|
84
|
+
in `docs/<agent>.md`.
|
|
85
|
+
|
|
86
|
+
## Prior art
|
|
87
|
+
|
|
88
|
+
Other community projects in this space include:
|
|
89
|
+
|
|
90
|
+
- [overwaven/opencode-deepseek-web](https://github.com/overwaven/opencode-deepseek-web)
|
|
91
|
+
- [JOEYZYC/opencode-deepseek-websearch](https://github.com/JOEYZYC/opencode-deepseek-websearch)
|
|
92
|
+
- [gtoxlili/opencode-deepseek-websearch](https://github.com/gtoxlili/opencode-deepseek-websearch)
|
|
93
|
+
- [OniVe/opencode-websearch-deepseek](https://github.com/OniVe/opencode-websearch-deepseek)
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
MIT. See [LICENSE](LICENSE).
|