mcp

package
v1.12.8 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPConfig added in v1.3.0

type HTTPConfig struct {
	Addr                string
	BaseURL             string
	ResourceURL         string
	OAuthMode           string
	AuthorizationServer string
	OAuthStore          string
	OAuthSQLitePath     string
	OAuthRedisURL       string
	OAuthEncryptionKey  string
	ConsoleURL          string
	ConsoleClientID     string
	ConsoleScopes       []string
	Scopes              []string
	MaxBodyBytes        int64
	// contains filtered or unexported fields
}

HTTPConfig configures the hosted Streamable HTTP MCP endpoint.

func LoadHTTPConfigFromEnv added in v1.3.0

func LoadHTTPConfigFromEnv() HTTPConfig

LoadHTTPConfigFromEnv loads hosted MCP settings from environment variables.

type HTTPHandler added in v1.4.0

type HTTPHandler struct {
	http.Handler
	// contains filtered or unexported fields
}

HTTPHandler serves the hosted MCP endpoint and closes any persistence store it owns when Close is called.

func NewHTTPHandler added in v1.3.0

func NewHTTPHandler(config HTTPConfig) (*HTTPHandler, error)

NewHTTPHandler returns a stateless Streamable HTTP MCP handler with Bearer authentication and OAuth protected-resource discovery.

func (*HTTPHandler) Close added in v1.4.0

func (h *HTTPHandler) Close() error

Close flushes and releases the persistence store owned by the handler.

type Message

type Message struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id,omitempty"`
	Method  string          `json:"method,omitempty"`
	Params  json.RawMessage `json:"params,omitempty"`
	Result  interface{}     `json:"result,omitempty"`
	Error   *RPCError       `json:"error,omitempty"`
}

Message represents an MCP protocol message.

type RPCError

type RPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

RPCError represents an RPC error.

type Server

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

Server represents the MCP server.

func NewServer

func NewServer() (*Server, error)

NewServer creates a new MCP server.

func (*Server) Run

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

Run starts the MCP server.

type Tool

type Tool struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema"`
	Annotations *ToolAnnotations       `json:"annotations,omitempty"`
}

Tool represents an MCP tool definition.

type ToolAnnotations added in v1.3.0

type ToolAnnotations struct {
	ReadOnlyHint    bool  `json:"readOnlyHint,omitempty"`
	DestructiveHint *bool `json:"destructiveHint,omitempty"`
	IdempotentHint  bool  `json:"idempotentHint,omitempty"`
	OpenWorldHint   *bool `json:"openWorldHint,omitempty"`
}

ToolAnnotations describes operational safety hints to MCP clients.

type ToolCallParams

type ToolCallParams struct {
	Name      string                 `json:"name"`
	Arguments map[string]interface{} `json:"arguments"`
}

ToolCallParams represents the parameters for a tools/call request.

Jump to

Keyboard shortcuts

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