Documentation
¶
Overview ¶
Package mcp implements a Model Context Protocol (MCP) server. It exposes Blue's tools and skills to external agents via JSON-RPC over SSE transport.
Index ¶
- Constants
- type Handler
- type Server
- func (s *Server) Close()
- func (s *Server) CreateSession() *Session
- func (s *Server) HandleMessage(ctx context.Context, sessionID string, raw []byte) ([]byte, error)
- func (s *Server) RemoveSession(id string)
- func (s *Server) SendToSession(sessionID string, data []byte)
- func (s *Server) SetGenerativeRunner(fn func(ctx context.Context, prompt string, maxTokens int) (string, error))
- func (s *Server) SetToolCallTimeout(d time.Duration)
- func (s *Server) SetWorkspace(w WorkspaceReader)
- func (s *Server) SetWorkspaceRoot(dir string)
- type Session
- type WorkspaceReader
Constants ¶
const ( ProtocolVersion = "2024-11-05" ServerName = "blue-mcp" ServerVersion = buildinfo.Version )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides HTTP endpoints for the MCP server.
func NewHandler ¶
NewHandler creates a new MCP HTTP handler.
func (*Handler) RegisterRoutes ¶
RegisterRoutes registers MCP routes.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the MCP protocol server.
func (*Server) Close ¶
func (s *Server) Close()
Close gracefully shuts down the server, closing all active sessions.
func (*Server) CreateSession ¶
CreateSession creates a new client session.
func (*Server) HandleMessage ¶
HandleMessage processes a JSON-RPC message from a client.
func (*Server) RemoveSession ¶
RemoveSession removes a client session.
func (*Server) SendToSession ¶
SendToSession sends a message to a specific session's SSE stream.
func (*Server) SetGenerativeRunner ¶
func (s *Server) SetGenerativeRunner(fn func(ctx context.Context, prompt string, maxTokens int) (string, error))
SetGenerativeRunner sets the optional LLM subtask runner used by orchestrator.run.
func (*Server) SetToolCallTimeout ¶
SetToolCallTimeout overrides the default tool call timeout.
func (*Server) SetWorkspace ¶
func (s *Server) SetWorkspace(w WorkspaceReader)
SetWorkspace sets the workspace reader for MCP resource access.
func (*Server) SetWorkspaceRoot ¶
SetWorkspaceRoot sets the root directory used by built-in workspace coding tools. Relative paths are resolved against the current process working directory.
type Session ¶
type Session struct {
ID string
Messages chan []byte // outbound messages (server → client)
// contains filtered or unexported fields
}
Session represents an MCP client session.
type WorkspaceReader ¶
WorkspaceReader provides read access to workspace files for MCP resources.