jev-cli 0.5.0__tar.gz → 0.6.2__tar.gz
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.
- {jev_cli-0.5.0 → jev_cli-0.6.2}/PKG-INFO +93 -8
- {jev_cli-0.5.0 → jev_cli-0.6.2}/README.md +89 -5
- {jev_cli-0.5.0 → jev_cli-0.6.2}/pyproject.toml +5 -4
- {jev_cli-0.5.0 → jev_cli-0.6.2}/skills/jev-cli/SKILL.md +9 -6
- {jev_cli-0.5.0/src/jev_cli/bundled_skills → jev_cli-0.6.2/skills}/jev-cli/references/cli.md +44 -1
- {jev_cli-0.5.0 → jev_cli-0.6.2}/src/jev_cli/__init__.py +61 -14
- {jev_cli-0.5.0 → jev_cli-0.6.2}/src/jev_cli/bundled_skills/jev-cli/SKILL.md +9 -6
- {jev_cli-0.5.0/skills → jev_cli-0.6.2/src/jev_cli/bundled_skills}/jev-cli/references/cli.md +44 -1
- jev_cli-0.6.2/src/jev_cli/mcp_server.py +288 -0
- {jev_cli-0.5.0 → jev_cli-0.6.2}/tests/test_jev.py +27 -2
- jev_cli-0.6.2/tests/test_mcp_server.py +500 -0
- {jev_cli-0.5.0 → jev_cli-0.6.2}/LICENSE +0 -0
- {jev_cli-0.5.0 → jev_cli-0.6.2}/scripts/embed_skills.py +0 -0
- {jev_cli-0.5.0 → jev_cli-0.6.2}/src/jev_cli/py.typed +0 -0
- {jev_cli-0.5.0 → jev_cli-0.6.2}/tests/test_skill.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jev-cli
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Small
|
|
5
|
-
Keywords: typesafe,jev,cli,ai
|
|
3
|
+
Version: 0.6.2
|
|
4
|
+
Summary: Small CLI and stdio MCP server for TypeSafe Jev
|
|
5
|
+
Keywords: typesafe,jev,cli,mcp,ai
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
License-File: LICENSE
|
|
8
8
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -10,6 +10,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
12
12
|
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Dist: mcp>=2.2.0,<3
|
|
13
14
|
Requires-Python: >=3.13
|
|
14
15
|
Project-URL: Homepage, https://github.com/tumf/jev-cli
|
|
15
16
|
Project-URL: Issues, https://github.com/tumf/jev-cli/issues
|
|
@@ -18,9 +19,21 @@ Description-Content-Type: text/markdown
|
|
|
18
19
|
|
|
19
20
|
# jev-cli
|
|
20
21
|
|
|
21
|
-
A small
|
|
22
|
+
A small CLI and stdio MCP server for [TypeSafe Jev](https://docs.typesafe.ai/introduction). Send text or JSON state, ask typed questions, and receive machine-readable `noul`, `choice`, or `score` answers.
|
|
22
23
|
|
|
23
|
-
The `jev` command is useful when application code needs a fast classification or judgment instead of generated prose.
|
|
24
|
+
The `jev` command is useful when application code needs a fast classification or judgment instead of generated prose. The `jev-mcp` command exposes the same judgments to MCP hosts over stdio.
|
|
25
|
+
|
|
26
|
+
[](assets/jev-cli-terminal-demo.mp4)
|
|
27
|
+
|
|
28
|
+
_Click the thumbnail to watch the 19-second terminal demo._
|
|
29
|
+
|
|
30
|
+
## Screenshots
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+

|
|
24
37
|
|
|
25
38
|
> **Unofficial:** This is an independent community project. It is not affiliated with, maintained by, or endorsed by TypeSafe AI.
|
|
26
39
|
|
|
@@ -32,7 +45,7 @@ The `jev` command is useful when application code needs a fast classification or
|
|
|
32
45
|
- Emits compact JSON by default
|
|
33
46
|
- Can print only the primary value for shell scripts
|
|
34
47
|
- Uses structured stderr errors and meaningful exit codes
|
|
35
|
-
-
|
|
48
|
+
- Ships a stdio MCP server, `jev-mcp`, in the same installation
|
|
36
49
|
|
|
37
50
|
## Requirements
|
|
38
51
|
|
|
@@ -43,7 +56,7 @@ The `jev` command is useful when application code needs a fast classification or
|
|
|
43
56
|
|
|
44
57
|
## Install
|
|
45
58
|
|
|
46
|
-
Install `jev-cli` from PyPI with `uv tool`. This keeps the
|
|
59
|
+
Install `jev-cli` from PyPI with `uv tool`. This keeps the commands in an isolated environment and makes both `jev` and `jev-mcp` available on your `PATH`. There is no optional extra to select; the MCP server is part of the normal installation.
|
|
47
60
|
|
|
48
61
|
```bash
|
|
49
62
|
uv tool install jev-cli
|
|
@@ -58,7 +71,7 @@ jev --version
|
|
|
58
71
|
Expected output:
|
|
59
72
|
|
|
60
73
|
```text
|
|
61
|
-
jev 0.
|
|
74
|
+
jev 0.6.2
|
|
62
75
|
```
|
|
63
76
|
|
|
64
77
|
## Authentication
|
|
@@ -296,6 +309,78 @@ A request can also be piped through stdin:
|
|
|
296
309
|
cat request.json | jev run - --pretty
|
|
297
310
|
```
|
|
298
311
|
|
|
312
|
+
## MCP server
|
|
313
|
+
|
|
314
|
+
`jev-mcp` is a stdio [MCP](https://modelcontextprotocol.io) server installed alongside `jev`. It exposes four tools that map to the CLI commands:
|
|
315
|
+
|
|
316
|
+
| Tool | Purpose | Required inputs |
|
|
317
|
+
|---|---|---|
|
|
318
|
+
| `noul` | One yes/no judgment with a probability | `state`, `question` |
|
|
319
|
+
| `choice` | One selection from a typed option map | `state`, `question`, `options` |
|
|
320
|
+
| `score` | One evaluation against ordered levels | `state`, `question`, `levels` |
|
|
321
|
+
| `run` | A complete multi-question System One request | `request` |
|
|
322
|
+
|
|
323
|
+
`choice` requires at least two options and `score` requires at least two levels; a smaller request is rejected as a tool error before any provider call.
|
|
324
|
+
|
|
325
|
+
Every argument is described in the published tool schemas, so a host can construct a call without reading this page. `run` takes one complete System One request; its `questions` keys become the answer keys in the response:
|
|
326
|
+
|
|
327
|
+
```json
|
|
328
|
+
{
|
|
329
|
+
"request": {
|
|
330
|
+
"state": {"message": "The invoice is wrong again and I want a refund."},
|
|
331
|
+
"questions": {
|
|
332
|
+
"urgent": {"type": "noul", "instructions": "Does this need a reply today?"},
|
|
333
|
+
"team": {
|
|
334
|
+
"type": "choice",
|
|
335
|
+
"instructions": "Which team should own this?",
|
|
336
|
+
"criteria": {"billing": "Invoice or payment problem", "support": "Product or account problem"}
|
|
337
|
+
},
|
|
338
|
+
"anger": {
|
|
339
|
+
"type": "score",
|
|
340
|
+
"instructions": "How frustrated is the sender?",
|
|
341
|
+
"criteria": ["Calm", "Annoyed", "Angry"]
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Request members this client does not know are forwarded to the provider unchanged.
|
|
349
|
+
|
|
350
|
+
Every tool also accepts the optional `provider`, `model`, and `endpoint` arguments. Authentication, provider selection, model defaults, endpoint resolution, and response normalization are the same as for `jev`, including `JEV_PROVIDER` and the credential store, so no separate setup is required.
|
|
351
|
+
|
|
352
|
+
Add the server to an MCP host with a minimal stdio entry:
|
|
353
|
+
|
|
354
|
+
```json
|
|
355
|
+
{
|
|
356
|
+
"mcpServers": {
|
|
357
|
+
"jev": {
|
|
358
|
+
"command": "jev-mcp"
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Pass provider configuration through the host's environment block when the default is not wanted:
|
|
365
|
+
|
|
366
|
+
```json
|
|
367
|
+
{
|
|
368
|
+
"mcpServers": {
|
|
369
|
+
"jev": {
|
|
370
|
+
"command": "jev-mcp",
|
|
371
|
+
"env": {
|
|
372
|
+
"JEV_PROVIDER": "openrouter",
|
|
373
|
+
"OPENROUTER_API_KEY": "your-api-key"
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
`state` is sent verbatim over MCP. Unlike the CLI, `-` does not read stdin and a leading `@` does not read a file, because stdin carries the MCP protocol frames. Read a file in the host and pass its content as `state`.
|
|
381
|
+
|
|
382
|
+
Invalid input and provider failures are returned as MCP tool errors and never include the API key. stdout carries MCP protocol frames only; diagnostics go to stderr.
|
|
383
|
+
|
|
299
384
|
## Output and automation
|
|
300
385
|
|
|
301
386
|
The default stdout is one JSON object. Logs and structured errors go to stderr, so stdout can be piped directly into another program.
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
# jev-cli
|
|
2
2
|
|
|
3
|
-
A small
|
|
3
|
+
A small CLI and stdio MCP server for [TypeSafe Jev](https://docs.typesafe.ai/introduction). Send text or JSON state, ask typed questions, and receive machine-readable `noul`, `choice`, or `score` answers.
|
|
4
4
|
|
|
5
|
-
The `jev` command is useful when application code needs a fast classification or judgment instead of generated prose.
|
|
5
|
+
The `jev` command is useful when application code needs a fast classification or judgment instead of generated prose. The `jev-mcp` command exposes the same judgments to MCP hosts over stdio.
|
|
6
|
+
|
|
7
|
+
[](assets/jev-cli-terminal-demo.mp4)
|
|
8
|
+
|
|
9
|
+
_Click the thumbnail to watch the 19-second terminal demo._
|
|
10
|
+
|
|
11
|
+
## Screenshots
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+

|
|
6
18
|
|
|
7
19
|
> **Unofficial:** This is an independent community project. It is not affiliated with, maintained by, or endorsed by TypeSafe AI.
|
|
8
20
|
|
|
@@ -14,7 +26,7 @@ The `jev` command is useful when application code needs a fast classification or
|
|
|
14
26
|
- Emits compact JSON by default
|
|
15
27
|
- Can print only the primary value for shell scripts
|
|
16
28
|
- Uses structured stderr errors and meaningful exit codes
|
|
17
|
-
-
|
|
29
|
+
- Ships a stdio MCP server, `jev-mcp`, in the same installation
|
|
18
30
|
|
|
19
31
|
## Requirements
|
|
20
32
|
|
|
@@ -25,7 +37,7 @@ The `jev` command is useful when application code needs a fast classification or
|
|
|
25
37
|
|
|
26
38
|
## Install
|
|
27
39
|
|
|
28
|
-
Install `jev-cli` from PyPI with `uv tool`. This keeps the
|
|
40
|
+
Install `jev-cli` from PyPI with `uv tool`. This keeps the commands in an isolated environment and makes both `jev` and `jev-mcp` available on your `PATH`. There is no optional extra to select; the MCP server is part of the normal installation.
|
|
29
41
|
|
|
30
42
|
```bash
|
|
31
43
|
uv tool install jev-cli
|
|
@@ -40,7 +52,7 @@ jev --version
|
|
|
40
52
|
Expected output:
|
|
41
53
|
|
|
42
54
|
```text
|
|
43
|
-
jev 0.
|
|
55
|
+
jev 0.6.2
|
|
44
56
|
```
|
|
45
57
|
|
|
46
58
|
## Authentication
|
|
@@ -278,6 +290,78 @@ A request can also be piped through stdin:
|
|
|
278
290
|
cat request.json | jev run - --pretty
|
|
279
291
|
```
|
|
280
292
|
|
|
293
|
+
## MCP server
|
|
294
|
+
|
|
295
|
+
`jev-mcp` is a stdio [MCP](https://modelcontextprotocol.io) server installed alongside `jev`. It exposes four tools that map to the CLI commands:
|
|
296
|
+
|
|
297
|
+
| Tool | Purpose | Required inputs |
|
|
298
|
+
|---|---|---|
|
|
299
|
+
| `noul` | One yes/no judgment with a probability | `state`, `question` |
|
|
300
|
+
| `choice` | One selection from a typed option map | `state`, `question`, `options` |
|
|
301
|
+
| `score` | One evaluation against ordered levels | `state`, `question`, `levels` |
|
|
302
|
+
| `run` | A complete multi-question System One request | `request` |
|
|
303
|
+
|
|
304
|
+
`choice` requires at least two options and `score` requires at least two levels; a smaller request is rejected as a tool error before any provider call.
|
|
305
|
+
|
|
306
|
+
Every argument is described in the published tool schemas, so a host can construct a call without reading this page. `run` takes one complete System One request; its `questions` keys become the answer keys in the response:
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"request": {
|
|
311
|
+
"state": {"message": "The invoice is wrong again and I want a refund."},
|
|
312
|
+
"questions": {
|
|
313
|
+
"urgent": {"type": "noul", "instructions": "Does this need a reply today?"},
|
|
314
|
+
"team": {
|
|
315
|
+
"type": "choice",
|
|
316
|
+
"instructions": "Which team should own this?",
|
|
317
|
+
"criteria": {"billing": "Invoice or payment problem", "support": "Product or account problem"}
|
|
318
|
+
},
|
|
319
|
+
"anger": {
|
|
320
|
+
"type": "score",
|
|
321
|
+
"instructions": "How frustrated is the sender?",
|
|
322
|
+
"criteria": ["Calm", "Annoyed", "Angry"]
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Request members this client does not know are forwarded to the provider unchanged.
|
|
330
|
+
|
|
331
|
+
Every tool also accepts the optional `provider`, `model`, and `endpoint` arguments. Authentication, provider selection, model defaults, endpoint resolution, and response normalization are the same as for `jev`, including `JEV_PROVIDER` and the credential store, so no separate setup is required.
|
|
332
|
+
|
|
333
|
+
Add the server to an MCP host with a minimal stdio entry:
|
|
334
|
+
|
|
335
|
+
```json
|
|
336
|
+
{
|
|
337
|
+
"mcpServers": {
|
|
338
|
+
"jev": {
|
|
339
|
+
"command": "jev-mcp"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Pass provider configuration through the host's environment block when the default is not wanted:
|
|
346
|
+
|
|
347
|
+
```json
|
|
348
|
+
{
|
|
349
|
+
"mcpServers": {
|
|
350
|
+
"jev": {
|
|
351
|
+
"command": "jev-mcp",
|
|
352
|
+
"env": {
|
|
353
|
+
"JEV_PROVIDER": "openrouter",
|
|
354
|
+
"OPENROUTER_API_KEY": "your-api-key"
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
`state` is sent verbatim over MCP. Unlike the CLI, `-` does not read stdin and a leading `@` does not read a file, because stdin carries the MCP protocol frames. Read a file in the host and pass its content as `state`.
|
|
362
|
+
|
|
363
|
+
Invalid input and provider failures are returned as MCP tool errors and never include the API key. stdout carries MCP protocol frames only; diagnostics go to stderr.
|
|
364
|
+
|
|
281
365
|
## Output and automation
|
|
282
366
|
|
|
283
367
|
The default stdout is one JSON object. Logs and structured errors go to stderr, so stdout can be piped directly into another program.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "jev-cli"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "Small
|
|
3
|
+
version = "0.6.2"
|
|
4
|
+
description = "Small CLI and stdio MCP server for TypeSafe Jev"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
7
7
|
license-files = ["LICENSE"]
|
|
8
8
|
requires-python = ">=3.13"
|
|
9
|
-
dependencies = []
|
|
10
|
-
keywords = ["typesafe", "jev", "cli", "ai"]
|
|
9
|
+
dependencies = ["mcp>=2.2.0,<3"]
|
|
10
|
+
keywords = ["typesafe", "jev", "cli", "mcp", "ai"]
|
|
11
11
|
classifiers = [
|
|
12
12
|
"Development Status :: 3 - Alpha",
|
|
13
13
|
"License :: OSI Approved :: MIT License",
|
|
@@ -23,6 +23,7 @@ Issues = "https://github.com/tumf/jev-cli/issues"
|
|
|
23
23
|
|
|
24
24
|
[project.scripts]
|
|
25
25
|
jev = "jev_cli:main"
|
|
26
|
+
jev-mcp = "jev_cli.mcp_server:main"
|
|
26
27
|
|
|
27
28
|
[build-system]
|
|
28
29
|
requires = ["uv_build>=0.8.15,<0.9.0"]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jev-cli
|
|
3
|
-
description: Use when classifying or scoring state with the `jev` CLI.
|
|
3
|
+
description: Use when classifying or scoring state with the `jev` CLI or the `jev-mcp` stdio MCP server.
|
|
4
4
|
version: 0.1.0
|
|
5
5
|
author: tumf
|
|
6
6
|
license: MIT
|
|
7
7
|
metadata:
|
|
8
8
|
hermes:
|
|
9
|
-
tags: [jev, cli, classification, scoring]
|
|
9
|
+
tags: [jev, cli, mcp, classification, scoring]
|
|
10
10
|
related_skills: []
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -16,7 +16,9 @@ metadata:
|
|
|
16
16
|
|
|
17
17
|
Use the `jev` command to ask TypeSafe Jev typed questions about text or JSON state. Prefer this skill when a task needs a compact machine-readable probability, one choice from explicit criteria, an ordered score, or several typed answers in one request.
|
|
18
18
|
|
|
19
|
-
The package and repository are named `jev-cli
|
|
19
|
+
The package and repository are named `jev-cli`. `uv tool install jev-cli` installs two commands: `jev` for the shell and `jev-mcp` for MCP hosts. No optional extra is required.
|
|
20
|
+
|
|
21
|
+
When the host already has the `jev` MCP server connected, call its `noul`, `choice`, `score`, or `run` tool instead of shelling out. Use the `jev` command otherwise.
|
|
20
22
|
|
|
21
23
|
Install this bundled skill with `jev install-skills`. Add `--global` for the user-wide target and `--claude` for Claude skill directories.
|
|
22
24
|
|
|
@@ -32,25 +34,26 @@ Install this bundled skill with `jev install-skills`. Add `--global` for the use
|
|
|
32
34
|
4. Send only the state needed for the judgment. The selected provider receives the submitted state and questions, so do not send secrets or private data without explicit authorization.
|
|
33
35
|
5. Use default JSON output for automation. Use `--value` only when a scalar is sufficient. Completion: parse the result and account for the exit code before acting on it.
|
|
34
36
|
|
|
35
|
-
Read [references/cli.md](references/cli.md) for copy-paste command forms, inputs, output controls, and
|
|
37
|
+
Read [references/cli.md](references/cli.md) for copy-paste command forms, inputs, output controls, exit codes, and the `jev-mcp` stdio server configuration.
|
|
36
38
|
|
|
37
39
|
## Decision rules
|
|
38
40
|
|
|
39
41
|
- Give `choice` options stable keys and descriptions that make the categories mutually understandable.
|
|
40
42
|
- Give `score` levels in ascending order; the returned number may be fractional.
|
|
41
43
|
- Use `--json-state` only when the state must retain JSON structure.
|
|
42
|
-
- Use `@file` or stdin for long input instead of embedding it in shell arguments.
|
|
44
|
+
- Use `@file` or stdin for long input instead of embedding it in shell arguments. These forms are CLI-only: the MCP tools send `state` verbatim, so read the file in the host and pass its content.
|
|
43
45
|
- The official TypeSafe API is the default. Use `--provider vercel`, `--provider openrouter`, or `--provider custom` only when the caller selects another provider.
|
|
44
46
|
- Use the provider-specific environment variable only for process-level overrides: `TYPESAFE_API_KEY`, `AI_GATEWAY_API_KEY`, `OPENROUTER_API_KEY`, or `JEV_API_KEY`. A custom provider also requires `JEV_ENDPOINT`; `JEV_MODEL` is optional. The normal credential store remains under the user's config directory.
|
|
45
47
|
- Treat model output as a structured judgment, not verified fact. Keep consequential actions behind the caller's own validation and authorization rules.
|
|
46
48
|
|
|
47
49
|
## Common pitfalls
|
|
48
50
|
|
|
49
|
-
1. **Calling the executable `jev-cli`.** The package is `jev-cli`, but the
|
|
51
|
+
1. **Calling the executable `jev-cli`.** The package is `jev-cli`, but the executables are `jev` and `jev-mcp`.
|
|
50
52
|
2. **Using `--value` with `run`.** Batched requests require the JSON response.
|
|
51
53
|
3. **Treating transport failures as negative answers.** Exit code `4` means retryable API or network failure, not a model judgment.
|
|
52
54
|
4. **Leaking state through convenience.** Inspect file and stdin content before submission when it may contain credentials or private records.
|
|
53
55
|
5. **Embedding an API key in examples.** Use `jev auth set` through stdin or the environment variable without writing its value into scripts or documentation.
|
|
56
|
+
6. **Running `jev-mcp` by hand.** Its stdin and stdout carry MCP protocol frames; start it only from an MCP host configuration.
|
|
54
57
|
|
|
55
58
|
## Verification checklist
|
|
56
59
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# CLI reference
|
|
1
|
+
# CLI and MCP reference
|
|
2
2
|
|
|
3
3
|
## Authentication
|
|
4
4
|
|
|
@@ -146,6 +146,49 @@ jev noul --question 'Does this require action?' --state 'Please investigate.' --
|
|
|
146
146
|
|
|
147
147
|
Read stderr as JSON on failure. Do not interpret a nonzero exit as a model answer.
|
|
148
148
|
|
|
149
|
+
## MCP server
|
|
150
|
+
|
|
151
|
+
`jev-mcp` is a stdio MCP server installed by the same package; no optional extra is required. It exposes four tools that mirror the CLI commands:
|
|
152
|
+
|
|
153
|
+
| Tool | Purpose | Required inputs |
|
|
154
|
+
|---|---|---|
|
|
155
|
+
| `noul` | One yes/no judgment with a probability | `state`, `question` |
|
|
156
|
+
| `choice` | One selection from a typed option map | `state`, `question`, `options` |
|
|
157
|
+
| `score` | One evaluation against ordered levels | `state`, `question`, `levels` |
|
|
158
|
+
| `run` | A complete multi-question System One request | `request` |
|
|
159
|
+
|
|
160
|
+
Each tool also accepts optional `provider`, `model`, and `endpoint` arguments. Provider selection, model defaults, endpoint resolution, credential lookup, and response normalization are identical to the CLI, so `JEV_PROVIDER`, the provider environment variables, and the credential store all apply unchanged.
|
|
161
|
+
|
|
162
|
+
Minimal stdio host configuration:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"jev": {
|
|
168
|
+
"command": "jev-mcp"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Select a non-default provider through the host's environment block:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"mcpServers": {
|
|
179
|
+
"jev": {
|
|
180
|
+
"command": "jev-mcp",
|
|
181
|
+
"env": {
|
|
182
|
+
"JEV_PROVIDER": "openrouter",
|
|
183
|
+
"OPENROUTER_API_KEY": "your-api-key"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`state` is sent verbatim. `-` does not read stdin and a leading `@` does not read a file, because stdin carries the MCP protocol frames. Invalid input and provider failures return MCP tool errors without the API key, and stdout carries protocol frames only.
|
|
191
|
+
|
|
149
192
|
## Installation
|
|
150
193
|
|
|
151
194
|
From the repository root:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""Small
|
|
2
|
+
"""Small CLI and stdio MCP server for TypeSafe Jev."""
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
@@ -49,6 +49,44 @@ class CliError(Exception):
|
|
|
49
49
|
self.exit_code = exit_code
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
def masked_getpass(prompt: str) -> str:
|
|
53
|
+
"""Read a secret while showing one asterisk per entered character."""
|
|
54
|
+
try:
|
|
55
|
+
import termios
|
|
56
|
+
except ImportError:
|
|
57
|
+
return getpass.getpass(prompt)
|
|
58
|
+
|
|
59
|
+
stream = sys.stderr
|
|
60
|
+
stream.write(prompt)
|
|
61
|
+
stream.flush()
|
|
62
|
+
fd = sys.stdin.fileno()
|
|
63
|
+
previous = termios.tcgetattr(fd)
|
|
64
|
+
current = previous.copy()
|
|
65
|
+
current[3] &= ~(termios.ECHO | termios.ICANON)
|
|
66
|
+
characters: list[str] = []
|
|
67
|
+
try:
|
|
68
|
+
termios.tcsetattr(fd, termios.TCSADRAIN, current)
|
|
69
|
+
while True:
|
|
70
|
+
character = sys.stdin.read(1)
|
|
71
|
+
if character in ("\n", "\r"):
|
|
72
|
+
stream.write("\n")
|
|
73
|
+
return "".join(characters)
|
|
74
|
+
if character == "\x03":
|
|
75
|
+
raise KeyboardInterrupt
|
|
76
|
+
if character in ("\x7f", "\b"):
|
|
77
|
+
if characters:
|
|
78
|
+
characters.pop()
|
|
79
|
+
stream.write("\b \b")
|
|
80
|
+
elif character:
|
|
81
|
+
characters.append(character)
|
|
82
|
+
stream.write("*")
|
|
83
|
+
else:
|
|
84
|
+
raise EOFError
|
|
85
|
+
stream.flush()
|
|
86
|
+
finally:
|
|
87
|
+
termios.tcsetattr(fd, termios.TCSADRAIN, previous)
|
|
88
|
+
|
|
89
|
+
|
|
52
90
|
def api_key(provider: str = "official") -> str:
|
|
53
91
|
config = PROVIDERS[provider]
|
|
54
92
|
if value := os.environ.get(config["key_env"]):
|
|
@@ -73,7 +111,7 @@ def api_key(provider: str = "official") -> str:
|
|
|
73
111
|
|
|
74
112
|
def set_api_key(provider: str = "official") -> None:
|
|
75
113
|
label = "TypeSafe" if provider == "official" else provider
|
|
76
|
-
value =
|
|
114
|
+
value = masked_getpass(f"{label} API key: ").strip() if sys.stdin.isatty() else sys.stdin.read().strip()
|
|
77
115
|
if not value:
|
|
78
116
|
raise CliError("API key is empty")
|
|
79
117
|
CREDENTIALS_FILE.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
|
@@ -241,7 +279,7 @@ def call(payload: dict[str, Any], endpoint: str, provider: str = "official") ->
|
|
|
241
279
|
headers={
|
|
242
280
|
"Authorization": f"Bearer {api_key(provider)}",
|
|
243
281
|
"Content-Type": "application/json",
|
|
244
|
-
"User-Agent": "jev-cli/0.
|
|
282
|
+
"User-Agent": "jev-cli/0.6.2",
|
|
245
283
|
**provider_headers,
|
|
246
284
|
},
|
|
247
285
|
method="POST",
|
|
@@ -286,7 +324,7 @@ def parser() -> argparse.ArgumentParser:
|
|
|
286
324
|
prog="jev",
|
|
287
325
|
description="Evaluate text or JSON with TypeSafe Jev. Uses its own local credential store.",
|
|
288
326
|
)
|
|
289
|
-
root.add_argument("--version", action="version", version="jev 0.
|
|
327
|
+
root.add_argument("--version", action="version", version="jev 0.6.2")
|
|
290
328
|
sub = root.add_subparsers(dest="command", required=True)
|
|
291
329
|
common = common_parser()
|
|
292
330
|
|
|
@@ -323,22 +361,28 @@ def parser() -> argparse.ArgumentParser:
|
|
|
323
361
|
return root
|
|
324
362
|
|
|
325
363
|
|
|
364
|
+
def question_request(kind: str, state: Any, question: str, criteria: Any, model: str) -> dict[str, Any]:
|
|
365
|
+
"""Build a single-question System One request shared by the CLI and the MCP server."""
|
|
366
|
+
specification: dict[str, Any] = {"type": kind, "instructions": question}
|
|
367
|
+
if criteria is not None:
|
|
368
|
+
specification["criteria"] = criteria
|
|
369
|
+
return {"state": state, "model": model, "questions": {"answer": specification}}
|
|
370
|
+
|
|
371
|
+
|
|
326
372
|
def request_for(args: argparse.Namespace) -> tuple[dict[str, Any], str | None]:
|
|
327
373
|
if args.command == "run":
|
|
328
374
|
payload = load_request(args.request)
|
|
329
375
|
payload.setdefault("model", args.model or provider_model(args.provider))
|
|
330
376
|
return payload, None
|
|
331
377
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
"questions": {"answer": question},
|
|
341
|
-
}
|
|
378
|
+
criteria = dict(args.option) if args.command == "choice" else args.level if args.command == "score" else None
|
|
379
|
+
payload = question_request(
|
|
380
|
+
args.command,
|
|
381
|
+
state_value(args.state, args.json_state),
|
|
382
|
+
args.question,
|
|
383
|
+
criteria,
|
|
384
|
+
args.model or provider_model(args.provider),
|
|
385
|
+
)
|
|
342
386
|
return payload, args.command
|
|
343
387
|
|
|
344
388
|
|
|
@@ -394,6 +438,9 @@ def main() -> int:
|
|
|
394
438
|
except (KeyError, TypeError) as exc:
|
|
395
439
|
print(json.dumps({"ok": False, "error": f"unexpected API response: {exc}"}), file=sys.stderr)
|
|
396
440
|
return 1
|
|
441
|
+
except KeyboardInterrupt:
|
|
442
|
+
print("\nCancelled.", file=sys.stderr)
|
|
443
|
+
return 130
|
|
397
444
|
|
|
398
445
|
|
|
399
446
|
if __name__ == "__main__":
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jev-cli
|
|
3
|
-
description: Use when classifying or scoring state with the `jev` CLI.
|
|
3
|
+
description: Use when classifying or scoring state with the `jev` CLI or the `jev-mcp` stdio MCP server.
|
|
4
4
|
version: 0.1.0
|
|
5
5
|
author: tumf
|
|
6
6
|
license: MIT
|
|
7
7
|
metadata:
|
|
8
8
|
hermes:
|
|
9
|
-
tags: [jev, cli, classification, scoring]
|
|
9
|
+
tags: [jev, cli, mcp, classification, scoring]
|
|
10
10
|
related_skills: []
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -16,7 +16,9 @@ metadata:
|
|
|
16
16
|
|
|
17
17
|
Use the `jev` command to ask TypeSafe Jev typed questions about text or JSON state. Prefer this skill when a task needs a compact machine-readable probability, one choice from explicit criteria, an ordered score, or several typed answers in one request.
|
|
18
18
|
|
|
19
|
-
The package and repository are named `jev-cli
|
|
19
|
+
The package and repository are named `jev-cli`. `uv tool install jev-cli` installs two commands: `jev` for the shell and `jev-mcp` for MCP hosts. No optional extra is required.
|
|
20
|
+
|
|
21
|
+
When the host already has the `jev` MCP server connected, call its `noul`, `choice`, `score`, or `run` tool instead of shelling out. Use the `jev` command otherwise.
|
|
20
22
|
|
|
21
23
|
Install this bundled skill with `jev install-skills`. Add `--global` for the user-wide target and `--claude` for Claude skill directories.
|
|
22
24
|
|
|
@@ -32,25 +34,26 @@ Install this bundled skill with `jev install-skills`. Add `--global` for the use
|
|
|
32
34
|
4. Send only the state needed for the judgment. The selected provider receives the submitted state and questions, so do not send secrets or private data without explicit authorization.
|
|
33
35
|
5. Use default JSON output for automation. Use `--value` only when a scalar is sufficient. Completion: parse the result and account for the exit code before acting on it.
|
|
34
36
|
|
|
35
|
-
Read [references/cli.md](references/cli.md) for copy-paste command forms, inputs, output controls, and
|
|
37
|
+
Read [references/cli.md](references/cli.md) for copy-paste command forms, inputs, output controls, exit codes, and the `jev-mcp` stdio server configuration.
|
|
36
38
|
|
|
37
39
|
## Decision rules
|
|
38
40
|
|
|
39
41
|
- Give `choice` options stable keys and descriptions that make the categories mutually understandable.
|
|
40
42
|
- Give `score` levels in ascending order; the returned number may be fractional.
|
|
41
43
|
- Use `--json-state` only when the state must retain JSON structure.
|
|
42
|
-
- Use `@file` or stdin for long input instead of embedding it in shell arguments.
|
|
44
|
+
- Use `@file` or stdin for long input instead of embedding it in shell arguments. These forms are CLI-only: the MCP tools send `state` verbatim, so read the file in the host and pass its content.
|
|
43
45
|
- The official TypeSafe API is the default. Use `--provider vercel`, `--provider openrouter`, or `--provider custom` only when the caller selects another provider.
|
|
44
46
|
- Use the provider-specific environment variable only for process-level overrides: `TYPESAFE_API_KEY`, `AI_GATEWAY_API_KEY`, `OPENROUTER_API_KEY`, or `JEV_API_KEY`. A custom provider also requires `JEV_ENDPOINT`; `JEV_MODEL` is optional. The normal credential store remains under the user's config directory.
|
|
45
47
|
- Treat model output as a structured judgment, not verified fact. Keep consequential actions behind the caller's own validation and authorization rules.
|
|
46
48
|
|
|
47
49
|
## Common pitfalls
|
|
48
50
|
|
|
49
|
-
1. **Calling the executable `jev-cli`.** The package is `jev-cli`, but the
|
|
51
|
+
1. **Calling the executable `jev-cli`.** The package is `jev-cli`, but the executables are `jev` and `jev-mcp`.
|
|
50
52
|
2. **Using `--value` with `run`.** Batched requests require the JSON response.
|
|
51
53
|
3. **Treating transport failures as negative answers.** Exit code `4` means retryable API or network failure, not a model judgment.
|
|
52
54
|
4. **Leaking state through convenience.** Inspect file and stdin content before submission when it may contain credentials or private records.
|
|
53
55
|
5. **Embedding an API key in examples.** Use `jev auth set` through stdin or the environment variable without writing its value into scripts or documentation.
|
|
56
|
+
6. **Running `jev-mcp` by hand.** Its stdin and stdout carry MCP protocol frames; start it only from an MCP host configuration.
|
|
54
57
|
|
|
55
58
|
## Verification checklist
|
|
56
59
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# CLI reference
|
|
1
|
+
# CLI and MCP reference
|
|
2
2
|
|
|
3
3
|
## Authentication
|
|
4
4
|
|
|
@@ -146,6 +146,49 @@ jev noul --question 'Does this require action?' --state 'Please investigate.' --
|
|
|
146
146
|
|
|
147
147
|
Read stderr as JSON on failure. Do not interpret a nonzero exit as a model answer.
|
|
148
148
|
|
|
149
|
+
## MCP server
|
|
150
|
+
|
|
151
|
+
`jev-mcp` is a stdio MCP server installed by the same package; no optional extra is required. It exposes four tools that mirror the CLI commands:
|
|
152
|
+
|
|
153
|
+
| Tool | Purpose | Required inputs |
|
|
154
|
+
|---|---|---|
|
|
155
|
+
| `noul` | One yes/no judgment with a probability | `state`, `question` |
|
|
156
|
+
| `choice` | One selection from a typed option map | `state`, `question`, `options` |
|
|
157
|
+
| `score` | One evaluation against ordered levels | `state`, `question`, `levels` |
|
|
158
|
+
| `run` | A complete multi-question System One request | `request` |
|
|
159
|
+
|
|
160
|
+
Each tool also accepts optional `provider`, `model`, and `endpoint` arguments. Provider selection, model defaults, endpoint resolution, credential lookup, and response normalization are identical to the CLI, so `JEV_PROVIDER`, the provider environment variables, and the credential store all apply unchanged.
|
|
161
|
+
|
|
162
|
+
Minimal stdio host configuration:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"jev": {
|
|
168
|
+
"command": "jev-mcp"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Select a non-default provider through the host's environment block:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"mcpServers": {
|
|
179
|
+
"jev": {
|
|
180
|
+
"command": "jev-mcp",
|
|
181
|
+
"env": {
|
|
182
|
+
"JEV_PROVIDER": "openrouter",
|
|
183
|
+
"OPENROUTER_API_KEY": "your-api-key"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`state` is sent verbatim. `-` does not read stdin and a leading `@` does not read a file, because stdin carries the MCP protocol frames. Invalid input and provider failures return MCP tool errors without the API key, and stdout carries protocol frames only.
|
|
191
|
+
|
|
149
192
|
## Installation
|
|
150
193
|
|
|
151
194
|
From the repository root:
|