mcpserver

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 25 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

Overview

SPDX-License-Identifier: MIT Copyright (c) 2026 dr.max

SPDX-License-Identifier: MIT Copyright (c) 2025 dr.max

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string
	AllowedMethods []string
	AllowedHeaders []string
	MaxAge         int
}

CORSConfig represents CORS configuration

func DefaultCORSConfig

func DefaultCORSConfig() *CORSConfig

DefaultCORSConfig returns a default CORS configuration

type Server

type Server struct {
	Tools map[string]Tool
	// contains filtered or unexported fields
}

Server represents the MCP server implementation

func NewServer

func NewServer(cfg *config.Config, logger *zap.Logger) (*Server, error)

NewServer creates a new MCP server

func (*Server) Cleanup

func (s *Server) Cleanup() error

Cleanup cleans up resources

func (*Server) HTTPHandler

func (s *Server) HTTPHandler(token string) http.Handler

HTTPHandler exposes modern MCP and legacy endpoints under the same policy. An empty token is intended for loopback-only listeners.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP handler for the MCP server

func (*Server) MetricsHandler

func (s *Server) MetricsHandler() http.Handler

MetricsHandler returns a standalone metrics HTTP handler for :9091

func (*Server) SDKServer

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

func (*Server) SetCORSConfig

func (s *Server) SetCORSConfig(config *CORSConfig)

SetCORSConfig sets the CORS configuration for the server

type Tool

type Tool struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema"`
	Handler     func(ctx context.Context, args map[string]interface{}) (interface{}, error)
}

Tool represents an MCP tool

Jump to

Keyboard shortcuts

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