mcp

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mcp exposes gitrakz's capabilities as MCP (Model Context Protocol) tools, so external MCP clients (Claude Code and friends) can drive gitrakz directly — list owners/repos, inspect and run templates, trigger/inspect syncs, and read the timeline/sessions.

Every tool wraps the same small Store/Engine/Sessionizer/SyncController surfaces internal/pkg/http/server's handlers are built against — it never reimplements domain logic, only decodes tool arguments and encodes tool results. NewServer is transport-agnostic: the caller mounts the returned *mcp.Server on the streamable HTTP transport (see internal/pkg/services/http-server) or runs it over stdio (see the `gitrakz mcp` command in cmd/).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(deps Deps) *mcpsdk.Server

NewServer builds an MCP server exposing gitrakz's capabilities as tools, backed by deps. The returned *mcp.Server has no transport of its own — the caller connects it over stdio (mcp.StdioTransport) or mounts it on mcp.NewStreamableHTTPHandler for HTTP.

Types

type Deps

type Deps struct {
	Store          Store
	Engine         Engine
	Sessionizer    Sessionizer
	SyncController SyncController
}

Deps collects every dependency the MCP tools need.

type Engine

type Engine interface {
	Run(
		ctx context.Context,
		tmpl template.Template,
		timeline types.Timeline,
		form types.FormValues,
	) (blocks.Document, error)
}

Engine runs a template's transform pipeline over a selected timeline and renders it into a display Document. Mirrors internal/pkg/http/server.Engine.

type Sessionizer

type Sessionizer interface {
	Sessions(
		ctx context.Context,
		timeline types.Timeline,
	) ([]types.Session, error)
}

Sessionizer derives per-owner work sessions from a raw timeline. Mirrors internal/pkg/http/server.Sessionizer.

type Store

type Store interface {
	ListOwners(ctx context.Context) ([]string, error)
	ListRepos(ctx context.Context, owner string) ([]string, error)
	QueryTimeline(
		ctx context.Context,
		filter db.TimelineFilter,
	) ([]types.Event, bool, error)
	ListTemplates(ctx context.Context) ([]template.Template, error)
	GetTemplate(ctx context.Context, id string) (template.Template, error)
}

Store is the persistence surface the MCP tools need. Mirrors a strict subset of internal/pkg/http/server.Store's method set, field-for-field, so *db.Store satisfies it with no adaptation.

type SyncController

type SyncController interface {
	Trigger(ctx context.Context) (ghsync.SyncResult, error)
	Status(ctx context.Context) (api.SyncStatus, error)
}

SyncController drives, and reports on, the background `gh` sync. Mirrors internal/pkg/http/server.SyncController.

Jump to

Keyboard shortcuts

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