mcpserver

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package mcpserver embeds an MCP (Model Context Protocol) stdio server in the positronick binary: five consolidated tools — soul_search, soul_show, soul_install, listing_search, listing_show — each a thin wrapper over the same internal packages the CLI commands use (the api client, the search ranking, the install machinery), so the two surfaces can never disagree. The MCP SDK dependency is confined to this package; the `mcp serve` command in internal/cli is just glue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) *mcp.Server

New builds the MCP server advertising the five positronick tools. The server name is "positronick"; the version is the binary's build version.

func Run

func Run(ctx context.Context, opts Options) error

Run serves New(opts) over stdio (newline-delimited JSON-RPC on stdin/stdout) until the client disconnects or ctx is cancelled.

func SetupInstructions

func SetupInstructions() string

SetupInstructions is the human help `mcp serve` prints — instead of starting the server — when stdin is a terminal: an interactive shell is never the MCP client, so hand the user ready-to-paste setup for the major clients. Changing this text changes a golden file.

Types

type Options

type Options struct {
	// Client is the positronick.com API client every tool reads through.
	Client *api.Client
	// Cwd and Home anchor harness detection, the conventional install paths
	// and soul_install's relative-path safety rule (see internal/install).
	Cwd, Home string
	// Suggest picks the did-you-mean candidate for a missing slug, or ""
	// for none. The CLI injects its suggestion machinery; nil disables
	// suggestions.
	Suggest func(input string, candidates []string) string
}

Options wires the server's dependencies. Everything is injected — the auth-aware API client the CLI builds, the cwd/home anchors for installs, and the did-you-mean suggester — so this package never imports the CLI and tests control every seam.

Jump to

Keyboard shortcuts

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