jev-cli 0.5.0__tar.gz → 0.6.0__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.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jev-cli
3
- Version: 0.5.0
4
- Summary: Small dependency-free CLI for TypeSafe Jev
5
- Keywords: typesafe,jev,cli,ai
3
+ Version: 0.6.0
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,9 @@ Description-Content-Type: text/markdown
18
19
 
19
20
  # jev-cli
20
21
 
21
- A small, dependency-free CLI 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
+ 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.
24
25
 
25
26
  > **Unofficial:** This is an independent community project. It is not affiliated with, maintained by, or endorsed by TypeSafe AI.
26
27
 
@@ -32,7 +33,7 @@ The `jev` command is useful when application code needs a fast classification or
32
33
  - Emits compact JSON by default
33
34
  - Can print only the primary value for shell scripts
34
35
  - Uses structured stderr errors and meaningful exit codes
35
- - Has no runtime dependencies outside Python's standard library
36
+ - Ships a stdio MCP server, `jev-mcp`, in the same installation
36
37
 
37
38
  ## Requirements
38
39
 
@@ -43,7 +44,7 @@ The `jev` command is useful when application code needs a fast classification or
43
44
 
44
45
  ## Install
45
46
 
46
- Install `jev-cli` from PyPI with `uv tool`. This keeps the command in an isolated environment and makes `jev` available on your `PATH`.
47
+ 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
48
 
48
49
  ```bash
49
50
  uv tool install jev-cli
@@ -58,7 +59,7 @@ jev --version
58
59
  Expected output:
59
60
 
60
61
  ```text
61
- jev 0.5.0
62
+ jev 0.6.0
62
63
  ```
63
64
 
64
65
  ## Authentication
@@ -296,6 +297,78 @@ A request can also be piped through stdin:
296
297
  cat request.json | jev run - --pretty
297
298
  ```
298
299
 
