Help us shape the future of Go! Take the 2026 Go Developer Survey

mcp

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package mcp exposes Oku over the Model Context Protocol (stdio) using the official Go SDK. Tools call the same in-process services as the CLI; the server never shells out to the oku binary. stdout carries only protocol frames; diagnostics go to the configured log writer (stderr).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(b Backend, cfg Config) *sdk.Server

NewServer builds the MCP server.

func Serve

func Serve(ctx context.Context, s *sdk.Server, in io.Reader, out io.Writer) error

Serve runs the server over the given stdio streams until the client disconnects or ctx is cancelled.

func ToolName

func ToolName(path string) string

ToolName maps a command path to a tool name, e.g. "orders prepare" -> "orders_prepare".

Types

type Backend

type Backend interface {
	Commands() []Command
	Call(ctx context.Context, path string, g Globals, opts map[string]any, args []string) (any, error)
}

Backend is the shared application service (implemented by cli.Service).

type Command

type Command struct {
	Path    string
	Summary string
	Options []Option
	Schema  map[string]any
}

Command is one callable command of the shared service.

type Config

type Config struct {
	Version string
	// AllowMutations exposes prepare/submit/cancel/reconcile tools.
	// Authenticated mutations still require a valid Oku session.
	AllowMutations bool
	Docs           docs.Store
	Skills         fs.FS // skills root, one directory per skill
}

Config controls what the server exposes.

type DraftInput

type DraftInput struct {
	Draft string `json:"draft" jsonschema:"malformed order draft JSON text, at most 16 KiB"`
}

DraftInput is the drafts_repair tool input.

type Globals

type Globals struct {
	Profile string
	Account string
	Timeout time.Duration
}

Globals mirrors the CLI global options accepted by every tool.

type Option

type Option struct {
	Name, Type, Usage string // Type: string | boolean | integer | duration
}

Option describes one command option for schema generation.

Jump to

Keyboard shortcuts

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