mcpserver

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Overview

Package mcpserver builds the transport-agnostic MCP server for this repository.

The server defined here knows nothing about how it is connected to a client: the same *mcp.Server is driven by the stdio and http subcommands in internal/cli. Keeping transport concerns out of this package is the seam that lets a consumer keep one transport and delete the other without ever touching the server or its capabilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options Options) (*mcp.Server, error)

New constructs the agentcompute MCP server and registers its capabilities.

New is transport-agnostic; callers choose a transport when they run the returned server (see internal/cli). The official MCP surface is exactly search_api, describe_api, and execute. Diagnostics go to Options.Logger.

Types

type Dependencies

type Dependencies struct {
	// Sandbox is the sandbox lifecycle service consumed by sandbox.* handlers.
	Sandbox sandboxService

	// Instance is the guest service consumed by instance.* handlers.
	Instance instanceService

	// Network is the network service consumed by net.* handlers.
	Network networkService

	// Image is the catalog service consumed by image.list and instance.create.
	Image imageService

	// Desktop proxies the guest Driver and publishes screenshot URLs.
	Desktop desktopService
}

Dependencies holds the consumer services CodeMode handlers close over.

func NewDependencies

func NewDependencies(svc *compute.Service, driver desktopService) Dependencies

NewDependencies adapts a compute service to the handler consumer interfaces.

type Options

type Options struct {
	// Version is the release version reported in the server implementation info.
	Version string

	// Deps carries the shared services the server's capabilities need.
	Deps Dependencies

	// Logger receives server diagnostics. Nil selects a text handler writing
	// to [os.Stderr].
	//
	// WARNING: a logger must never write to [os.Stdout]. The stdio transport
	// reserves stdout for the JSON-RPC message stream, so a single log line
	// there corrupts the protocol. Writing to stderr (the default) is safe for
	// every transport.
	Logger *slog.Logger

	// Resolver resolves the trusted invocation subject from host-owned context.
	// There is no default. The stdio command supplies a process-owned
	// [hostmcp.StaticSubject]; the http command supplies [hostmcp.ContextSubject]
	// and installs identity on each request.
	Resolver hostmcp.InvocationResolver

	// Runtime configures the CodeMode catalog, authorizer, and execution
	// budgets. There is no default authorizer: the CLI supplies
	// [github.com/meigma/codemode/authz.AllowAll]. Zero MaxExecutionTime and
	// MaxNativeCalls receive slice-1 defaults (15m / 1000) before Build; other
	// zero-valued limit fields receive CodeMode defaults at Build.
	Runtime codemode.Options
}

Options configures the agentcompute MCP server.

Jump to

Keyboard shortcuts

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