Documentation
¶
Overview ¶
Package mcp is the jevkit decision server: a stdio JSON-RPC MCP server (built on the official Go SDK) that exposes Jev as five tools.
The curated tools (jev_classify_request, jev_classify_failure, jev_rank_relevance) each fix one registered, versioned question set and return the typed answer plus the registry's act/gather/fallback decision. jev_developer_assess dispatches to a small, versioned, opt-in set of developer.* question sets built for coding-agent decision support. jev_ask is the raw, unversioned escape hatch. Every tool redacts state before it reaches the transport.
Agents decide whether to call these tools from very little: the server's initialize Instructions and the tool descriptions. Registry-backed results therefore carry one line of guidance next to the decision, so a gather says what evidence to add instead of reading as no answer.
stdout is the protocol channel; all logging goes to the configured log writer (stderr in production). The API key is resolved by the injected client, never by a caller, and is never logged or returned.
Index ¶
- Constants
- func AppendAudit(stateDir string, e AuditEntry) error
- func AuditPath(stateDir string) string
- func ConfigDocument(name, command string) ([]byte, error)
- func MergeConfig(existing []byte, name, command string) (out []byte, changed bool, err error)
- func ServerEntry(command string) map[string]any
- func WriteConfigFile(path, name, command string) (changed bool, err error)
- type Asker
- type AuditEntry
- type AuditQuestion
- type Config
- type Server
Constants ¶
const DefaultServerName = "jevkit"
DefaultServerName is the key under mcpServers that jevkit owns.
const Instructions = `` /* 1738-byte string literal not displayed */
Instructions is sent in the initialize result. MCP hosts show it to the agent ahead of the tool list, and it is often the only thing an agent reads before deciding whether these tools are worth loading, so it says when to call them, not how they work.
Variables ¶
This section is empty.
Functions ¶
func AppendAudit ¶
func AppendAudit(stateDir string, e AuditEntry) error
AppendAudit writes e as one line under an exclusive lock, defaulting the timestamp to now (UTC). A missing stateDir disables auditing entirely; the caller should not invoke this when stateDir is empty.
func ConfigDocument ¶
ConfigDocument is a standalone client config holding only the entry.
func MergeConfig ¶
MergeConfig sets mcpServers.<name> in an existing client config (nil or empty input starts a new one), leaving every other setting untouched. changed is false when the entry was already present and identical, so merging twice is a no-op.
func ServerEntry ¶
ServerEntry is the client-config entry that launches the server. It has no env block: the server resolves the API key itself, so nothing secret is ever written to a client config.
func WriteConfigFile ¶
WriteConfigFile merges the entry into path, creating it (and its directory) if needed. The file is rewritten only when it changes, atomically, keeping its mode.
Types ¶
type AuditEntry ¶
type AuditEntry struct {
Timestamp string `json:"timestamp"`
Tool string `json:"tool"`
Caller string `json:"caller"`
Unregistered bool `json:"unregistered"`
StateBytes int `json:"stateBytes"`
Questions []AuditQuestion `json:"questions"`
RedactionHits map[string]int `json:"redactionHits,omitempty"`
}
AuditEntry is one jev_ask call: identifying and size/redaction metadata only. It never carries state, instructions or criteria text.
type AuditQuestion ¶
type AuditQuestion struct {
ID string `json:"id"`
Type string `json:"type"`
InstructionsLen int `json:"instructionsBytes"`
CriteriaLen int `json:"criteriaBytes"`
}
AuditQuestion is one question's privacy-safe shape in an audit entry: its id, declared type and byte counts, never its instructions or criteria text.
type Config ¶
type Config struct {
// Decider supplies the registry and applies its thresholds.
Decider *registry.Decider
// Client asks Jev. It resolves the API key itself.
Client Asker
// Redact scrubs plain state/instructions text before it is sent; an
// error rejects the call. It reports which rules fired (never the
// matched text) so callers can record redaction counts.
Redact func(string) (string, []redact.Hit, error)
// RedactJSON scrubs structured (object or array) JSON text before it is
// sent, preserving shape: jev_ask's structured state, instructions and
// criteria. An error rejects the call.
RedactJSON func(raw json.RawMessage) (json.RawMessage, []redact.Hit, error)
// (no key, breaker open). It must not return or log the key.
Unavailable func(ctx context.Context) string
// AuditDir, when set, receives one privacy-safe jev_ask audit line per
// call (timestamp, caller, question ids/types, byte and redaction-hit
// counts; never payload text) under <AuditDir>/jevkit/jev-ask-audit.jsonl.
// Empty disables auditing.
AuditDir string
// Log receives all logging (stderr in production); nil discards it.
Log io.Writer
// Version is reported as the server version.
Version string
}
Config wires a Server. Everything except Log and Version is required.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the Jev MCP server.
func (*Server) RunStdio ¶
func (s *Server) RunStdio(ctx context.Context, in io.ReadCloser, out io.WriteCloser) error
RunStdio serves newline-delimited JSON-RPC over in and out.