Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package server builds the MCP server and wires each registered tools.Tool into it: New's AddTool call supplies the SDK with the tool's name, description, and input schema — which the SDK uses on its own to answer ListTools — plus a CallTool handler built by adapt. adapt runs the tool's Validate/Execute contract, recovers from panics so one tool's bug can't take down the connection, and sanitizes execution errors (via clientMessage) before they reach the client. The resource, prompt and completion handlers recover from panics and word their errors the same way (recoverAsInternal, internalError).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(name, version string, logger *slog.Logger, opts Options) *mcp.Server

New builds the sync82 MCP server with everything opts lists. name/version identify the server to connecting clients; logger receives every diagnostic message and must write only to stderr — stdout is the JSON-RPC channel over the stdio transport. A tool call that creates, renames or deletes a project tells clients the resource list changed, when resources are served.

Types

type Options added in v1.2.0

type Options struct {
	Tools             []tools.Tool
	Prompts           []tools.PromptDefinition
	ResourceTemplates []tools.ResourceTemplate
	Resources         *tools.Resources
}

Options lists what New registers on the server. Tools are registered with their toolAnnotations and Prompts as MCP prompts. When Resources is not nil, ResourceTemplates are served through it, and the arguments of Prompts and ResourceTemplates are completed from it; without it, neither resources nor completion are offered.

Jump to

Keyboard shortcuts

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