server

package
v0.0.0-...-f2e6f42 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallTool

func CallTool(s *MCPServer, params map[string]interface{}) (types.ToolCallResult, error)

CallTool ejecuta la herramienta solicitada

func CombineAnnotations

func CombineAnnotations(annotations ...map[string]interface{}) map[string]interface{}

CombineAnnotations merges multiple annotation sets

func DestructiveAnnotation

func DestructiveAnnotation() map[string]interface{}

Destructive annotation for tools that cause irreversible changes

func FormatErrorResponse

func FormatErrorResponse(operation string, err error, risk safety.OperationRisk) string

FormatErrorResponse formats an error response with helpful context

func FormatSuccessResponse

func FormatSuccessResponse(operation string, result string, risk safety.OperationRisk, rollbackCmd string) string

FormatSuccessResponse formats a successful operation response

func HandleAdminTool

func HandleAdminTool(s *MCPServer, name string, arguments map[string]interface{}) (types.ToolCallResult, error)

HandleAdminTool routes consolidated admin tool calls through safety middleware. Uses composite key "toolName:operation" for risk classification.

func HandleFileTool

func HandleFileTool(s *MCPServer, name string, args map[string]interface{}) (types.ToolCallResult, error)

HandleFileTool routes consolidated file operation tool calls by operation parameter

func HandleRequest

func HandleRequest(s *MCPServer, req types.JSONRPCRequest) types.JSONRPCResponse

HandleRequest procesa las peticiones JSON-RPC del protocolo MCP

func IdempotentAnnotation

func IdempotentAnnotation() map[string]interface{}

Idempotent annotation for tools that can be called multiple times safely

func IsAdminOperation

func IsAdminOperation(operation string) bool

IsAdminOperation checks if an operation requires safety checks

func IsFileOperation

func IsFileOperation(name string) bool

IsFileOperation checks if a tool name is a file operation

func ListAdminTools

func ListAdminTools() []types.Tool

ListAdminTools returns the list of administrative tools (v3.0) Consolidated into 4 tools using the operation parameter pattern.

func ListDashboardTools

func ListDashboardTools() []types.Tool

ListDashboardTools returns the consolidated GitHub dashboard tool

func ListFileTools

func ListFileTools() []types.Tool

ListFileTools returns tools for GitHub file operations (no Git required) Consolidated into 1 tool using the operation parameter pattern.

func ListGitAdvancedTools

func ListGitAdvancedTools() []types.Tool

ListGitAdvancedTools retorna las herramientas Git avanzadas

func ListGitBasicTools

func ListGitBasicTools() []types.Tool

ListGitBasicTools returns the core Git workflow tools (kept individual for fast access)

func ListGitHubAPITools

func ListGitHubAPITools() []types.Tool

ListGitHubAPITools returns the consolidated GitHub API tool

func ListGitInfoTools

func ListGitInfoTools() []types.Tool

ListGitInfoTools returns consolidated Git information tools

func ListHybridTools

func ListHybridTools() []types.Tool

ListHybridTools retorna las herramientas híbridas (Git local primero, GitHub API fallback)

func ListRepairTools

func ListRepairTools() []types.Tool

ListRepairTools returns the consolidated GitHub repair tool for closing, merging, rerunning, and dismissing

func ListResponseTools

func ListResponseTools() []types.Tool

ListResponseTools returns the consolidated GitHub response tool

func ListTools

func ListTools(gitAvailable bool, toolsets []string) types.ToolsListResult

ListTools retorna la lista de herramientas disponibles

func ModifyingAnnotation

func ModifyingAnnotation() map[string]interface{}

Modifying annotation for tools that modify state but are reversible

func OpenWorldAnnotation

func OpenWorldAnnotation() map[string]interface{}

OpenWorld annotation for tools that interact with external entities

func ReadOnlyAnnotation

func ReadOnlyAnnotation() map[string]interface{}

ReadOnly annotation for tools that don't modify state

Types

type MCPServer

type MCPServer struct {
	GithubClient    interfaces.GitHubOperations
	GitClient       interfaces.GitOperations
	AdminClient     interfaces.AdminOperations // v3.0: Administrative operations
	Safety          *SafetyMiddleware          // v3.0: Safety filter middleware
	GitAvailable    bool                       // v3.0: Whether git binary is installed
	RawGitHubClient interface{}                // v3.0: Raw *github.Client for file operations
	Toolsets        []string                   // Active toolsets filter (nil = all)
}

MCPServer representa el servidor MCP principal

type SafetyMiddleware

type SafetyMiddleware struct {
	// contains filtered or unexported fields
}

SafetyMiddleware wraps tool execution with safety checks

func NewSafetyMiddleware

func NewSafetyMiddleware(configPath string) (*SafetyMiddleware, error)

NewSafetyMiddleware creates a new safety middleware instance

func (*SafetyMiddleware) CheckOperation

func (m *SafetyMiddleware) CheckOperation(ctx context.Context, operation string, parameters map[string]interface{}) (*safety.SafetyCheck, error)

CheckOperation performs pre-execution safety checks

func (*SafetyMiddleware) GetEngine

func (m *SafetyMiddleware) GetEngine() *safety.Engine

GetEngine returns the underlying safety engine

func (*SafetyMiddleware) GetStatistics

func (m *SafetyMiddleware) GetStatistics() (map[string]interface{}, error)

GetStatistics returns audit log statistics

func (*SafetyMiddleware) HandleDryRun

func (m *SafetyMiddleware) HandleDryRun(
	operation string,
	parameters map[string]interface{},
	previewFunc func() (string, error),
) (types.ToolCallResult, error)

HandleDryRun processes dry-run requests

func (*SafetyMiddleware) UpdateConfig

func (m *SafetyMiddleware) UpdateConfig(safetyConfig *safety.SafetyConfig)

UpdateConfig updates the safety configuration at runtime

func (*SafetyMiddleware) WrapExecution

func (m *SafetyMiddleware) WrapExecution(
	ctx context.Context,
	operation string,
	parameters map[string]interface{},
	executor func() (string, error),
) (types.ToolCallResult, error)

WrapExecution wraps an operation execution with safety checks and audit logging

Jump to

Keyboard shortcuts

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