Documentation
¶
Overview ¶
Package mcp holds shared MCP catalog rules: deny-list, include/exclude matching, tool naming, JSON Schema mapping, and self-connect detection.
Index ¶
- Constants
- func AgentToolName(server, remote string) string
- func Denied(capability, operation string) bool
- func IsAgentTool(name string) bool
- func IsSelfMCP(rawURL, listen, apiPath string) bool
- func Match(include, exclude []string, group, toolName string) bool
- func PermissionKey(server string) string
- func SchemaFromFields(fields []Field) map[string]any
- func ServerFromAgentTool(tool string) (string, bool)
- func ValidServerName(name string) bool
- func ValidateServerName(name string) error
- type Field
Constants ¶
const ( // AgentToolPrefix is the chat-agent tool name prefix for external MCP tools. AgentToolPrefix = "mcp_" // PermissionKeyPrefix is the permission key prefix for one MCP server. PermissionKeyPrefix = "mcp." )
Variables ¶
This section is empty.
Functions ¶
func AgentToolName ¶
AgentToolName builds mcp_<server>_<remote> for the chat agent registry.
func IsAgentTool ¶
IsAgentTool reports whether name is an outbound MCP agent tool (mcp_<server>_*).
func Match ¶
Match reports whether toolName survives include/exclude. An empty include list means all tools. Exclude always wins. A filter item matching the group (capability or MCP server name) or the full tool name is a hit. Callers that expose /mcp must also apply Denied; outbound MCP clients must not.
func PermissionKey ¶
PermissionKey returns mcp.<server> for permission evaluation.
func SchemaFromFields ¶
SchemaFromFields builds a JSON Schema object for MCP / agent tool parameters.
func ServerFromAgentTool ¶
ServerFromAgentTool extracts the server id from an mcp_<server>_<remote> name.
func ValidServerName ¶
ValidServerName reports whether name is a safe MCP server id (no underscores).
func ValidateServerName ¶
ValidateServerName returns an error when name is empty or illegal.