Documentation
¶
Overview ¶
Package server implements the MCP server functionality.
It handles loading tool configurations, starting the server, and processing requests from AI clients using the MCP protocol.
Index ¶
- func GetDescription(cfg Config) (string, error)
- type Config
- type Server
- func (s *Server) CreateServer() error
- func (s *Server) ExecuteTool(ctx context.Context, toolName string, args map[string]interface{}) (string, error)
- func (s *Server) GetOpenAITools() ([]openai.Tool, error)
- func (s *Server) GetTools() ([]mcp.Tool, error)
- func (s *Server) Start() error
- func (s *Server) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDescription ¶ added in v0.1.5
GetDescription returns the description for the MCP server It can get the description from: 1. The config file 2. Command line flags 3. Files 4. URLs
Types ¶
type Config ¶
type Config struct {
ConfigFile string // Path to the YAML configuration file
Shell string // Shell to use for executing commands
Logger *common.Logger // Logger for server operations
Version string // Version string for the server
Descriptions []string // Descriptions shown to AI clients (can be specified multiple times)
DescriptionFiles []string // Paths to files containing descriptions (can be specified multiple times)
DescriptionOverride bool // Whether to override the description in the config file
}
Config contains the configuration options for creating a new Server
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the MCPShell server that handles tool registration and request processing.
func New ¶
New creates a new Server instance with the provided configuration
Parameters:
- cfg: The server configuration
Returns:
- A new Server instance
func (*Server) CreateServer ¶ added in v0.0.14
CreateServer initializes the MCP server instance
func (*Server) ExecuteTool ¶ added in v0.0.14
func (s *Server) ExecuteTool(ctx context.Context, toolName string, args map[string]interface{}) (string, error)
ExecuteTool executes a specific tool with the given parameters Used by the agent to execute tools requested by the LLM
func (*Server) GetOpenAITools ¶ added in v0.0.14
convertMCPToolsToOpenAI converts MCP tools to OpenAI tool format
func (*Server) GetTools ¶ added in v0.0.14
GetTools returns all available MCP tools from the server Used by the agent to get tools for the LLM
func (*Server) Start ¶
Start initializes the MCP server, loads tools from the configuration file, and starts listening for client connections.
Returns:
- An error if server initialization or startup fails