Documentation
¶
Overview ¶
Package mcpserver is the workflow engine's MCP shell (v1 plan 20260702-220449-d-tac-ry0, slice 3): the loop tools (start_procedure, next, abandon) drive procedure instances through the engine, sessions persist as append-only JSONL logs under the sessions dir (list_sessions / resume_session), stage_attachment fills the session scratch, and the read tools (search, view, show, read_attachment, info, registry) are free and never gated. Graph writes exist only as procedure transitions — there is no direct write tool (enforcement scoped by surface ownership, s-cpt-1dz).
The server is deliberately not an agent — the connecting client supplies all LLM reasoning; this layer serves instructions, validates reports and chooser sequence through the engine, and owns the side-effect dependencies the engine registry's shell functions need.
CQRS conformance: reads go to finders, writes dispatch handler commands from inside registry command closures. State owned here is protocol and session-lifecycle state, not domain state.
Index ¶
- type AbandonArgs
- type AbandonResult
- type BaseServe
- type ChooserOptionResult
- type ChooserResult
- type InfoArgs
- type InfoResult
- type ListSessionsArgs
- type ListSessionsResult
- type NextArgs
- type Options
- type ParkArgs
- type ParkResult
- type ReadAttachmentArgs
- type ReadAttachmentResult
- type RegistryArgs
- type RegistryFuncResult
- type RegistryResult
- type ResumeSessionArgs
- type ResumeSessionResult
- type SearchArgs
- type SearchResult
- type Searcher
- type ServeResult
- type Server
- type ShowArgs
- type ShowResult
- type StageAttachmentArgs
- type StageAttachmentResult
- type StartProcedureArgs
- type StartSessionArgs
- type ViewArgs
- type ViewResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbandonArgs ¶ added in v0.14.0
type AbandonArgs struct {
Instance string `json:"instance,omitempty" jsonschema:"instance handle to abandon (a move in the bound session)"`
Session string `` /* 148-byte string literal not displayed */
Reason string `json:"reason,omitempty" jsonschema:"why the instance or session is being abandoned"`
}
type AbandonResult ¶ added in v0.14.0
type AbandonResult struct {
Abandoned bool `json:"abandoned"`
Session string `json:"session,omitempty" jsonschema:"the torn-down session, on teardown by handle"`
Label string `json:"label,omitempty" jsonschema:"the torn-down session's subject label"`
// DiscardedThreads names what went down with a session teardown — nothing
// vanishes silently (d-tac-dbk).
DiscardedThreads []string `json:"discarded_threads,omitempty" jsonschema:"open moves discarded with the session (procedure at step)"`
HeldMarkers []string `json:"held_markers,omitempty" jsonschema:"WIP markers held; left standing — resume later or close via groom"`
Instructions string `json:"instructions,omitempty"`
Base *BaseServe `json:"base_junction,omitempty" jsonschema:"the session shell's current serve — where the dialogue now stands"`
}
type BaseServe ¶ added in v0.14.0
type BaseServe struct {
Session string `json:"session"`
Instance string `json:"instance"`
Procedure string `json:"procedure"`
Status string `json:"status"`
Step string `json:"step,omitempty"`
Goal string `json:"goal"`
Instructions string `json:"instructions,omitempty"`
PendingChooser *ChooserResult `json:"pending_chooser,omitempty"`
Framing string `json:"framing,omitempty"`
OpenThreads string `json:"open_threads,omitempty" jsonschema:"open work: this dialogue's other threads, then other parked dialogues"`
}
BaseServe is the session shell's serve as nested into landing responses (move completion, abandon). Same shape as ServeResult minus the nesting field — the shell never lands on itself, and the omission keeps the JSON schema acyclic.
type ChooserOptionResult ¶ added in v0.14.0
type ChooserResult ¶ added in v0.14.0
type ChooserResult struct {
Chooser string `json:"chooser" jsonschema:"the pending chooser's step id — the value to put in a chooser answer's chooser field"`
Kind string `json:"kind" jsonschema:"who answers: agent (advisory judgment) or user (relay their answer verbatim)"`
Options []ChooserOptionResult `json:"options"`
}
type InfoResult ¶ added in v0.14.0
type InfoResult struct {
Participant string `json:"participant,omitempty" jsonschema:"configured local participant (canonical name)"`
Language string `json:"language,omitempty" jsonschema:"configured graph language; empty = English"`
Search string `json:"search" jsonschema:"available retrieval modes: text or vector,text"`
Version string `json:"version,omitempty"`
Hint string `json:"hint,omitempty" jsonschema:"one-line breadcrumb while no session runs"`
}
type ListSessionsArgs ¶ added in v0.14.0
type ListSessionsArgs struct{}
type ListSessionsResult ¶ added in v0.14.0
type ListSessionsResult struct {
Sessions []sessionDescriptor `json:"sessions"`
}
type NextArgs ¶ added in v0.14.0
type NextArgs struct {
Instance string `json:"instance" jsonschema:"instance handle from start_procedure"`
// Report carries either state fields for the current step (per the served
// report_schema) or a chooser answer {chooser, choice, userWords?, fields?}.
Report map[string]any `` /* 135-byte string literal not displayed */
Label string `json:"label,omitempty" jsonschema:"update the session's subject label when the dialogue's subject has sharpened"`
}
type Options ¶
type Options struct {
Handler *handlers.Handler // write path: registry commands dispatch here
Finder *finders.Finder // read path: graph load, info, view, show
Searcher Searcher // search tool; nil disables the search tool's retrieval
// VectorSearch enables phrase (vector/semantic) retrieval on the search
// tool. False limits it to text-term matching.
VectorSearch bool
GraphDir string
// SessionsDir holds the per-participant append-only JSONL session logs
// and the per-session attachment staging scratch. Local, gitignored.
SessionsDir string
// LocalClient marks the connecting client as sharing this filesystem
// (stdio transport). Local clients get absolute paths in read results
// (read_attachment) so they can read files directly instead of paging.
LocalClient bool
Version string
}
Options configures a workflow MCP server.
type ParkResult ¶ added in v0.14.0
type ParkResult struct {
Parked bool `json:"parked"`
Instance string `json:"instance"`
Procedure string `json:"procedure"`
Step string `json:"step"`
Instructions string `json:"instructions,omitempty"`
Base *BaseServe `json:"base_junction,omitempty" jsonschema:"the session shell's serve — where the dialogue lands"`
}
type ReadAttachmentArgs ¶ added in v0.14.0
type ReadAttachmentArgs struct {
ID string `json:"id" jsonschema:"full ID of the entry whose attachment to read"`
Name string `json:"name,omitempty" jsonschema:"attachment filename; optional when the entry has exactly one"`
Offset int64 `json:"offset,omitempty" jsonschema:"byte position to continue from (next_offset of the previous page)"`
MaxBytes int `json:"max_bytes,omitempty" jsonschema:"page size cap; default 65536"`
}
type ReadAttachmentResult ¶ added in v0.14.0
type ReadAttachmentResult struct {
Name string `json:"name"`
Content string `json:"content"`
Offset int64 `json:"offset"`
NextOffset int64 `json:"next_offset,omitempty"`
TotalBytes int64 `json:"total_bytes"`
More bool `json:"more"`
Available []string `json:"available" jsonschema:"the entry's attachment filenames"`
Path string `` /* 151-byte string literal not displayed */
Hint string `json:"hint,omitempty" jsonschema:"one-line breadcrumb while no session runs"`
}
type RegistryArgs ¶ added in v0.14.0
type RegistryArgs struct {
Class string `json:"class,omitempty" jsonschema:"filter: predicate, query, or command"`
}
type RegistryFuncResult ¶ added in v0.14.0
type RegistryResult ¶ added in v0.14.0
type RegistryResult struct {
Functions []RegistryFuncResult `json:"functions"`
Hint string `json:"hint,omitempty" jsonschema:"one-line breadcrumb while no session runs"`
}
type ResumeSessionArgs ¶ added in v0.14.0
type ResumeSessionArgs struct {
Session string `json:"session" jsonschema:"session handle from list_sessions"`
}
type ResumeSessionResult ¶ added in v0.14.0
type ResumeSessionResult struct {
Session string `json:"session"`
Participant string `json:"participant,omitempty"`
Label string `json:"label,omitempty" jsonschema:"the session's subject label, when one was recorded"`
Open []ServeResult `` /* 133-byte string literal not displayed */
Framing string `json:"framing,omitempty"`
Instructions string `json:"instructions,omitempty"`
}
type SearchArgs ¶ added in v0.14.0
type SearchArgs struct {
Terms []string `json:"terms,omitempty" jsonschema:"text mode: regex terms combined with AND"`
Query string `` /* 134-byte string literal not displayed */
Type string `json:"type,omitempty" jsonschema:"filter: s/signal or d/decision"`
Layer string `json:"layer,omitempty" jsonschema:"filter: stg, cpt, tac, ops, prc"`
Kind string `json:"kind,omitempty" jsonschema:"filter: entry kind"`
IncludeSuperseded bool `json:"include_superseded,omitempty"`
Limit int `json:"limit,omitempty" jsonschema:"hit cap; default 8"`
MaxCitations *int `` /* 142-byte string literal not displayed */
}
type SearchResult ¶ added in v0.14.0
type Searcher ¶
type Searcher interface {
Search(ctx context.Context, q query.SearchQuery) (*query.SearchResult, error)
}
Searcher runs a search against the graph. *finders.SearchFinder satisfies this; the serve command may wrap it to lazy-fill the vector index before querying.
type ServeResult ¶ added in v0.14.0
type ServeResult struct {
Session string `json:"session" jsonschema:"session handle; sessions survive restarts and resume via resume_session"`
Instance string `json:"instance"`
Procedure string `json:"procedure"`
Status string `json:"status" jsonschema:"running, completed, or abandoned"`
Step string `json:"step,omitempty"`
Goal string `json:"goal" jsonschema:"one line: what advances the instance from here"`
Instructions string `json:"instructions,omitempty"`
Missing []string `json:"missing,omitempty" jsonschema:"required report fields not yet provided"`
ReportSchema map[string]any `json:"report_schema,omitempty" jsonschema:"JSON Schema for the current step's report"`
PendingChooser *ChooserResult `json:"pending_chooser,omitempty"`
Execution string `` /* 158-byte string literal not displayed */
Produced map[string]any `json:"produced,omitempty" jsonschema:"engine-written results on completion (e.g. the created entry ID)"`
Framing string `` /* 176-byte string literal not displayed */
Vocabulary string `` /* 198-byte string literal not displayed */
OpenThreads string `` /* 156-byte string literal not displayed */
Base *BaseServe `` /* 135-byte string literal not displayed */
}
ServeResult is the loop's uniform response shape: where the instance stands, what advances it, and the material to work with.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wires the MCP protocol surface to the engine and the SDD read and write layers.
func (*Server) Connect ¶
Connect attaches the server to an arbitrary transport (in-memory in tests). The returned session ends when the client disconnects.
func (*Server) HTTPHandler ¶
HTTPHandler exposes the bearer-guarded MCP handler for tests that drive the server through an httptest.Server instead of a real listener.
func (*Server) RunHTTP ¶
RunHTTP serves streamable HTTP at addr until ctx is cancelled. authToken must be non-empty: every request needs `Authorization: Bearer <token>`. The write path would otherwise be open to anyone who can reach the address — the evaluation setup tunnels it to the public internet.
type ShowResult ¶ added in v0.14.0
type StageAttachmentArgs ¶ added in v0.14.0
type StageAttachmentArgs struct {
Name string `json:"name" jsonschema:"target filename (plain name, no paths)"`
Content string `json:"content,omitempty" jsonschema:"file content to stage (UTF-8 text)"`
Path string `json:"path,omitempty" jsonschema:"local file path to stage instead of inline content"`
}
type StageAttachmentResult ¶ added in v0.14.0
type StageAttachmentResult struct {
Handle string `json:"handle" jsonschema:"attachment handle; pass it in a report's attachments field"`
}
type StartProcedureArgs ¶ added in v0.14.0
type StartProcedureArgs struct {
Canonical string `json:"canonical" jsonschema:"the procedure to start, by its stable name (e.g. capture)"`
Params map[string]any `` /* 191-byte string literal not displayed */
Label string `` /* 146-byte string literal not displayed */
Parent string `` /* 181-byte string literal not displayed */
}
type StartSessionArgs ¶ added in v0.14.0
type ViewArgs ¶ added in v0.14.0
type ViewArgs struct {
Layout string `json:"layout" jsonschema:"sdd view layout pipeline, e.g. 'active:as-counts' or 'top(15)'"`
}