Documentation
¶
Overview ¶
Package mcpapp adapts the protocol-neutral SDD application to MCP.
New registers the shared tool surface over an application.Application. Handler exposes the raw Streamable HTTP application so an embedding composition can place its own authentication middleware in front. Authentication middleware must populate the MCP SDK's TokenInfo on every request; mcpapp translates that current request identity into application.RequestIdentity and never treats the session's initialization identity as authorization proof.
RunStdio is the local process transport. HTTP compositions use Handler, coordinate its lifecycle through Shutdown, and own the listener, transport policy, project routing, storage, LLM, embeddings, search index, and mutation finalizers through public SDD ports.
Index ¶
- Variables
- 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 ServeResult
- type Server
- func (s *Server) Connect(ctx context.Context, t mcp.Transport) (*mcp.ServerSession, error)
- func (s *Server) Disconnect(ctx context.Context, session *mcp.ServerSession) error
- func (s *Server) Handler() http.Handler
- func (s *Server) RunStdio(ctx context.Context) error
- func (s *Server) Shutdown(ctx context.Context) error
- type ShowArgs
- type ShowResult
- type StageAttachmentArgs
- type StageAttachmentResult
- type StartProcedureArgs
- type StartSessionArgs
- type ViewArgs
- type ViewResult
Constants ¶
This section is empty.
Variables ¶
var ErrServerClosing = errors.New("mcpapp: server is shutting down")
ErrServerClosing reports that a connection or request arrived after graceful shutdown began.
Functions ¶
This section is empty.
Types ¶
type AbandonArgs ¶
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 ¶
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 ¶
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 ¶
type ChooserResult ¶
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 ¶
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 ¶
type ListSessionsArgs struct{}
type ListSessionsResult ¶
type ListSessionsResult struct {
Sessions []sessionDescriptor `json:"sessions"`
}
type NextArgs ¶
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 {
// Application is the protocol-neutral SDD runtime. Project selects the
// immutable base project for this MCP application.
Application *sdd.Application
Project sdd.ProjectID
// LocalIdentity supplies the identity for a trusted composition whose
// transport authenticates every request but cannot populate MCP TokenInfo
// (the local stdio and static-bearer wrappers use this seam).
LocalIdentity sdd.RequestIdentity
// 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
// LocalAttachmentPath optionally adds the local-only path hint to
// read_attachment results. Canonical attachment reads remain path-free.
LocalAttachmentPath func(entryID, filename string) (string, error)
Version string
}
Options configures a workflow MCP server.
type ParkResult ¶
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 ¶
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 ¶
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 ¶
type RegistryArgs struct {
Class string `json:"class,omitempty" jsonschema:"filter: predicate, query, or command"`
}
type RegistryFuncResult ¶
type RegistryResult ¶
type RegistryResult struct {
Functions []RegistryFuncResult `json:"functions"`
Hint string `json:"hint,omitempty" jsonschema:"one-line breadcrumb while no session runs"`
}
type ResumeSessionArgs ¶
type ResumeSessionArgs struct {
Session string `` /* 171-byte string literal not displayed */
}
type ResumeSessionResult ¶
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 ¶
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 */
Repos []string `json:"repos,omitempty" jsonschema:"also search these connected repos by repo-id (additive to the local graph)"`
AllRepos bool `json:"all_repos,omitempty" jsonschema:"also search every connected repo"`
}
type SearchResult ¶
type ServeResult ¶
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) Disconnect ¶
Disconnect synchronously applies the session leave rule before closing a protocol connection. Hosts with an explicit connection lifecycle should prefer it over relying on the asynchronous transport watcher.
func (*Server) Handler ¶
Handler returns the shared Streamable HTTP application without choosing an authentication protocol. External compositions must place authenticated middleware in front of it and populate the SDK's current-request TokenInfo.
func (*Server) RunStdio ¶
RunStdio serves a single local connection over stdin/stdout until the transport closes or ctx is cancelled, then drains its tracked lifecycle before returning.
type ShowResult ¶
type StageAttachmentArgs ¶
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 ¶
type StageAttachmentResult struct {
Handle string `json:"handle" jsonschema:"attachment handle; pass it in a report's attachments field"`
}
type StartProcedureArgs ¶
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 ¶
type ViewArgs ¶
type ViewArgs struct {
Layout string `json:"layout" jsonschema:"sdd view layout pipeline, e.g. 'active:as-counts' or 'top(15)'"`
Repos []string `json:"repos,omitempty" jsonschema:"also render the layout over these connected repos' graphs (additive to the local graph)"`
AllRepos bool `json:"all_repos,omitempty" jsonschema:"also render the layout over every connected repo"`
}