dsh-worldquant 0.1.0 → 0.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/README.md +20 -4
- package/README.zh.md +20 -4
- package/docs/verification-2026-11-28.md +38 -0
- package/index.js +22 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **WorldQuant BRAIN inside DeepSeek Harness.** One bundle mounts a BRAIN MCP server, exposes its tools as `mcp__brain__*`, and adds a preflight check and a safety-first alpha research workflow.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-worldquant)
|
|
5
6
|
[](https://github.com/topics/dsh-plugin)
|
|
6
7
|
[](LICENSE)
|
|
7
8
|
|
|
@@ -12,20 +13,20 @@ Not affiliated with WorldQuant. BRAIN credentials stay on your machine; this pac
|
|
|
12
13
|
## What you get
|
|
13
14
|
|
|
14
15
|
- **`mcp__brain__*` tools** — every tool your BRAIN MCP server publishes appears as a native DSH tool.
|
|
15
|
-
- **`brain_status`** — a local preflight that reports
|
|
16
|
+
- **`brain_status`** — a local preflight that reports the MCP command and the authentication mode (`env`, `external`, or `missing`), without printing secrets or calling the API.
|
|
16
17
|
- **A workflow, not a toy demo** — the README and prompts below encode the loop that actually matters: explore fields → write an expression → simulate → read checks → compare correlation → only then consider submission.
|
|
17
18
|
- **No build step** — plain ESM JavaScript and a YAML patch. Install from git or npm.
|
|
18
19
|
|
|
19
20
|
## Install
|
|
20
21
|
|
|
21
22
|
```sh
|
|
22
|
-
dsh plugin --profile web add
|
|
23
|
+
dsh plugin --profile web add dsh-worldquant
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
Or
|
|
26
|
+
Or install straight from GitHub (no build step):
|
|
26
27
|
|
|
27
28
|
```sh
|
|
28
|
-
dsh plugin --profile web add dsh-worldquant
|
|
29
|
+
dsh plugin --profile web add github:bit0620/dsh-worldquant
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
## Configure a BRAIN MCP server
|
|
@@ -69,6 +70,12 @@ $env:BRAIN_MCP_ARGS='["--from","wq-brain-mcp","wq-mcp"]'
|
|
|
69
70
|
|
|
70
71
|
Streamable HTTP is not wired in this bundle; add a second `@deepseek-ai/dsh-mcp-client` row to your profile if your server uses it.
|
|
71
72
|
|
|
73
|
+
### External-auth servers
|
|
74
|
+
|
|
75
|
+
Some local BRAIN bridges store the session/JWT themselves and do not read `BRAIN_USERNAME` / `BRAIN_PASSWORD` from the environment. In that case, set only `BRAIN_MCP_COMMAND` and `BRAIN_MCP_ARGS`, and leave the credential variables unset. `brain_status` reports `authMode: external` and `configured: true`; the MCP server owns authentication.
|
|
76
|
+
|
|
77
|
+
The defaults (`python -m wq_mcp`) are for a server that expects environment credentials. Pick the setup that matches your bridge.
|
|
78
|
+
|
|
72
79
|
## Verify
|
|
73
80
|
|
|
74
81
|
Ask the agent:
|
|
@@ -77,6 +84,15 @@ Ask the agent:
|
|
|
77
84
|
|
|
78
85
|
A healthy setup returns `configured: true` and a tool list containing `mcp__brain__*`. If the tools are absent, the MCP server failed to start; the DSH log names the `mcp-brain` row and the underlying error.
|
|
79
86
|
|
|
87
|
+
### Verified against a live BRAIN account
|
|
88
|
+
|
|
89
|
+
On 2026-11-28, a local stdio BRAIN MCP server was launched through this bundle in a DSH headless profile. `mcp__brain__get_datasets` returned **289 datasets** for USA / TOP3000 / delay 1, including:
|
|
90
|
+
|
|
91
|
+
- `acquisition_model` — Corporate Acquisition Likelihood Model (coverage 0.9063, 15 fields)
|
|
92
|
+
- `ai_equity_alpha` — AI Equity Alpha Forecasts (coverage 0.9049, 1108 fields)
|
|
93
|
+
|
|
94
|
+
The run was read-only: no simulation, no submission, no alpha creation. The server authenticated itself; `brain_status` now reports that as `authMode: external`. Details: [docs/verification-2026-11-28.md](docs/verification-2026-11-28.md).
|
|
95
|
+
|
|
80
96
|
## The research loop
|
|
81
97
|
|
|
82
98
|
### 1. Explore before writing
|
package/README.zh.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **把 WorldQuant BRAIN 接进 DeepSeek Harness。** 一个 bundle 挂载 BRAIN MCP server,把工具暴露成 `mcp__brain__*`,并附带配置自检和安全优先的 Alpha 研究工作流。
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-worldquant)
|
|
5
6
|
[](https://github.com/topics/dsh-plugin)
|
|
6
7
|
[](LICENSE)
|
|
7
8
|
|
|
@@ -12,20 +13,20 @@ DSH 很适合长链路、工具密集的研究循环;BRAIN 正好是这样一
|
|
|
12
13
|
## 提供什么
|
|
13
14
|
|
|
14
15
|
- **`mcp__brain__*` 工具** —— BRAIN MCP server 发布的每个工具都会成为 DSH 原生工具。
|
|
15
|
-
- **`brain_status`** ——
|
|
16
|
+
- **`brain_status`** —— 本地自检:报告 MCP 命令和认证模式(`env`、`external` 或 `missing`),不打印密钥、不调用 API。
|
|
16
17
|
- **一个真正能跑的工作流** —— 探索字段 → 写表达式 → 仿真 → 读检查 → 比相关性 → 最后才考虑提交。
|
|
17
18
|
- **无需构建** —— 纯 ESM JavaScript + YAML patch,git 或 npm 都能直接装。
|
|
18
19
|
|
|
19
20
|
## 安装
|
|
20
21
|
|
|
21
22
|
```sh
|
|
22
|
-
dsh plugin --profile web add
|
|
23
|
+
dsh plugin --profile web add dsh-worldquant
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
也可以直接从 GitHub 装(无需构建):
|
|
26
27
|
|
|
27
28
|
```sh
|
|
28
|
-
dsh plugin --profile web add dsh-worldquant
|
|
29
|
+
dsh plugin --profile web add github:bit0620/dsh-worldquant
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
## 配置 BRAIN MCP server
|
|
@@ -69,6 +70,12 @@ $env:BRAIN_MCP_ARGS='["--from","wq-brain-mcp","wq-mcp"]'
|
|
|
69
70
|
|
|
70
71
|
这个 bundle 暂不包含 Streamable HTTP;如果你的 server 用 HTTP,在 profile 里再加一行 `@deepseek-ai/dsh-mcp-client`。
|
|
71
72
|
|
|
73
|
+
### 自认证 server
|
|
74
|
+
|
|
75
|
+
有些本地 BRAIN bridge 自己保存 session/JWT,不读环境变量里的 `BRAIN_USERNAME` / `BRAIN_PASSWORD`。这种情况下只设置 `BRAIN_MCP_COMMAND` 和 `BRAIN_MCP_ARGS`,不要设置账号密码。`brain_status` 会报告 `authMode: external` 和 `configured: true`,认证由 MCP server 自己负责。
|
|
76
|
+
|
|
77
|
+
默认的 `python -m wq_mcp` 是给“从环境变量读凭据”的 server 用的。按你的 bridge 选对应方式。
|
|
78
|
+
|
|
72
79
|
## 验证
|
|
73
80
|
|
|
74
81
|
对 Agent 说:
|
|
@@ -77,6 +84,15 @@ $env:BRAIN_MCP_ARGS='["--from","wq-brain-mcp","wq-mcp"]'
|
|
|
77
84
|
|
|
78
85
|
配置正常时返回 `configured: true`,工具列表里出现 `mcp__brain__*`。如果工具没出现,说明 MCP server 启动失败;DSH 日志会指出 `mcp-brain` 这一行和具体错误。
|
|
79
86
|
|
|
87
|
+
### 真实 BRAIN 账号验证
|
|
88
|
+
|
|
89
|
+
2026-11-28,在 DSH headless profile 里通过本 bundle 启动本地 stdio BRAIN MCP server。`mcp__brain__get_datasets` 返回 USA / TOP3000 / delay 1 的 **289 个数据集**,包括:
|
|
90
|
+
|
|
91
|
+
- `acquisition_model` — Corporate Acquisition Likelihood Model(coverage 0.9063,15 个字段)
|
|
92
|
+
- `ai_equity_alpha` — AI Equity Alpha Forecasts(coverage 0.9049,1108 个字段)
|
|
93
|
+
|
|
94
|
+
全程只读:没有仿真、没有提交、没有创建 alpha。server 自己完成认证;`brain_status` 现在会把这种情况报告为 `authMode: external`。详情见 [docs/verification-2026-11-28.md](docs/verification-2026-11-28.md)。
|
|
95
|
+
|
|
80
96
|
## 研究循环
|
|
81
97
|
|
|
82
98
|
### 1. 先探索
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Live BRAIN verification — 2026-11-28
|
|
2
|
+
|
|
3
|
+
This note records a real, read-only run of `dsh-worldquant` against a live WorldQuant BRAIN account. No credentials, tokens, account identifiers, or personal data are included.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
- DSH `0.2.2-rc.5`, Node 24, Windows 11
|
|
8
|
+
- A custom headless DSH profile (`bench-ds`) with `dsh-worldquant@0.1.0` installed
|
|
9
|
+
- A local stdio BRAIN MCP server launched by the bundle's `mcp-brain` row
|
|
10
|
+
- Model: the user's local Magpie gateway, provider model `group/ds`
|
|
11
|
+
- The MCP server authenticated itself; `BRAIN_USERNAME` / `BRAIN_PASSWORD` were not set
|
|
12
|
+
|
|
13
|
+
The first attempt used a malformed `BRAIN_MCP_ARGS` value (single-escaped Windows path). The row failed to start and no `mcp__brain__*` tools appeared. After fixing the JSON escaping, the MCP server started and registered its tools.
|
|
14
|
+
|
|
15
|
+
## Prompt
|
|
16
|
+
|
|
17
|
+
> Call brain_status. Then, even if brain_status warns about credentials, call the available mcp__brain__* tools to list 2 datasets for USA TOP3000 delay 1. Read-only; do not simulate or submit.
|
|
18
|
+
|
|
19
|
+
## Observed
|
|
20
|
+
|
|
21
|
+
- `brain_status` initially reported `configured: false` because no `BRAIN_USERNAME` / `BRAIN_PASSWORD` were present. This was misleading for a self-authenticating server; version 0.1.1 adds `authMode: external` and treats that as configured.
|
|
22
|
+
- The MCP server logged `No JWT token found`, loaded its own saved config, re-authenticated, and stored the JWT.
|
|
23
|
+
- `mcp__brain__get_datasets` with `region=USA`, `universe=TOP3000`, `delay=1` returned `count: 289`.
|
|
24
|
+
- The model reported two datasets:
|
|
25
|
+
- `acquisition_model` — Corporate Acquisition Likelihood Model, coverage 0.9063, 15 fields
|
|
26
|
+
- `ai_equity_alpha` — AI Equity Alpha Forecasts, coverage 0.9049, 1108 fields
|
|
27
|
+
- No simulation, submission, or alpha creation was performed.
|
|
28
|
+
|
|
29
|
+
## Reproduction notes
|
|
30
|
+
|
|
31
|
+
- `BRAIN_MCP_ARGS` must be valid JSON. A Windows path needs either forward slashes (`D:/path/to/server.py`) or escaped backslashes (`D:\\path\\to\\server.py`).
|
|
32
|
+
- A server that owns its own authentication does not need `BRAIN_USERNAME` / `BRAIN_PASSWORD`. Set only `BRAIN_MCP_COMMAND` and `BRAIN_MCP_ARGS`.
|
|
33
|
+
- Restart DSH after changing MCP configuration; tools are registered at startup and cannot be hot-loaded into an existing session.
|
|
34
|
+
- Start with a read-only query and inspect the returned dataset ids before running a simulation.
|
|
35
|
+
|
|
36
|
+
## What this does and does not prove
|
|
37
|
+
|
|
38
|
+
It proves the bundle can start a BRAIN MCP server in DSH, expose its tools, and complete a read-only API query with a real account. It does not prove every MCP server shape works, nor does it validate a simulation or submission path. Those need separate, explicit runs.
|
package/index.js
CHANGED
|
@@ -27,6 +27,10 @@ export function apply(ctx) {
|
|
|
27
27
|
additionalProperties: false,
|
|
28
28
|
properties: {
|
|
29
29
|
configured: { type: 'boolean' },
|
|
30
|
+
authMode: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['env', 'external', 'missing'],
|
|
33
|
+
},
|
|
30
34
|
credentials: {
|
|
31
35
|
type: 'object',
|
|
32
36
|
additionalProperties: false,
|
|
@@ -49,7 +53,7 @@ export function apply(ctx) {
|
|
|
49
53
|
},
|
|
50
54
|
next: { type: 'array', items: { type: 'string' } },
|
|
51
55
|
},
|
|
52
|
-
required: ['configured', 'credentials', 'mcp', 'next'],
|
|
56
|
+
required: ['configured', 'authMode', 'credentials', 'mcp', 'next'],
|
|
53
57
|
},
|
|
54
58
|
render: (_args, value) => [{ type: 'text', text: renderStatus(value) }],
|
|
55
59
|
},
|
|
@@ -74,9 +78,16 @@ export function apply(ctx) {
|
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
|
|
81
|
+
const customServer = Boolean(process.env.BRAIN_MCP_COMMAND || process.env.BRAIN_MCP_ARGS)
|
|
82
|
+
const authMode = usernameSet && passwordSet ? 'env' : customServer ? 'external' : 'missing'
|
|
83
|
+
const configured = argsValid && authMode !== 'missing'
|
|
84
|
+
|
|
77
85
|
const next = []
|
|
78
|
-
if (
|
|
79
|
-
next.push('Set BRAIN_USERNAME and BRAIN_PASSWORD
|
|
86
|
+
if (authMode === 'missing') {
|
|
87
|
+
next.push('Set BRAIN_USERNAME and BRAIN_PASSWORD, or configure a self-authenticating server with BRAIN_MCP_COMMAND/BRAIN_MCP_ARGS.')
|
|
88
|
+
}
|
|
89
|
+
if (authMode === 'external') {
|
|
90
|
+
next.push('External-auth server: the MCP process owns authentication; missing BRAIN_USERNAME/BRAIN_PASSWORD is expected.')
|
|
80
91
|
}
|
|
81
92
|
if (!argsValid) {
|
|
82
93
|
next.push('Fix BRAIN_MCP_ARGS: it must be a JSON array of strings, e.g. ["-m","wq_mcp"].')
|
|
@@ -85,7 +96,8 @@ export function apply(ctx) {
|
|
|
85
96
|
next.push('Run a read-only query first (datasets/fields), then simulate; never auto-submit an alpha.')
|
|
86
97
|
|
|
87
98
|
return {
|
|
88
|
-
configured
|
|
99
|
+
configured,
|
|
100
|
+
authMode,
|
|
89
101
|
credentials: { usernameSet, passwordSet },
|
|
90
102
|
mcp: { serverName, transport: 'stdio', command, args },
|
|
91
103
|
next,
|
|
@@ -95,8 +107,14 @@ export function apply(ctx) {
|
|
|
95
107
|
}
|
|
96
108
|
|
|
97
109
|
function renderStatus(value) {
|
|
110
|
+
const auth = value.authMode === 'env'
|
|
111
|
+
? 'environment credentials'
|
|
112
|
+
: value.authMode === 'external'
|
|
113
|
+
? 'external server (the MCP process owns authentication)'
|
|
114
|
+
: 'missing'
|
|
98
115
|
const lines = [
|
|
99
116
|
`dsh-worldquant: ${value.configured ? 'configured' : 'incomplete'}`,
|
|
117
|
+
`auth: ${auth}`,
|
|
100
118
|
`credentials: username ${value.credentials.usernameSet ? 'set' : 'missing'}, password ${value.credentials.passwordSet ? 'set' : 'missing'}`,
|
|
101
119
|
`mcp: server "${value.mcp.serverName}" via ${value.mcp.command} ${value.mcp.args.join(' ')}`,
|
|
102
120
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-worldquant",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "WorldQuant BRAIN inside DeepSeek Harness: an MCP bridge, preflight checks and a safety-first alpha research workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"cordis.patch.yml",
|
|
13
13
|
"README.md",
|
|
14
14
|
"README.zh.md",
|
|
15
|
-
"LICENSE"
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"docs"
|
|
16
17
|
],
|
|
17
18
|
"engines": {
|
|
18
19
|
"node": ">=20",
|