Documentation
¶
Overview ¶
Package server exposes a vault over the Model Context Protocol.
Index ¶
Constants ¶
const Instructions = `` /* 2230-byte string literal not displayed */
Instructions are sent to the client at initialisation.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AskIn ¶
type AskIn struct {
Question string `json:"question" jsonschema:"the question, in natural language"`
}
type GetIn ¶
type GetIn struct {
Path string `json:"path" jsonschema:"vault-relative path (e.g. faq/release.md), or a note title"`
}
type GetOut ¶
type GetOut struct {
Path string `json:"path"`
Title string `json:"title"`
Type string `json:"type"`
Description string `json:"description,omitempty"`
Revision string `json:"revision" jsonschema:"pass as base_revision to kb_write when updating this note"`
Owners []string `json:"owners,omitempty"`
Tickets []TicketLink `json:"tickets,omitempty"`
Frontmatter map[string]any `json:"frontmatter"`
Body string `json:"body"`
Links []string `json:"links,omitempty"`
Backlinks []string `json:"backlinks,omitempty"`
Broken []string `json:"broken_links,omitempty"`
}
type Options ¶
type Options struct {
ReadOnly bool
Author string // generated.by for writes, e.g. "claude-code"
Version string
// Env looks up tracker credentials (os.Getenv in production). Nil means
// no credentials: kb_ticket still returns the related notes.
Env func(string) string
// GitStatus reports the vault's git sync state (nil: git is off).
GitStatus func() any
}
Options configure the server.
type ReviewIn ¶
type ReviewIn struct {
Owner string `json:"owner,omitempty" jsonschema:"only notes owned by this person or group"`
Reason string `json:"reason,omitempty" jsonschema:"only one reason: stale, unverified, draft, broken-links or no-owner"`
Limit int `json:"limit,omitempty" jsonschema:"max items (default 25, max 200)"`
}
type ReviewOut ¶
type ReviewOut struct {
Total int `json:"total"`
Items []vault.ReviewItem `json:"items"`
Git any `json:"git,omitempty"` // sync state: branch, pull request, problems
}
type SearchIn ¶
type SearchIn struct {
Query string `json:"query" jsonschema:"keywords; empty lists notes matching the filters"`
Type string `json:"type,omitempty" jsonschema:"only notes of this OKF type, e.g. FAQ or Playbook"`
Tags []string `json:"tags,omitempty" jsonschema:"only notes carrying all these tags"`
Dir string `json:"dir,omitempty" jsonschema:"only notes under this vault folder"`
Ticket string `json:"ticket,omitempty" jsonschema:"only notes linked to or mentioning this ticket key, e.g. PROJ-123"`
Owner string `json:"owner,omitempty" jsonschema:"only notes owned by this person or group"`
Limit int `json:"limit,omitempty" jsonschema:"max hits (default 8, max 50)"`
WithDeprecated bool `json:"with_deprecated,omitempty" jsonschema:"include notes with status: deprecated"`
}
type Server ¶
Server binds a vault and its search index to MCP tools.
type TicketIn ¶
type TicketIn struct {
Key string `json:"key" jsonschema:"ticket key, e.g. PROJ-123"`
}
type TicketLink ¶
type TicketOut ¶
type TicketOut struct {
Key string `json:"key"`
URL string `json:"url,omitempty"`
Ticket *tracker.Issue `json:"ticket,omitempty"`
TrackerNote string `json:"tracker_note,omitempty" jsonschema:"why the ticket itself could not be fetched"`
Linked []Entry `json:"linked,omitempty" jsonschema:"notes listing this ticket in their tickets frontmatter"`
Mentioned []Entry `json:"mentioned,omitempty" jsonschema:"notes mentioning the key in their text"`
Suggested []search.Hit `json:"suggested,omitempty" jsonschema:"notes matching the ticket summary and labels"`
Hint string `json:"hint"`
}
type WriteIn ¶
type WriteIn struct {
Path string `json:"path" jsonschema:"vault-relative .md path in kebab-case, e.g. faq/how-to-release.md"`
Type string `json:"type,omitempty" jsonschema:"OKF type; required when creating (FAQ, Playbook, Reference, Decision, Tool ...)"`
Title string `json:"title,omitempty" jsonschema:"display title; for FAQ the canonical question"`
Description string `json:"description,omitempty" jsonschema:"one sentence summary, shown in indexes and search hits"`
Tags []string `json:"tags,omitempty" jsonschema:"tags (replaces existing tags when given)"`
Aliases []string `json:"aliases,omitempty" jsonschema:"alternative names; for FAQ other phrasings of the question"`
Status string `json:"status,omitempty" jsonschema:"draft, stable or deprecated"`
Body string `json:"body,omitempty" jsonschema:"Markdown body (replaces the existing body when given)"`
Tickets []string `json:"tickets,omitempty" jsonschema:"ticket keys this note documents, e.g. [PROJ-123] (replaces existing)"`
Owners []string `json:"owners,omitempty" jsonschema:"people or groups who own this note (replaces existing)"`
BaseRevision string `json:"base_revision,omitempty" jsonschema:"revision from kb_get; the write fails if the note changed since"`
Mode string `json:"mode,omitempty" jsonschema:"create, update or upsert (default upsert)"`
Note string `json:"note,omitempty" jsonschema:"short change note recorded in log.md"`
}
type WriteOut ¶
type WriteOut struct {
*vault.WriteResult
Sync any `json:"sync,omitempty"` // branch, pull request, unpushed commits, problems
}
WriteOut is a write result plus the vault's git sync state.