mcp

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartFileSystemMCPServer

func StartFileSystemMCPServer(ctx context.Context, transport mcp.Transport, root string) error

StartFileSystemMCPServer starts the filesystem MCP server. When root is non-empty, relative paths are rooted at it; an empty root preserves the legacy process-cwd behavior.

func StartSkillsMCPServer

func StartSkillsMCPServer(ctx context.Context, transport mcp.Transport, skills []types.Skill) error

StartSkillsMCPServer runs an in-memory MCP server exposing a load_skill tool that returns a skill's full instructions by name.

func StartTransports

func StartTransports(ctx context.Context, cfg types.Config, shellJobs *ShellJobs) ([]mcp.Transport, error)

func StartWebMCPServer

func StartWebMCPServer(ctx context.Context, transport mcp.Transport, cfg types.Config) error

StartWebMCPServer starts the web MCP server exposing web_fetch and web_search. web_fetch reuses the session's main model and request options (model, API key, base URL, metadata, and reasoning effort) for its extraction pass.

func TransportForServer added in v0.3.0

func TransportForServer(srv types.MCPServer) mcp.Transport

TransportForServer returns the client transport for a configured MCP server. A server with URL set uses a remote HTTP/SSE transport (Streamable HTTP by default, SSE when Transport == "sse"); otherwise it launches Command over stdio, inheriting the process environment plus the server's Env.

Types

type ShellJobInfo

type ShellJobInfo struct {
	ID      string
	Script  string
	Status  string // running | completed | failed
	Running bool
	// Backgrounded is true for jobs that run detached from a turn — started via
	// bash_background, or a foreground command the user backgrounded with Ctrl+B.
	// A normal foreground command (consumed inline by the turn) is false.
	Backgrounded bool
}

ShellJobInfo is a UI-facing snapshot of a shell job.

type ShellJobs

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

ShellJobs is the shared registry of shell jobs. It is created in main.go and shared between the shell MCP server (which starts/manages jobs) and the UI (which lists jobs for the footer and backgrounds the foreground one on Ctrl+B).

func NewShellJobs

func NewShellJobs() *ShellJobs

NewShellJobs creates an empty shared shell-job registry.

func NewShellJobsInDir added in v0.4.1

func NewShellJobsInDir(dir string) *ShellJobs

NewShellJobsInDir creates a shell-job registry whose commands run in dir (cmd.Dir). An empty dir preserves the legacy process-cwd behavior.

func (*ShellJobs) DetachForeground

func (s *ShellJobs) DetachForeground() (string, bool)

DetachForeground backgrounds the running foreground shell command (Ctrl+B).

func (*ShellJobs) HasForeground

func (s *ShellJobs) HasForeground() bool

HasForeground reports whether a detachable foreground shell command is currently running.

func (*ShellJobs) HasRunning

func (s *ShellJobs) HasRunning() bool

HasRunning reports whether any shell job (background or foreground) is still running. Used as a WithPendingWork predicate so the live agent run parks while a backgrounded shell command is still in flight.

func (*ShellJobs) Kill

func (s *ShellJobs) Kill(id string) bool

Kill stops a shell job by id.

func (*ShellJobs) List

func (s *ShellJobs) List() []ShellJobInfo

List returns all shell jobs in start order, oldest first.

func (*ShellJobs) Output

func (s *ShellJobs) Output(id string) (stdout, stderr string, ok bool)

Output returns the captured stdout/stderr of a shell job by id.

func (*ShellJobs) SetOnJobDone

func (s *ShellJobs) SetOnJobDone(fn func(ShellJobInfo))

SetOnJobDone registers a callback invoked once for each shell job that finishes (from the job's wait goroutine). The session uses it to inject a completion notice into the live run. fn receives a UI-facing snapshot; it is called for every job — the caller decides whether to act (e.g. only on backgrounded jobs). Safe to call once at setup.

Jump to

Keyboard shortcuts

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