mcp

package
v0.47.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const LoginRequiredMessage = "please run 'ivcap login' in your terminal to continue"

LoginRequiredMessage is returned when an MCP tool invocation requires auth but no usable access token is available.

Variables

View Source
var ErrLoginRequired = errors.New(LoginRequiredMessage)

ErrLoginRequired is a sentinel error used to signal that authentication is required.

Functions

func MapToRaw

func MapToRaw(m map[string]any) json.RawMessage

func NewServer

func NewServer(cfg Config) *mcpserver.MCPServer

NewServer constructs an MCP server exposing IVCAP tools.

Types

type Config

type Config struct {
	Logger *log.Logger

	// Version is reported to MCP clients as the server's version (serverInfo.version).
	// The CLI should set this to match the ivcap-cli build version.
	Version string

	// ToolSchema is the schema URN prefix used when discovering tool aspects.
	ToolSchema string

	// TimeoutSec is used both for adapter construction and request timeouts.
	TimeoutSec int

	// ChunkSize is used by artifact uploads.
	ChunkSize int64

	// CreateAdapter must return an authenticated adapter.
	CreateAdapter func(timeoutSec int) (*a.Adapter, error)
}

Config provides CLI-owned dependencies and settings to the MCP server.

Note: the MCP server itself lives in pkg/ so it does not depend on cmd/. Any CLI-specific concerns (config files, flags, env var resolution) should be handled by cmd/ and injected here.

type ToolDefinition

type ToolDefinition struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Schema      map[string]any `json:"fn_schema"`
}

Jump to

Keyboard shortcuts

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