mcp

package
v0.99.18 Latest Latest
Warning

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

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

Documentation

Overview

Package mcp serves Flowbot capabilities over Streamable HTTP at /mcp and, unless mcp.server_card is false, a public Server Card at /mcp/server-card.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(app *fiber.App, auditor audit.Auditor)

Register mounts Streamable HTTP /mcp when mcp.enabled is true.

func SetRateRedis

func SetRateRedis(c scriptEval)

SetRateRedis replaces the Redis client used for MCP tool rate limits. A nil client clears the override so the process client is used.

Types

type Identity

type Identity struct {
	UID types.Uid
	// TokenID is the access-token row id. Rate-limit keys use it.
	TokenID   int64
	Scopes    []string
	IP        string
	UserAgent string
}

Identity is the authenticated MCP caller (API token, never a web session).

type ToolError

type ToolError = toolerr.ToolError

ToolError is the machine-readable MCP tool failure stored at structuredContent.error.

func ToToolError

func ToToolError(err error) ToolError

ToToolError maps err onto the MCP tool error object. Plain errors and ErrInternal become code internal with a fixed message. ErrInvalidArgument keeps the cause text from types.ClientSafeDomainMessage.

type ToolSpec

type ToolSpec struct {
	Name        string
	Group       string
	Operation   string
	Description string
	Mutation    bool
	Kind        string
	Input       []hub.ParamDef
	Scopes      []string
	Output      map[string]any
}

ToolSpec is one MCP tool advertised on /mcp.

func BuildCatalog

func BuildCatalog(descs []hub.Descriptor, include, exclude []string) []ToolSpec

BuildCatalog returns capability, pipeline/workflow/function, and hub tools after deny-list and mcp.include / mcp.exclude filters.

func FilterByScopes

func FilterByScopes(specs []ToolSpec, scopes []string) []ToolSpec

FilterByScopes keeps tools the token is allowed to call.

func (ToolSpec) Allowed

func (s ToolSpec) Allowed(scopes []string) bool

Allowed reports whether the token may call spec.

Jump to

Keyboard shortcuts

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