mcpserver

package
v0.0.0-...-d5a95b6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcpserver exposes geelark-cli over the Model Context Protocol.

All GeeLark functionality is exposed through a small set of "routed" tools: each tool covers one module and dispatches on an `action` parameter that maps to a geelark-cli subcommand. Command flags are passed through the `params` object.

Each tool call forks this same binary (os.Args[0]) so the child's stdout is isolated from the MCP transport. That keeps the existing CLI print sites unchanged and avoids version skew between MCP and CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SelfBin

func SelfBin() string

SelfBin returns the path of the running geelark-cli binary.

Preference order:

  1. GEELARK_CLI_PATH — tests / wrappers that replace argv[0]
  2. os.Executable — absolute path; survives chdir unlike a relative argv[0]
  3. os.Args[0] — last resort

Types

type Args

type Args struct {
	Action string         `json:"action" jsonschema:"the subcommand to execute; must be one of the actions listed in this tool's description"`
	Params map[string]any `` /* 217-byte string literal not displayed */
}

Args is the input schema shared by every routed tool.

type Options

type Options struct {
	// SkillsFS holds the skills reference documentation tree.
	SkillsFS fs.FS
	// Version is reported to MCP clients during initialization.
	Version string
}

Options configures a Server.

type Outcome

type Outcome struct {
	Stdout  string
	Stderr  string
	ExitErr error // non-nil when the process failed
}

Outcome holds the result of one CLI invocation.

func (Outcome) FailureText

func (o Outcome) FailureText() string

FailureText returns the best error text: stderr first (cobra prints errors and usage there), then stdout, then the raw exit error.

func (Outcome) OK

func (o Outcome) OK() bool

OK reports whether the command exited successfully.

type Server

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

Server serves the GeeLark MCP tools over stdio.

func New

func New(opts Options) *Server

New creates a Server from opts.

func (*Server) Run

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

Run serves the MCP protocol over stdio until ctx is cancelled or the client disconnects. Nothing else may write to stdout for the lifetime of this call.

Jump to

Keyboard shortcuts

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