Documentation
¶
Overview ¶
Package mcpserver is `unpause mcp`: a read-only MCP server that lets another assistant list, search and read Sessions. It never writes to a Transcript.
Index ¶
- func LogPath(cachePath string) string
- func New(version string, load Loader, rec Recorder) *mcp.Server
- func Run(ctx context.Context, version string, load Loader, rec Recorder) error
- type AccessLog
- type Entry
- type GetInput
- type GetOutput
- type ListInput
- type ListOutput
- type Loader
- type Recorder
- type SearchHit
- type SearchInput
- type SearchOutput
- type Stats
- type Summary
- type Tally
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessLog ¶ added in v0.9.0
type AccessLog struct {
Path string
MaxSize int64
Stderr io.Writer // where a failed write is reported
// contains filtered or unexported fields
}
AccessLog appends Entries to a JSON-lines file, rotating it to Path+".1" once it reaches MaxSize. The file is 0600: it shows what was read.
func NewAccessLog ¶ added in v0.9.0
NewAccessLog logs to path, rotating at 10 MB.
type Entry ¶ added in v0.9.0
type Entry struct {
At string `json:"at"`
Client string `json:"client"`
ClientVersion string `json:"client_version"`
Tool string `json:"tool"`
Input json.RawMessage `json:"input"`
SessionIDs []string `json:"session_ids"`
Count int `json:"count"`
Total int `json:"total"`
DurationMS int64 `json:"duration_ms"`
Error string `json:"error,omitempty"`
}
Entry is one line of the Access log: one tool call. It holds what the client sent and which Sessions came back, never message text, titles, snippets or folders (ADR 0013).
type GetInput ¶
type GetInput struct {
ID string `json:"id" jsonschema:"session id, id prefix, or Name (same lookup as unpause open)"`
Offset int `json:"offset,omitempty" jsonschema:"index of the first message, default 0"`
Limit int `json:"limit,omitempty" jsonschema:"messages per page, default 50, max 200"`
MaxChars int `json:"max_chars,omitempty" jsonschema:"longest content block kept whole, default 20000; longer ones are cut"`
// MaxTotalChars keeps one result under what clients accept from a tool.
MaxTotalChars int `` /* 293-byte string literal not displayed */
}
GetInput is get_session's arguments.
type GetOutput ¶
type GetOutput struct {
Session Summary `json:"session"`
Total int `json:"total"`
Offset int `json:"offset"`
NextOffset *int `json:"next_offset,omitempty"`
Messages []claude.FullMessage `json:"messages"`
}
GetOutput is get_session's result.
type ListInput ¶
type ListInput struct {
Account string `json:"account,omitempty" jsonschema:"only this Account label, exact (e.g. personal, work)"`
Project string `json:"project,omitempty" jsonschema:"case-insensitive substring of the working directory"`
Live *bool `json:"live,omitempty" jsonschema:"true: only sessions running now; false: only ones that are not"`
Limit int `json:"limit,omitempty" jsonschema:"page size, default 20, max 100"`
Offset int `json:"offset,omitempty" jsonschema:"how many to skip, default 0"`
}
ListInput is list_sessions' arguments.
type ListOutput ¶
type ListOutput struct {
Total int `json:"total"`
Offset int `json:"offset"`
NextOffset *int `json:"next_offset,omitempty" jsonschema:"offset of the next page; absent on the last page"`
Sessions []Summary `json:"sessions"`
}
ListOutput is list_sessions' result.
type Loader ¶
Loader returns the Sessions to serve, newest first and already default-filtered (non-empty, not sidechain), plus the mcp exclude globs. It runs on every tool call.
type Recorder ¶ added in v0.9.0
type Recorder func(Entry)
Recorder receives one Entry per tool call. A nil Recorder records nothing.
type SearchHit ¶
type SearchHit struct {
Summary
Hits int `json:"hits" jsonschema:"total matches of all terms"`
Snippets []string `json:"snippets" jsonschema:"up to 3 excerpts around a match"`
}
SearchHit is one matching Session.
type SearchInput ¶
type SearchInput struct {
Query string `` /* 156-byte string literal not displayed */
Account string `json:"account,omitempty" jsonschema:"only this Account label, exact"`
Project string `json:"project,omitempty" jsonschema:"case-insensitive substring of the working directory"`
Limit int `json:"limit,omitempty" jsonschema:"page size, default 10, max 50"`
Offset int `json:"offset,omitempty" jsonschema:"how many to skip, default 0"`
}
SearchInput is search_sessions' arguments.
type SearchOutput ¶
type SearchOutput struct {
Total int `json:"total"`
Offset int `json:"offset"`
NextOffset *int `json:"next_offset,omitempty"`
Results []SearchHit `json:"results"`
}
SearchOutput is search_sessions' result.
type Stats ¶ added in v0.9.0
type Stats struct {
Calls int `json:"calls"`
Errors int `json:"errors"`
First time.Time `json:"first,omitzero"`
Last time.Time `json:"last,omitzero"`
Tools []Tally `json:"tools"`
Clients []Tally `json:"clients"`
MostRead []Tally `json:"most_read"` // Session ids by successful get_session calls
TopQueries []Tally `json:"top_queries"`
}
Stats summarizes the Access log for `unpause mcp stats`.
type Summary ¶
type Summary struct {
ID string `json:"id"`
Title string `json:"title"`
Account string `json:"account"`
Project string `json:"project" jsonschema:"repo folder name"`
CWD string `json:"cwd"`
Branch string `json:"branch,omitempty"`
Created string `json:"created,omitempty"`
LastActive string `json:"last_active,omitempty"`
Messages int `json:"messages" jsonschema:"user prompts plus assistant replies"`
Live string `json:"live,omitempty" jsonschema:"busy or idle when the session is running now"`
Cowork bool `json:"cowork,omitempty" jsonschema:"a Claude Desktop Cowork session"`
}
Summary is how a Session is described in every tool's output.