typesafe-mcp

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: MIT

README

Typesafe MCP

evaluate is a stdio MCP server for TypeSafe Jev. Coding agents send observed state plus typed questions and get back probabilities, choices, and scores they can branch on in code.

Jev is a decision primitive. The host still reasons, edits, and executes.

Latest release Go version

┌────────────────┐   evaluate tool    ┌──────────┐   POST /v1/systemone   ┌──────────────┐
│ Claude Code    │ ─────────────────▶ │ evaluate │ ─────────────────────▶ │ TypeSafe API │
│ Claude Desktop │   MCP stdio        │  binary  │     or /decisions      │  or          │
│ Codex          │                    │          │     retries 429 / 529  │  OpenRouter  │
│ pi             │ ◀───────────────── │          │ ◀───────────────────── │              │
└────────────────┘   typed JSON       └──────────┘                        └──────────────┘

The tool contract is canonical in this binary: description, field docs, and agent guidance live in cmd/evaluate/tools.go. Claude Code, Claude Desktop, and Codex register that MCP surface. Stock pi has no MCP client, so evaluate setup pi writes an extension that registers the same tool and talks MCP to this binary. Pi that already loads MCP servers (pi-mcp-adapter and similar) registers evaluate mcp in that adapter's config, same as any other stdio server. Adapters own transport and registration only; they do not author Jev semantics.

Install

macOS and Linux, amd64 and arm64:

curl -fsSL https://raw.githubusercontent.com/PyModel/typesafe-mcp/main/install.sh | sh

Installs to ~/.local/bin. Add it to PATH if needed: export PATH="$HOME/.local/bin:$PATH". With Go 1.27+:

go install github.com/PyModel/typesafe-mcp/cmd/evaluate@latest

evaluate update upgrades in place from a checksum-verified GitHub release.

Setup

Get a key at https://console.typesafe.ai/

TYPESAFE_API_KEY=your-key evaluate setup mcp

That registers this binary with Claude Code (user scope) and Codex when their CLIs are on PATH, and with Claude Desktop when the app is installed. Every TYPESAFE_* variable in the shell is copied into the client config, plus OPENROUTER_API_KEY. Re-run to refresh.

Already on OpenRouter? Use that key and evaluate calls OpenRouter's Decisions endpoint, billed there:

OPENROUTER_API_KEY=your-key evaluate setup mcp

TYPESAFE_API_KEY wins if both are set, so a leftover OpenRouter key cannot reroute an existing TypeSafe setup. OpenRouter's Decisions path is still /api/alpha/ and may move.

For stock pi:

evaluate setup pi

Writes ~/.pi/agent/extensions/evaluate.ts (or $PI_CODING_AGENT_DIR/extensions/). Run /reload in pi. The extension reads the API key from the shell pi runs in; nothing is baked into the file.

If pi already loads MCP servers (pi-mcp-adapter and similar), add this binary to the adapter config (~/.pi/agent/mcp.json, or .mcp.json in the project):

{
  "mcpServers": {
    "evaluate": {
      "command": "/absolute/path/to/evaluate",
      "args": ["mcp"]
    }
  }
}

Reload pi. The adapter inherits TYPESAFE_API_KEY or OPENROUTER_API_KEY from the shell pi runs in, unless you set env on the server. Use one registration: the extension and an mcp.json entry both expose a tool named evaluate.

Any other MCP client: point it at /absolute/path/to/evaluate mcp with TYPESAFE_API_KEY or OPENROUTER_API_KEY in its env. Details: cmd/evaluate/AGENTS.md.

The tool

One tool, evaluate. Read-only. Request:

Field Required Meaning
state yes Evidence to judge: plain text, or a JSON object/array with named fields. What you observed, not your verdict about it.
questions yes Map of question id → {type, instructions, criteria?}. Ids are for your code; Jev never sees them, so instructions must carry the full meaning.
model no Defaults to jev-latest on TypeSafe, or ~typesafe/jev-latest on OpenRouter.
Type Criteria Answer
noul optional {true, false} descriptions Probability the condition holds, in [0, 1]. No separate confidence. Near 0.5 is uncertain, not medium intensity.
choice required map of option → description (or null). Include a no-match option when nothing may fit. Max 255 options. Chosen option, per-option probabilities, confidence (how peaked the distribution is).
score required ordered array of level descriptions, low to high Probability-weighted position, 0-indexed: N levels score 0 to N-1, so 3.87 over 5 levels sits between levels 3 and 4, not 3.87/5. Response includes legend and per-level probabilities.

Malformed noul / choice / score criteria are rejected locally, with questions["id"].criteria in the error, before anything is sent. Unknown question types pass through; the API documents more types than this tool.

Independent questions over the same state belong in one call. They run in parallel and cannot see each other's answers.

Do not put your conclusion in state. Jev treats that as evidence, and the confidence that comes back is agreement with you, not an independent check.

Example:

Use evaluate to decide whether this ticket is urgent and which team should own it: Help! My payouts have been failing for 3 days.

{
  "state": "Help! My payouts have been failing for 3 days.",
  "questions": {
    "is_urgent": {"type": "noul", "instructions": "Does this convey urgency?"},
    "department": {"type": "choice", "instructions": "Which team should handle this?",
      "criteria": {"billing": "Payments, refunds", "technical": "Bugs, outages", "sales": "Pricing"}}
  }
}

The tool returns the raw TypeSafe JSON, answers keyed by the same ids.

Runtime

  • 429 and 529 are retried with exponential backoff (up to 3 retries). Other API errors come back as tool errors.
  • HTTP timeout 60s. Response body capped at 16 MiB.
  • Single static binary: no Node, no Python runtime for the server.

How to write questions, batch, and read confidence: docs/jev/. Live TypeSafe docs: https://docs.typesafe.ai · https://docs.typesafe.ai/api

Contributing

Maintained by elkaix under PyModel. Issues and PRs: PyModel/typesafe-mcp.

Task: task check runs gofmt, go vet, and tests with -race. task inspect opens the MCP Inspector against a local build. Contributor notes: AGENTS.md. Domain terms: CONTEXT.md.

MIT. See LICENSE.

Directories

Path Synopsis
cmd
evaluate command
Command evaluate is an MCP stdio server for running TypeSafe Jev prompts.
Command evaluate is an MCP stdio server for running TypeSafe Jev prompts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL