Documentation
¶
Overview ¶
Package mcp implements the Model Context Protocol (MCP) Streamable HTTP handler.
Index ¶
- func NewHTTPHandler(h *Handler) http.Handler
- type Handler
- func (h *Handler) SetMetrics(pool poolMetricsSource, disp dispatcherMetricsSource, sys systemMetricsSource)
- func (h *Handler) SetPRManager(prm forge.PullRequestManager)
- func (h *Handler) SetProjects(reg *ProjectRegistry)
- func (h *Handler) SetScalingEventReader(r scalingEventReader)
- func (h *Handler) SetWorkerLister(wl workerLister)
- type PendingAction
- type Project
- type ProjectConfig
- type ProjectRegistry
- func (r *ProjectRegistry) Active() (*Project, error)
- func (r *ProjectRegistry) ActiveName() string
- func (r *ProjectRegistry) Get(name string) (*Project, bool)
- func (r *ProjectRegistry) List() []*Project
- func (r *ProjectRegistry) Register(p *Project) error
- func (r *ProjectRegistry) SetActive(name string) error
- type WorkerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPHandler ¶
NewHTTPHandler creates an http.Handler that serves the MCP protocol over Streamable HTTP in stateless JSON response mode.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler holds dependencies for MCP tool handlers.
func NewHandler ¶
func NewHandler(tracker forge.IssueTracker, costs digest.CostSource, s store.Store, policy autonomy.AutonomyPolicy, repo forge.RepoReader) *Handler
NewHandler creates a new MCP tool handler with its dependencies. The store, policy, and repo parameters are optional (may be nil) for graceful degradation.
func (*Handler) SetMetrics ¶ added in v0.1.11
func (h *Handler) SetMetrics(pool poolMetricsSource, disp dispatcherMetricsSource, sys systemMetricsSource)
SetMetrics attaches runtime metrics sources to the handler. Sources may be nil; only non-nil sources appear in the digest.
func (*Handler) SetPRManager ¶
func (h *Handler) SetPRManager(prm forge.PullRequestManager)
SetPRManager attaches a PullRequestManager to the handler.
func (*Handler) SetProjects ¶
func (h *Handler) SetProjects(reg *ProjectRegistry)
SetProjects attaches a project registry to the handler for multi-project support. When set, tools resolve tracker and repo through the active project.
func (*Handler) SetScalingEventReader ¶ added in v0.1.11
func (h *Handler) SetScalingEventReader(r scalingEventReader)
SetScalingEventReader attaches a scaling event reader for the digest. When set, recent scaling activity appears in the System Health section.
func (*Handler) SetWorkerLister ¶ added in v0.1.11
func (h *Handler) SetWorkerLister(wl workerLister)
SetWorkerLister attaches a worker lister so the digest includes PC agent status.
type PendingAction ¶
type PendingAction struct {
ID string
ToolName string
Execute func() (*gosdk.CallToolResult, error) // closure captures handler + input
CreatedAt time.Time
}
PendingAction represents an MCP tool call queued for user confirmation (Tier 3).
type Project ¶
type Project struct {
Name string `json:"name" yaml:"name"`
Owner string `json:"owner" yaml:"owner"`
Repo string `json:"repo" yaml:"repo"`
Tracker forge.IssueTracker `json:"-" yaml:"-"`
Reader forge.RepoReader `json:"-" yaml:"-"`
PRManager forge.PullRequestManager `json:"-" yaml:"-"`
}
Project represents a registered project with its forge connection.
type ProjectConfig ¶
type ProjectConfig struct {
Name string `yaml:"name"`
Owner string `yaml:"owner"`
Repo string `yaml:"repo"`
Forge string `yaml:"forge"` // "github" (default) or "gitea"
GiteaURL string `yaml:"gitea_url"` // required when forge = "gitea"
GiteaToken string `yaml:"gitea_token"` // optional; falls back to GITEA_TOKEN env var
}
ProjectConfig is the YAML-serializable configuration for a project. Forge may be "github" (default) or "gitea". Gitea projects require GiteaURL and optionally GiteaToken (falls back to GITEA_TOKEN environment variable).
func LoadProjectConfig ¶
func LoadProjectConfig(path string) ([]ProjectConfig, error)
LoadProjectConfig reads and parses a YAML projects configuration file.
type ProjectRegistry ¶
type ProjectRegistry struct {
// contains filtered or unexported fields
}
ProjectRegistry manages the set of available projects.
func NewProjectRegistry ¶
func NewProjectRegistry() *ProjectRegistry
NewProjectRegistry creates a new empty project registry.
func (*ProjectRegistry) Active ¶
func (r *ProjectRegistry) Active() (*Project, error)
Active returns the currently active project. Returns an error if no projects are registered or no project is active.
func (*ProjectRegistry) ActiveName ¶
func (r *ProjectRegistry) ActiveName() string
ActiveName returns the name of the currently active project.
func (*ProjectRegistry) Get ¶
func (r *ProjectRegistry) Get(name string) (*Project, bool)
Get retrieves a project by name.
func (*ProjectRegistry) List ¶
func (r *ProjectRegistry) List() []*Project
List returns all registered projects sorted by name.
func (*ProjectRegistry) Register ¶
func (r *ProjectRegistry) Register(p *Project) error
Register adds a project to the registry. Returns an error if the name is empty or already registered. The first registered project becomes active.
func (*ProjectRegistry) SetActive ¶
func (r *ProjectRegistry) SetActive(name string) error
SetActive switches the active project context. Returns an error if the named project is not registered.