deepseek-web-retrieval 0.5.0 → 0.6.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 +15 -0
- package/README.md +95 -42
- package/dist/cli.js +397 -307
- package/docs/agents/codex.md +15 -8
- package/docs/agents/opencode-v2.md +12 -6
- package/docs/agents/pi.md +14 -6
- package/docs/design/installer-design.md +25 -20
- package/docs/integration.md +38 -7
- package/docs/research/control-matrix.md +2 -2
- package/docs/research/mcp-compatibility.md +5 -1
- package/package.json +1 -1
- package/src/installer/apply.ts +5 -3
- package/src/installer/cli.ts +43 -10
- package/src/installer/state.ts +1 -0
- package/src/installer/types.ts +2 -0
- package/src/mcp/cli.ts +8 -51
- package/src/mcp/serve.ts +51 -0
- package/src/version.ts +12 -0
package/src/mcp/serve.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
2
|
+
import { apiKeyFromEnv } from "../core/auth";
|
|
3
|
+
import { resolveEnvOptions } from "../core/env";
|
|
4
|
+
import { MISSING_API_KEY_MESSAGE } from "./auth";
|
|
5
|
+
import { isJsonReplacingClient } from "./client";
|
|
6
|
+
import { createDeepSeekServer, servePrecheck } from "./server";
|
|
7
|
+
|
|
8
|
+
/** Boots the stdio MCP server; the CLI entry reaches this only with no arguments. */
|
|
9
|
+
export function serveMcp(): void {
|
|
10
|
+
// stdout is the JSON-RPC channel; all diagnostics must go to stderr.
|
|
11
|
+
const env = process.env;
|
|
12
|
+
if (!apiKeyFromEnv(env)) {
|
|
13
|
+
console.error(MISSING_API_KEY_MESSAGE);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const config = resolveEnvOptions(env);
|
|
18
|
+
const precheck = servePrecheck(config);
|
|
19
|
+
if (precheck) {
|
|
20
|
+
console.error(precheck);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
const handle = serveStdio(() => {
|
|
24
|
+
const server = createDeepSeekServer(config, env);
|
|
25
|
+
// Fires after the handshake-era initialize exchange (the stateless era opens
|
|
26
|
+
// differently and simply never logs). One stderr line so a human run shows
|
|
27
|
+
// which client connected and whether text-only shaping kicked in; if a host
|
|
28
|
+
// renames its clientInfo, this line is where the regression becomes visible.
|
|
29
|
+
server.server.oninitialized = () => {
|
|
30
|
+
const info = server.server.getClientVersion();
|
|
31
|
+
if (info === undefined) return;
|
|
32
|
+
console.error(
|
|
33
|
+
`mcp client: ${info.name} ${info.version ?? "unknown"} — ` +
|
|
34
|
+
(isJsonReplacingClient(info.name)
|
|
35
|
+
? "text-only results (this client replaces content with serialized structuredContent)"
|
|
36
|
+
: "text + structuredContent results"),
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
return server;
|
|
40
|
+
});
|
|
41
|
+
const tools = [
|
|
42
|
+
config.search.enabled ? `search (max ${config.search.maxResults} results)` : null,
|
|
43
|
+
config.fetch.enabled ? `fetch (max ${config.fetch.maxChars} chars)` : null,
|
|
44
|
+
]
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.join(", ");
|
|
47
|
+
console.error(`deepseek-web-retrieval MCP server on stdio (${tools})`);
|
|
48
|
+
|
|
49
|
+
process.on("SIGINT", () => void handle.close());
|
|
50
|
+
process.on("SIGTERM", () => void handle.close());
|
|
51
|
+
}
|
package/src/version.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The published package version, read once at startup. Resolves to the repo
|
|
5
|
+
* root when run from source and to the package root when run from the bundled
|
|
6
|
+
* dist/ output; npm always ships package.json alongside it.
|
|
7
|
+
*/
|
|
8
|
+
export const TOOL_VERSION: string = (
|
|
9
|
+
JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")) as {
|
|
10
|
+
version: string;
|
|
11
|
+
}
|
|
12
|
+
).version;
|