server

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package server implements a Model Context Protocol (MCP) server that exposes Celeste's capabilities to external clients such as Claude Code, Codex, or any MCP-compatible tool orchestrator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(s *Server)

RegisterHandlers registers all three MCP tool handlers on the server.

Types

type Config

type Config struct {
	// Transport mode: "stdio" or "sse"
	Transport string

	// SSE-specific settings
	Port      int
	BindAddr  string // default "127.0.0.1"
	Remote    bool   // if true, bind to BindAddr (possibly 0.0.0.0)
	CertFile  string // TLS certificate for mTLS
	KeyFile   string // TLS private key for mTLS
	TokenFile string // path to bearer token file (default ~/.celeste/server.token)
	RateLimit int    // requests per minute (default 60)

	// Celeste config for creating LLM clients
	CelesteConfig *config.Config
	Workspace     string
}

Config holds MCP server configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config with sensible defaults.

type ContentBlock

type ContentBlock = mcp.ContentBlock

ContentBlock is a content item in a tool call response. Re-exported from the mcp package for handler convenience.

type Server

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

Server is the MCP server that exposes Celeste tools to external clients.

func New

func New(cfg Config) *Server

New creates a new MCP server with the given configuration.

func (*Server) RegisterTool

func (s *Server) RegisterTool(def mcp.MCPToolDef, handler ToolHandler)

RegisterTool adds a tool definition and its handler to the server.

func (*Server) Serve

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

Serve starts the MCP server using the configured transport. It blocks until the context is cancelled or the server is shut down.

type ToolHandler

type ToolHandler func(ctx context.Context, args map[string]any) ([]mcp.ContentBlock, error)

ToolHandler processes a tool call and returns content blocks.

Jump to

Keyboard shortcuts

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