mcpserver

package
v0.0.0-...-04026ef Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package mcpserver exposes the local Stubborn CLI through the official MCP Go SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(options InstallOptions) (string, error)

Install writes a local stdio MCP entry into one of the supported, fixture- tested JSON client configuration formats. Existing valid configuration is backed up before an atomic replacement; malformed configuration is untouched.

func IsNormalClose

func IsNormalClose(err error) bool

IsNormalClose reports the standard EOF-shaped result of closing an stdio transport after the MCP client disconnects.

Types

type InstallOptions

type InstallOptions struct {
	Client  string
	Root    string
	Command string
	Home    string
	Now     func() time.Time
}

InstallOptions configures an installation into a tested local MCP client configuration format. Command must be the absolute Stubborn executable path.

type Options

type Options struct {
	Root             string
	AuthorizationURL string
	ManagementAPI    string
	ServerURL        string
	Version          string

	// CommandRunner is an optional test seam. Production callers leave it nil,
	// so each handler executes the corresponding cliapp operation.
	CommandRunner func(context.Context, string, []string) (cliapp.CommandResult, error)
}

Options configures a local, stdio-only MCP server. Root is the only repository that tools can inspect or change.

type Server

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

Server is a root-confined MCP adapter over cliapp operations.

func New

func New(options Options) (_ *Server, err error)

New constructs the server and verifies its configured root before it can serve an untrusted MCP client.

func (*Server) MCP

func (s *Server) MCP() *mcp.Server

MCP returns the underlying official SDK server for in-process integrations.

func (*Server) Root

func (s *Server) Root() string

Root returns the canonical repository root serving this MCP session.

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run serves newline-delimited JSON-RPC over process stdin/stdout until the client disconnects or ctx is canceled.

Jump to

Keyboard shortcuts

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