@dsh-jev/mcp 0.1.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/README.md +61 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +46 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @dsh-jev/mcp
|
|
2
|
+
|
|
3
|
+
MCP server (stdio) exposing the jev System One primitives (`choice` / `score`
|
|
4
|
+
/ `noul`) from `@dsh-jev/core` as MCP tools. Published as
|
|
5
|
+
`@dsh-jev/mcp` (bin: `dsh-jev-mcp`). Every tool degrades gracefully:
|
|
6
|
+
when the jev API is unreachable, timed out, or malformed, the tool still
|
|
7
|
+
returns the caller-supplied fallback and clearly marks `jev: degraded (reason)`.
|
|
8
|
+
|
|
9
|
+
## Tools
|
|
10
|
+
|
|
11
|
+
| Tool | Input | Behavior |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `jev_choice` | `question`, `options[]`, `fallbackPick?` | Picks one option; falls back to `fallbackPick` (default: first option). |
|
|
14
|
+
| `jev_score` | `subject`, `criteria[]`, `fallbackScore?` | One [0,1] score per criterion; falls back to a neutral score (default 0.5). |
|
|
15
|
+
| `jev_noul` | `prompt`, `fallbackText?` | Unconstrained reflection; falls back to given/empty text. |
|
|
16
|
+
|
|
17
|
+
Auth: set `JEV_API_KEY` in the server process environment (Bearer token).
|
|
18
|
+
|
|
19
|
+
## dsh wiring (`cordis.patch.yml`)
|
|
20
|
+
|
|
21
|
+
⚠️ New plugin instances MUST be declared under `- insert:` — a top-level
|
|
22
|
+
`- id:` only patches entries already present in the composed tree and is
|
|
23
|
+
silently dropped when the id does not exist.
|
|
24
|
+
|
|
25
|
+
Add to the target profile's `cordis.patch.yml` (e.g.
|
|
26
|
+
`~/.config/dsh/profiles/<name>/cordis.patch.yml`, or its `.tmpl` source, then
|
|
27
|
+
`chezmoi apply`):
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
- insert:
|
|
31
|
+
- id: dsh-jev-mcp
|
|
32
|
+
config:
|
|
33
|
+
command:
|
|
34
|
+
# stdio command must be an absolute path in GUI/launchd contexts
|
|
35
|
+
# (no fnm on PATH there). Adjust to your node location:
|
|
36
|
+
command: /Users/you/.local/share/fnm/aliases/default/bin/node
|
|
37
|
+
args:
|
|
38
|
+
- /Users/you/workspace/opensource/dsh-jev/packages/jev-mcp/dist/index.js
|
|
39
|
+
env:
|
|
40
|
+
JEV_API_KEY: ${JEV_API_KEY}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> Do not hardcode your macOS username in public docs/configs — use chezmoi
|
|
44
|
+
> `{{ .chezmooi.homeDir }}` templating (source `.tmpl`) for real deployments.
|
|
45
|
+
|
|
46
|
+
Verify the composed tree picks it up:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
dsh --profile <name> --dump-config | grep -A5 dsh-jev-mcp
|
|
50
|
+
# and confirm no `patch: entry "dsh-jev-mcp" not found` warning in the header
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Remember `--dump-config` only validates composition; a real boot of the
|
|
54
|
+
profile is required to verify the plugin imports cleanly.
|
|
55
|
+
|
|
56
|
+
## Build & run
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
pnpm install && pnpm build
|
|
60
|
+
node dist/index.js # speaks MCP over stdio
|
|
61
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @dsh-jev/mcp — MCP stdio server wrapping @dsh-jev/core.
|
|
4
|
+
*
|
|
5
|
+
* Tools (all degrade, never error the tool call, when System One is unreachable):
|
|
6
|
+
* - jev_choice: pick one of N options
|
|
7
|
+
* - jev_score: score a subject against criteria
|
|
8
|
+
* - jev_noul: unconstrained "noul" reflection
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @dsh-jev/mcp — MCP stdio server wrapping @dsh-jev/core.
|
|
4
|
+
*
|
|
5
|
+
* Tools (all degrade, never error the tool call, when System One is unreachable):
|
|
6
|
+
* - jev_choice: pick one of N options
|
|
7
|
+
* - jev_score: score a subject against criteria
|
|
8
|
+
* - jev_noul: unconstrained "noul" reflection
|
|
9
|
+
*/
|
|
10
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
11
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { createJevClient } from '@dsh-jev/core';
|
|
14
|
+
const client = createJevClient();
|
|
15
|
+
const server = new McpServer({ name: 'dsh-jev-mcp', version: '0.1.0' });
|
|
16
|
+
function report(out) {
|
|
17
|
+
const status = out.ok ? 'jev: ok' : `jev: degraded (${out.error})`;
|
|
18
|
+
return { content: [{ type: 'text', text: `${status}\n${JSON.stringify(out.value, null, 2)}` }] };
|
|
19
|
+
}
|
|
20
|
+
server.tool('jev_choice', 'Pick one option for a decision via jev System One. Degrades to fallbackPick on failure.', {
|
|
21
|
+
question: z.string().describe('The decision question'),
|
|
22
|
+
options: z.array(z.string()).min(1).describe('Candidate options'),
|
|
23
|
+
fallbackPick: z.string().optional().describe('Option to use if jev is unavailable (default: first option)'),
|
|
24
|
+
}, async ({ question, options, fallbackPick }) => {
|
|
25
|
+
const fbIndex = Math.max(0, options.indexOf(fallbackPick ?? options[0]));
|
|
26
|
+
const out = await client.choice({ question, options }, { pickedIndex: fbIndex, picked: options[fbIndex] });
|
|
27
|
+
return report(out);
|
|
28
|
+
});
|
|
29
|
+
server.tool('jev_score', 'Score a subject against named criteria via jev System One (each score in [0,1]).', {
|
|
30
|
+
subject: z.string(),
|
|
31
|
+
criteria: z.array(z.string()).min(1),
|
|
32
|
+
fallbackScore: z.number().min(0).max(1).optional().describe('Neutral score used on failure (default 0.5)'),
|
|
33
|
+
}, async ({ subject, criteria, fallbackScore }) => {
|
|
34
|
+
const fb = fallbackScore ?? 0.5;
|
|
35
|
+
const out = await client.score({ subject, criteria }, { scores: criteria.map(() => fb) });
|
|
36
|
+
return report(out);
|
|
37
|
+
});
|
|
38
|
+
server.tool('jev_noul', 'Unconstrained jev "noul" reflection on a prompt.', {
|
|
39
|
+
prompt: z.string(),
|
|
40
|
+
fallbackText: z.string().optional().describe('Text used if jev is unavailable (default: empty)'),
|
|
41
|
+
}, async ({ prompt, fallbackText }) => {
|
|
42
|
+
const out = await client.noul({ prompt }, { text: fallbackText ?? '' });
|
|
43
|
+
return report(out);
|
|
44
|
+
});
|
|
45
|
+
const transport = new StdioServerTransport();
|
|
46
|
+
await server.connect(transport);
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-jev/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server exposing jev System One choice/score/noul tools to dsh (DeepSeek Harness)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dsh-jev-mcp": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@dsh-jev/core": "workspace:*",
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
22
|
+
"zod": "^3.23.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.6.0"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT"
|
|
28
|
+
}
|