server

package
v0.244.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package server implements the MCP server with HTTP Streamable and stdio transports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACPHandler added in v0.7.0

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

ACPHandler integrates ACP transport with the Mesnada server.

func NewACPHandler added in v0.7.0

func NewACPHandler(cfg ACPHandlerConfig) *ACPHandler

NewACPHandler creates a new ACP handler for the Mesnada server.

func (*ACPHandler) GetAgent added in v0.7.0

func (h *ACPHandler) GetAgent() acp.ACPAgent

GetAgent returns the underlying ACP agent.

func (*ACPHandler) GetTransport added in v0.7.0

func (h *ACPHandler) GetTransport() *acp.HTTPTransport

GetTransport returns the underlying HTTP transport.

func (*ACPHandler) RegisterRoutes added in v0.7.0

func (h *ACPHandler) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers ACP endpoints on the HTTP mux.

func (*ACPHandler) StartCleanup added in v0.7.0

func (h *ACPHandler) StartCleanup(ctx context.Context)

StartCleanup starts the background cleanup goroutine.

type ACPHandlerConfig added in v0.7.0

type ACPHandlerConfig struct {
	Agent     acp.ACPAgent
	Logger    *log.Logger
	Transport *acp.HTTPTransport
}

ACPHandlerConfig holds configuration for the ACP handler.

type Config

type Config struct {
	Addr         string
	Orchestrator *orchestrator.Orchestrator
	Version      string
	Commit       string
	UseStdio     bool
	AppConfig    *config.Config
	ACPHandler   *ACPHandler              // Optional ACP handler for remote connections
	Remembrances *rag.RemembrancesService // Optional remembrances service
}

Config holds server configuration.

type JSONRPCError

type JSONRPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

JSONRPCError represents a JSON-RPC 2.0 error.

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

JSONRPCRequest represents a JSON-RPC 2.0 request.

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string        `json:"jsonrpc"`
	ID      interface{}   `json:"id,omitempty"`
	Result  interface{}   `json:"result,omitempty"`
	Error   *JSONRPCError `json:"error,omitempty"`
}

JSONRPCResponse represents a JSON-RPC 2.0 response.

type Server

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

Server is the MCP HTTP Streamable and stdio server.

func New

func New(cfg Config) *Server

New creates a new MCP server.

func (*Server) SendEvent

func (s *Server) SendEvent(sessionID string, event interface{}) error

SendEvent sends an event to a session.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server.

func (*Server) Start

func (s *Server) Start() error

Start starts the HTTP server or stdio loop.

type Session

type Session struct {
	ID        string
	CreatedAt time.Time
	// contains filtered or unexported fields
}

Session represents an MCP session.

type Tool

type Tool struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema"`
}

Tool represents an MCP tool definition.

type ToolHandler

type ToolHandler func(ctx context.Context, params json.RawMessage) (interface{}, error)

ToolHandler handles a tool call.

Jump to

Keyboard shortcuts

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