mcp

package
v0.2.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mcp holds the shape of an mcp.json document and the rules a server definition must satisfy.

It is the contract half of the pair whose implementation is internal/infra/mcp, the same split as internal/core/llm and internal/infra/llm. It sits in core because two callers that cannot share anything higher both need it: loading a file for a run, and inspecting an uploaded plugin package before publishing it, which internal/server does and which may not import internal/config.

Index

Constants

View Source
const (
	TransportStdio = "stdio"
	TransportSSE   = "sse"
	TransportHTTP  = "http"
)

Transport names for a server entry's "type" field.

Variables

This section is empty.

Functions

func ValidateServerConfig

func ValidateServerConfig(id string, s ServerConfig) error

ValidateServerConfig reports why an entry could not start.

It runs against the document as written, so it must not depend on variable expansion: a command of "${BUILDMAX_PLUGIN_ROOT}/bin/server" is present, and whether that path exists is a question for the machine that runs it.

Types

type ConfigRoot

type ConfigRoot struct {
	MCPServers map[string]ServerConfig `json:"mcpServers"`
}

ConfigRoot is the root of mcp.json (top-level key mcpServers).

func ParseConfig

func ParseConfig(data []byte) (*ConfigRoot, error)

ParseConfig decodes an mcp.json document without validating its entries.

A document declaring no server returns (nil, nil): an empty file and a missing one mean the same thing to every caller, and neither is an error.

type ServerConfig

type ServerConfig struct {
	Type    string            `json:"type"`
	Command string            `json:"command"`
	Args    []string          `json:"args"`
	Env     map[string]string `json:"env"`
	URL     string            `json:"url"`
}

ServerConfig is one entry in mcpServers.

Jump to

Keyboard shortcuts

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