server

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package server provides the MCP server implementation for the OpenStreetMap integration.

Index

Constants

View Source
const (
	// ServerName is the name of the MCP server
	ServerName = "osm-mcp-server"

	// ServerVersion is the version of the MCP server
	ServerVersion = "0.1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler represents the HTTP server handler

func NewHandler

func NewHandler(logger *slog.Logger) *Handler

NewHandler creates a new server handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface

type Server

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

Server encapsulates the MCP server with OpenStreetMap tools.

func NewServer

func NewServer() (*Server, error)

NewServer creates a new OpenStreetMap MCP server with all tools registered.

func (*Server) Run

func (s *Server) Run() error

Run starts the MCP server using stdin/stdout for communication. This method blocks until the server is stopped or an error occurs.

func (*Server) RunWithContext

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

RunWithContext starts the MCP server and allows for graceful shutdown via context. This method blocks until the context is canceled or an error occurs.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown initiates a graceful shutdown of the server. It does not block and returns immediately. Using sync.Once to ensure we don't close an already closed channel.

func (*Server) WaitForShutdown

func (s *Server) WaitForShutdown()

WaitForShutdown blocks until the server has fully shut down.

Jump to

Keyboard shortcuts

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