Help us shape the future of Go! Take the 2026 Go Developer Survey

mcp

package
v1.3.401 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package mcp exposes opt-in, read-only tools over a single Streamable HTTP endpoint.

Index

Constants

View Source
const Endpoint = "/dev/mcp"

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(server *sdk.Server, token string, allowedOrigins []string) http.Handler

NewHandler requires a bearer token even in local mode. Empty tokens fail closed.

func NewServer

func NewServer(name string, commands []Command) *sdk.Server

NewServer lets projects combine Hitrix commands with their own commands.

func Pagination

func Pagination(page, pageSize int) (int, int, error)

Pagination supplies bounded defaults for read-only commands.

func RegisterErrorLog

func RegisterErrorLog(server *sdk.Server)

RegisterErrorLog adds the built-in read-only log tool.

func RegisterRoutes

func RegisterRoutes(ginEngine *gin.Engine)

RegisterRoutes keeps MCP separate from dev-panel JWT/cookie authentication.

Types

type Command

type Command = func(*sdk.Server)

Command registers tools on the shared server. Commands must only read data.

func NewErrorLogCommand

func NewErrorLogCommand(read func(context.Context, string) map[string]string) Command

NewErrorLogCommand permits isolated tests or an alternative read-only log store.

type ErrorLogEntry

type ErrorLogEntry struct {
	ID string
	*errorlogger.Entry
}

type ErrorLogInput

type ErrorLogInput struct {
	Group          string `json:"group,omitempty" jsonschema:"Log group: error (default), service, warning, or missing-translation"`
	ErrorID        string `json:"error_id,omitempty" jsonschema:"Exact stored entry ID for reading one error in detail"`
	AppName        string `json:"app_name,omitempty" jsonschema:"Case-insensitive app name substring filter"`
	Query          string `json:"query,omitempty" jsonschema:"Search ID, message, file, request, stack, app, service, time, and ticket link"`
	Trace          string `json:"trace,omitempty" jsonschema:"Case-insensitive stack trace substring filter"`
	SortBy         string `json:"sort_by,omitempty" jsonschema:"Sort by time (default) for recent errors or counter for most frequent errors"`
	IncludeRequest bool   `json:"include_request,omitempty" jsonschema:"Include captured requests with common credentials masked; defaults to false"`
	IncludeStack   bool   `json:"include_stack,omitempty" jsonschema:"Include stack traces with common credentials masked; defaults to false"`
	Page           int    `json:"page,omitempty" jsonschema:"Page number starting at 1; defaults to 1"`
	PageSize       int    `json:"page_size,omitempty" jsonschema:"Entries per page, from 1 to 100; defaults to 50"`
}

type ErrorLogOutput

type ErrorLogOutput struct {
	Group    string
	Rows     []ErrorLogEntry
	Total    int
	Page     int
	PageSize int
}

Jump to

Keyboard shortcuts

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