300
+ ## MCP server
301
+
302
+ `jev-mcp` is a stdio [MCP](https://modelcontextprotocol.io) server installed alongside `jev`. It exposes four tools that map to the CLI commands:
303
+
304
+ | Tool | Purpose | Required inputs |
305
+ |---|---|---|
306
+ | `noul` | One yes/no judgment with a probability | `state`, `question` |
307
+ | `choice` | One selection from a typed option map | `state`, `question`, `options` |
308
+ | `score` | One evaluation against ordered levels | `state`, `question`, `levels` |
309
+ | `run` | A complete multi-question System One request | `request` |
310
+
311
+ `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.
312
+
313
+ 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:
314
+
315
+ ```json
316
+ {
317
+ "request": {
318
+ "state": {"message": "The invoice is wrong again and I want a refund."},
319
+ "questions": {
320
+ "urgent": {"type": "noul", "instructions": "Does this need a reply today?"},
321
+ "team": {
322
+ "type": "choice",
323
+ "instructions": "Which team should own this?",
324
+ "criteria": {"billing": "Invoice or payment problem", "support": "Product or account problem"}
325
+ },
326
+ "anger": {
327
+ "type": "score",
328
+ "instructions": "How frustrated is the sender?",
329
+ "criteria": ["Calm", "Annoyed", "Angry"]
330
+ }
331
+ }
332
+ }
333
+ }
334
+ ```
335
+
336
+ Request members this client does not know are forwarded to the provider unchanged.
337
+
338
+ 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.
339
+
340
+ Add the server to an MCP host with a minimal stdio entry:
341
+
342
+ ```json
343
+ {
344
+ "mcpServers": {
345
+ "jev": {
346
+ "command": "jev-mcp"
347
+ }
348
+ }
349
+ }
350
+ ```
351
+
352
+ Pass provider configuration through the host's environment block when the default is not wanted:
353
+
354
+ ```json
355
+ {
356
+ "mcpServers": {
357
+ "jev": {
358
+ "command": "jev-mcp",
359
+ "env": {
360
+ "JEV_PROVIDER": "openrouter",
361
+ "OPENROUTER_API_KEY": "your-api-key"
362
+ }
363
+ }
364
+ }
365
+ }
366
+ ```
367
+
368
+ `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`.
369
+
370
+ 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.
371
+
299
372
  ## Output and automation
300
373
 
301
374
  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,8 @@
1
1
  # jev-cli
2
2
 
3
- A small, dependency-free CLI 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.
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
6
 
7
7
  > **Unofficial:** This is an independent community project. It is not affiliated with, maintained by, or endorsed by TypeSafe AI.
8
8
 
@@ -14,7 +14,7 @@ The `jev` command is useful when application code needs a fast classification or
14
14
  - Emits compact JSON by default
15
15
  - Can print only the primary value for shell scripts
16
16
  - Uses structured stderr errors and meaningful exit codes
17
- - Has no runtime dependencies outside Python's standard library
17
+ - Ships a stdio MCP server, `jev-mcp`, in the same installation
18
18
 
19
19
  ## Requirements
20
20
 
@@ -25,7 +25,7 @@ The `jev` command is useful when application code needs a fast classification or
25
25
 
26
26
  ## Install
27
27
 
28
- Install `jev-cli` from PyPI with `uv tool`. This keeps the command in an isolated environment and makes `jev` available on your `PATH`.
28
+ 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
29
 
30
30
  ```bash
31
31
  uv tool install jev-cli
@@ -40,7 +40,7 @@ jev --version
40
40
  Expected output:
41
41
 
42
42
  ```text
43
- jev 0.5.0
43
+ jev 0.6.0
44
44
  ```
45
45
 
46
46
  ## Authentication
@@ -278,6 +278,78 @@ A request can also be piped through stdin:
278
278
  cat request.json | jev run - --pretty
279
279
  ```
280
280
 
281
+ ## MCP server
282
+
283
+ `jev-mcp` is a stdio [MCP](https://modelcontextprotocol.io) server installed alongside `jev`. It exposes four tools that map to the CLI commands:
284
+
285
+ | Tool | Purpose | Required inputs |
286
+ |---|---|---|
287
+ | `noul` | One yes/no judgment with a probability | `state`, `question` |
288
+ | `choice` | One selection from a typed option map | `state`, `question`, `options` |
289
+ | `score` | One evaluation against ordered levels | `state`, `question`, `levels` |
290
+ | `run` | A complete multi-question System One request | `request` |
291
+
292
+ `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.
293
+
294
+ 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:
295
+
296
+ ```json
297
+ {
298
+ "request": {
299
+ "state": {"message": "The invoice is wrong again and I want a refund."},
300
+ "questions": {
301
+ "urgent": {"type": "noul", "instructions": "Does this need a reply today?"},
302
+ "team": {
303
+ "type": "choice",
304
+ "instructions": "Which team should own this?",
305
+ "criteria": {"billing": "Invoice or payment problem", "support": "Product or account problem"}
306
+ },
307
+ "anger": {
308
+ "type": "score",
309
+ "instructions": "How frustrated is the sender?",
310
+ "criteria": ["Calm", "Annoyed", "Angry"]
311
+ }
312
+ }
313
+ }
314
+ }
315
+ ```
316
+
317
+ Request members this client does not know are forwarded to the provider unchanged.
318
+
319
+ 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.
320
+
321
+ Add the server to an MCP host with a minimal stdio entry:
322
+
323
+ ```json
324
+ {
325
+ "mcpServers": {
326
+ "jev": {
327
+ "command": "jev-mcp"
328
+ }
329
+ }
330
+ }
331
+ ```
332
+
333
+ Pass provider configuration through the host's environment block when the default is not wanted:
334
+
335
+ ```json
336
+ {
337
+ "mcpServers": {
338
+ "jev": {
339
+ "command": "jev-mcp",
340
+ "env": {
341
+ "JEV_PROVIDER": "openrouter",
342
+ "OPENROUTER_API_KEY": "your-api-key"
343
+ }
344
+ }
345
+ }
346
+ }
347
+ ```
348
+
349
+ `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`.
350
+
351
+ 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.
352
+
281
353
  ## Output and automation
282
354
 
283
355
  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.5.0"
4
- description = "Small dependency-free CLI for TypeSafe Jev"
3
+ version = "0.6.0"
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`; the installed command is `jev`.
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 exit codes.
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 executable is `jev`.
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, dependency-free CLI for TypeSafe Jev."""
2
+ """Small CLI and stdio MCP server for TypeSafe Jev."""
3
3
 
4
4
  from __future__ import annotations
5
5
 
@@ -241,7 +241,7 @@ def call(payload: dict[str, Any], endpoint: str, provider: str = "official") ->
241
241
  headers={
242
242
  "Authorization": f"Bearer {api_key(provider)}",
243
243
  "Content-Type": "application/json",
244
- "User-Agent": "jev-cli/0.5.0",
244
+ "User-Agent": "jev-cli/0.6.0",
245
245
  **provider_headers,
246
246
  },
247
247
  method="POST",
@@ -286,7 +286,7 @@ def parser() -> argparse.ArgumentParser:
286
286
  prog="jev",
287
287
  description="Evaluate text or JSON with TypeSafe Jev. Uses its own local credential store.",
288
288
  )
289
- root.add_argument("--version", action="version", version="jev 0.5.0")
289
+ root.add_argument("--version", action="version", version="jev 0.6.0")
290
290
  sub = root.add_subparsers(dest="command", required=True)
291
291
  common = common_parser()
292
292
 
@@ -323,22 +323,28 @@ def parser() -> argparse.ArgumentParser:
323
323
  return root
324
324
 
325
325
 
326
+ def question_request(kind: str, state: Any, question: str, criteria: Any, model: str) -> dict[str, Any]:
327
+ """Build a single-question System One request shared by the CLI and the MCP server."""
328
+ specification: dict[str, Any] = {"type": kind, "instructions": question}
329
+ if criteria is not None:
330
+ specification["criteria"] = criteria
331
+ return {"state": state, "model": model, "questions": {"answer": specification}}
332
+
333
+
326
334
  def request_for(args: argparse.Namespace) -> tuple[dict[str, Any], str | None]:
327
335
  if args.command == "run":
328
336
  payload = load_request(args.request)
329
337
  payload.setdefault("model", args.model or provider_model(args.provider))
330
338
  return payload, None
331
339
 
332
- question: dict[str, Any] = {"type": args.command, "instructions": args.question}
333
- if args.command == "choice":
334
- question["criteria"] = dict(args.option)
335
- elif args.command == "score":
336
- question["criteria"] = args.level
337
- payload = {
338
- "state": state_value(args.state, args.json_state),
339
- "model": args.model or provider_model(args.provider),
340
- "questions": {"answer": question},
341
- }
340
+ criteria = dict(args.option) if args.command == "choice" else args.level if args.command == "score" else None
341
+ payload = question_request(
342
+ args.command,
343
+ state_value(args.state, args.json_state),
344
+ args.question,
345
+ criteria,
346
+ args.model or provider_model(args.provider),
347
+ )
342
348
  return payload, args.command
343
349
 
344
350
 
@@ -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`; the installed command is `jev`.
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 exit codes.
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 executable is `jev`.
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: