Documentation
¶
Overview ¶
Package server provides the MCP server implementation for Aseprite integration.
This package orchestrates the MCP (Model Context Protocol) server lifecycle, connecting MCP tool requests to Aseprite operations through the aseprite and tools packages.
Server Lifecycle:
- Create server with New() using validated config
- Tools are automatically registered during initialization
- Run() starts the server with stdio transport
- Server processes tool requests via MCP protocol
- Context cancellation triggers graceful shutdown
The server uses stdio transport for communication with MCP clients and supports all registered tool categories (canvas, drawing, animation, etc.).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps the MCP server and provides Aseprite tool implementations.
The server initializes all required components (MCP server, Aseprite client, Lua generator) and automatically registers all available tools. It handles the complete lifecycle of MCP tool request processing.
func New ¶
New creates a new Aseprite MCP server with the given configuration.
The configuration is validated before server creation. If validation fails, an error is returned immediately.
During initialization, New:
- Creates an Aseprite client with configured executable path and timeout
- Initializes a Lua script generator
- Creates the MCP server with protocol implementation
- Automatically registers all available tools
Returns an error if configuration validation fails.
func (*Server) Client ¶
Client returns the underlying Aseprite client for testing.
This method is primarily used in tests to access the client for verification and cleanup operations. Not intended for production use.
func (*Server) Run ¶
Run starts the MCP server with stdio transport.
The server listens for MCP protocol messages on stdin and writes responses to stdout. Tool requests are processed synchronously in the order received.
Run blocks until:
- The context is cancelled (graceful shutdown)
- The client closes the connection
- A fatal error occurs
Returns an error if server startup or execution fails. Context cancellation triggers graceful shutdown and does not return an error.