mcpserver

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

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 is the lesstruct-mcp MCP server: a stdio JSON-RPC front over the shared /api/v1 client. Build it with New, serve it with Run.

func New

func New(apiKey, baseURL, version string) (*Server, error)

New builds a Server targeting baseURL with apiKey and reports version in the MCP handshake. The key is resolved by the caller (flag → env → config file); the client validates the base URL shape. Every tool group registers here, so a new group is one register call plus its tools_*.go file.

func NewWithClient

func NewWithClient(c *client.Client, version string) *Server

NewWithClient builds a Server over an existing /api/v1 client. The HTTP front-end uses this to bind each request's API key to its own in-process client; New is the flag/env/config specialization.

func (*Server) Connect

func (s *Server) Connect(ctx context.Context, t mcp.Transport) (*mcp.ServerSession, error)

Connect attaches the tool surface to one client session over t and returns the session. Run is the stdio specialization; Connect is the seam the tests drive with in-memory transports (and any future HTTP transport would share).

func (*Server) MCP

func (s *Server) MCP() *mcp.Server

MCP returns the underlying SDK server so a transport front-end (the server's /mcp endpoint) can attach its own session handling.

func (*Server) Run

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

Run serves the tool surface over stdio until the client disconnects. Stdout is protocol-only; the SDK logs transport noise to stderr.

Jump to

Keyboard shortcuts

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