Documentation
¶
Index ¶
- func CallTool(s *MCPServer, params map[string]interface{}) (types.ToolCallResult, error)
- func CombineAnnotations(annotations ...map[string]interface{}) map[string]interface{}
- func DestructiveAnnotation() map[string]interface{}
- func FormatErrorResponse(operation string, err error, risk safety.OperationRisk) string
- func FormatSuccessResponse(operation string, result string, risk safety.OperationRisk, rollbackCmd string) string
- func HandleAdminTool(s *MCPServer, name string, arguments map[string]interface{}) (types.ToolCallResult, error)
- func HandleFileTool(s *MCPServer, name string, args map[string]interface{}) (types.ToolCallResult, error)
- func HandleRequest(s *MCPServer, req types.JSONRPCRequest) types.JSONRPCResponse
- func IdempotentAnnotation() map[string]interface{}
- func IsAdminOperation(operation string) bool
- func IsFileOperation(name string) bool
- func ListAdminTools() []types.Tool
- func ListDashboardTools() []types.Tool
- func ListFileTools() []types.Tool
- func ListGitAdvancedTools() []types.Tool
- func ListGitBasicTools() []types.Tool
- func ListGitHubAPITools() []types.Tool
- func ListGitInfoTools() []types.Tool
- func ListHybridTools() []types.Tool
- func ListRepairTools() []types.Tool
- func ListResponseTools() []types.Tool
- func ListTools(gitAvailable bool, toolsets []string) types.ToolsListResult
- func ModifyingAnnotation() map[string]interface{}
- func OpenWorldAnnotation() map[string]interface{}
- func ReadOnlyAnnotation() map[string]interface{}
- type MCPServer
- type SafetyMiddleware
- func (m *SafetyMiddleware) CheckOperation(ctx context.Context, operation string, parameters map[string]interface{}) (*safety.SafetyCheck, error)
- func (m *SafetyMiddleware) GetEngine() *safety.Engine
- func (m *SafetyMiddleware) GetStatistics() (map[string]interface{}, error)
- func (m *SafetyMiddleware) HandleDryRun(operation string, parameters map[string]interface{}, ...) (types.ToolCallResult, error)
- func (m *SafetyMiddleware) UpdateConfig(safetyConfig *safety.SafetyConfig)
- func (m *SafetyMiddleware) WrapExecution(ctx context.Context, operation string, parameters map[string]interface{}, ...) (types.ToolCallResult, error)
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 ¶
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 ¶
IsAdminOperation checks if an operation requires safety checks
func IsFileOperation ¶
IsFileOperation checks if a tool name is a file operation
func ListAdminTools ¶
ListAdminTools returns the list of administrative tools (v3.0) Consolidated into 4 tools using the operation parameter pattern.
func ListDashboardTools ¶
ListDashboardTools returns the consolidated GitHub dashboard tool
func ListFileTools ¶
ListFileTools returns tools for GitHub file operations (no Git required) Consolidated into 1 tool using the operation parameter pattern.
func ListGitAdvancedTools ¶
ListGitAdvancedTools retorna las herramientas Git avanzadas
func ListGitBasicTools ¶
ListGitBasicTools returns the core Git workflow tools (kept individual for fast access)
func ListGitHubAPITools ¶
ListGitHubAPITools returns the consolidated GitHub API tool
func ListGitInfoTools ¶
ListGitInfoTools returns consolidated Git information tools
func ListHybridTools ¶
ListHybridTools retorna las herramientas híbridas (Git local primero, GitHub API fallback)
func ListRepairTools ¶
ListRepairTools returns the consolidated GitHub repair tool for closing, merging, rerunning, and dismissing
func ListResponseTools ¶
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
Source Files
¶
- admin_handlers.go
- admin_tools.go
- file_handlers.go
- file_tools.go
- safety_middleware.go
- server.go
- tool_annotations.go
- tool_definitions_dashboard.go
- tool_definitions_git_advanced.go
- tool_definitions_git_basic.go
- tool_definitions_git_info.go
- tool_definitions_github.go
- tool_definitions_hybrid.go
- tool_definitions_repair.go
- tool_definitions_response.go