mcp

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package mcp provides the MCP server and tool handlers for git-courer.

Index

Constants

View Source
const (
	OpCommit     = "commit"
	OpRelease    = "release"
	OpBranch     = "branch"
	OpTag        = "tag"
	OpMerge      = "merge"
	OpReset      = "reset"
	OpCherryPick = "cherry_pick"
	OpRevert     = "revert"
	OpClean      = "clean"
	OpRemote     = "remote"
	OpClone      = "clone"
	OpInit       = "init"
	OpGeneric    = "generic"
	OpProcessing = "processing"
)

Operation types constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v1.4.2

type Action struct {
	Label string `json:"label"` // Human-readable (e.g., "Execute")
	Key   string `json:"key"`   // Machine-actionable (e.g., "apply")
}

Action represents an actionable option for the user

type OllamaLifecycle

type OllamaLifecycle interface {
	EnsureOllama() (bool, error)
	PreWarm() error
	Stop()
}

OllamaLifecycle abstracts Ollama runtime operations (start, stop, pre-warm).

type PreviewSection added in v1.4.2

type PreviewSection struct {
	Title   string `json:"title"`
	Content string `json:"content"`
	Type    string `json:"type,omitempty"` // "text", "list", "code", "warning"
}

PreviewSection is a categorized section of the preview content

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server holds the MCP server and all injected dependencies.

func New

func New(cfg *config.Config, git ports.Git, llm ports.LLM, ollamaLifecycle OllamaLifecycle) *Server

New creates and wires up the MCP server with all its dependencies.

func ServeWithAdapter

func ServeWithAdapter(cfg *config.Config, git ports.Git, llm ports.LLM, ollamaLifecycle OllamaLifecycle) *Server

ServeWithAdapter wires everything together and starts serving asynchronously.

func (*Server) Serve

func (s *Server) Serve()

Serve starts the MCP server on stdin/stdout.

func (*Server) SetClientInfo

func (s *Server) SetClientInfo(info *domain.ClientInfo, caps *domain.ClientCapabilities)

SetClientInfo stores client information captured during the MCP initialize handshake.

func (*Server) Stop

func (s *Server) Stop(ollamaLifecycle OllamaLifecycle)

Stop stops Ollama if we started it.

type StructuredPreview added in v1.4.2

type StructuredPreview struct {
	Header   string           `json:"header"`
	Sections []PreviewSection `json:"sections"`
	Actions  []Action         `json:"actions"`
}

StructuredPreview represents a preview broken down into sections with actionable options

Jump to

Keyboard shortcuts

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