mcp

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mcp implements the focus MCP server (`focus mcp serve`).

Tools are thin wrappers over internal/board so the MCP surface and the CLI surface never drift — designs/focus-issue-001.md §"CLI/MCP shared logic placement". The server runs over stdio and resolves the .focus/ board the same way the CLI does: ancestor-walk from the calling agent's working directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, version string) error

Serve runs the MCP server over stdio until the client disconnects or ctx is cancelled. version is stamped into the initialize-time implementation info; the CLI passes its own Version constant in.

The .focus/ board is resolved lazily inside each tool handler from $PWD, which matches CLI semantics and means agents see the board for the project they're working in (designs/focus-v2.md §"MCP server").

Types

type BoardResult

type BoardResult struct {
	Active  []CardSummary `json:"active"`
	Backlog []CardSummary `json:"backlog"`
	Epics   []CardSummary `json:"epics"`
}

BoardResult is the focus_board output: active, backlog, epics.

type CardSummary

type CardSummary struct {
	ID       int      `json:"id"`
	UUID     string   `json:"uuid"`
	Title    string   `json:"title"`
	Type     string   `json:"type"`
	Status   string   `json:"status"`
	Priority string   `json:"priority"`
	Project  string   `json:"project"`
	Epic     *int     `json:"epic,omitempty"`
	Tags     []string `json:"tags,omitempty"`
	Owner    string   `json:"owner,omitempty"`
	Created  string   `json:"created"`
	Dir      string   `json:"dir"`
}

CardSummary is the per-card payload shape returned by every list-y tool. We mirror the index.Entry fields directly because that's the shape internal/board already produces; keeping them aligned avoids an extra translation layer.

type EditBodyArgs

type EditBodyArgs struct {
	ID   int    `json:"id"`
	Body string `json:"body" jsonschema:"new markdown body; replaces the existing body verbatim"`
}

EditBodyArgs replaces a card's markdown body.

type EmptyArgs

type EmptyArgs struct{}

EmptyArgs is the input type for tools that take no arguments. AddTool requires the In type to render as an object schema, so we use an empty struct — that produces "type":"object" with no properties.

type EpicAddArgs

type EpicAddArgs struct {
	EpicID int  `json:"epic_id"`
	CardID int  `json:"card_id"`
	Force  bool `json:"force,omitempty" jsonschema:"skip the epic-id existence check"`
}

EpicAddArgs links a card to an epic.

type EpicAddResult

type EpicAddResult struct {
	EpicID int `json:"epic_id"`
	CardID int `json:"card_id"`
}

EpicAddResult confirms the link.

type EpicListResult

type EpicListResult struct {
	Epics []EpicProgress `json:"epics"`
}

EpicListResult wraps the per-epic progress summary.

type EpicProgress

type EpicProgress struct {
	CardSummary
	Active   int `json:"active"`
	Backlog  int `json:"backlog"`
	Done     int `json:"done"`
	Archived int `json:"archived"`
	Total    int `json:"total"`
}

EpicProgress is the summary returned for one epic.

type IDArgs

type IDArgs struct {
	ID int `json:"id" jsonschema:"the card id (board-local integer)"`
}

IDArgs is the input type for tools that accept exactly one id.

type IDForceArgs

type IDForceArgs struct {
	ID    int  `json:"id" jsonschema:"the card id (board-local integer)"`
	Force bool `json:"force,omitempty" jsonschema:"bypass from-status validation"`
}

IDForceArgs adds the force flag for transitions that allow it.

type ListArgs

type ListArgs struct {
	Status   string `json:"status,omitempty"`
	Project  string `json:"project,omitempty"`
	Priority string `json:"priority,omitempty"`
	Owner    string `json:"owner,omitempty"`
	Tag      string `json:"tag,omitempty"`
	Type     string `json:"type,omitempty"`
	Epic     int    `json:"epic,omitempty"`
}

ListArgs filters a focus_list call. All fields are optional.

type ListResult

type ListResult struct {
	Cards []CardSummary `json:"cards"`
}

ListResult wraps a flat card list.

type NewArgs

type NewArgs struct {
	Title    string `json:"title" jsonschema:"card title (free-form)"`
	Project  string `json:"project,omitempty" jsonschema:"project tag; defaults to the board's parent dir name"`
	Priority string `json:"priority,omitempty" jsonschema:"priority p0|p1|p2|p3; defaults to p2"`
	Type     string `json:"type,omitempty" jsonschema:"card or epic; defaults to card"`
	Epic     int    `json:"epic,omitempty" jsonschema:"parent epic id (omit for none)"`
	Slug     string `json:"slug,omitempty" jsonschema:"override the auto-derived folder slug"`
}

NewArgs is the input type for focus_new. Mirrors NewCardOpts but uses primitives the JSON schema generator can describe.

type NewResult

type NewResult struct {
	ID   int    `json:"id"`
	UUID string `json:"uuid"`
	Dir  string `json:"dir"`
}

NewResult is focus_new's output: the assigned id, uuid, and dir.

type ReindexResult

type ReindexResult struct {
	Cards  int `json:"cards"`
	NextID int `json:"next_id"`
}

ReindexResult reports the rebuilt index size + next_id.

type ShowResult

type ShowResult struct {
	CardSummary
	Description string   `json:"description,omitempty"`
	Area        string   `json:"area,omitempty"`
	Contract    []string `json:"contract,omitempty"`
	DependsOn   []int    `json:"depends_on,omitempty"`
	Body        string   `json:"body"`
}

ShowResult is focus_show: full card frontmatter + body.

type TransitionResult

type TransitionResult struct {
	ID     int    `json:"id"`
	Status string `json:"status"`
}

TransitionResult is the standard output for transition tools.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL