mcp

package
v0.0.0-...-b190646 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 25 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 mcp serves attest to coding agents over the Model Context Protocol.

The server is read-only and offline: it writes no files, opens no sockets and makes no model calls. Every path an agent supplies is resolved inside the project root. The toolset is fixed at startup.

Index

Constants

View Source
const (
	// MaxFileBytes caps every file the server reads.
	MaxFileBytes = 32 << 20
	// MaxArgumentBytes caps the arguments of one tool call.
	MaxArgumentBytes = 16 << 20
)

Limits on what one call may carry or read.

View Source
const ServerName = "attest"

ServerName is the key the attest entry is written under in every client config.

Variables

This section is empty.

Functions

func NewServer

func NewServer(root *pathguard.Root, version string, logger *slog.Logger) *mcp.Server

NewServer builds the server with its fixed toolset. Logs go to logger.

func Serve

func Serve(ctx context.Context, root *pathguard.Root, version string, logs io.Writer) error

Serve runs the server on stdin and stdout until the client disconnects or ctx ends. Only protocol frames go to stdout; logs go to logs.

func ValidateCommand

func ValidateCommand(argv []string) error

ValidateCommand checks the launch argv written into client configs.

Types

type InstallResult

type InstallResult struct {
	Dir       string   `json:"dir"`
	Created   []string `json:"created"`
	Updated   []string `json:"updated"`
	Unchanged []string `json:"unchanged"`
	Conflict  []string `json:"conflict"`
	// Manual lists the conflicts --force cannot resolve: an attest entry that is
	// not a [mcp_servers.attest] table. It is not part of the JSON output.
	Manual []string `json:"-"`
}

InstallResult lists the client configs by what the install did. Paths are relative to the project directory, with forward slashes.

func Install

func Install(dir string, argv []string, force bool) (InstallResult, error)

Install writes or merges the attest server entry into the Claude Code, Cursor and Codex project configs under dir. Other servers and keys are left as they are. A different existing attest entry is a conflict and is left alone unless force. Every destination is validated and every merge computed before the first write, so a refusal writes nothing.

type ToolInfo

type ToolInfo struct {
	Name         string          `json:"name"`
	Description  string          `json:"description"`
	InputSchema  json.RawMessage `json:"input_schema"`
	OutputSchema json.RawMessage `json:"output_schema"`
}

ToolInfo describes one tool for tools/list and `attest mcp --tools --json`.

func Tools

func Tools() []ToolInfo

Tools lists the fixed toolset.

Jump to

Keyboard shortcuts

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