mcpserver

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, service *app.Service, vault string, in io.Reader, out io.Writer) error

Types

type MCPError

type MCPError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

func (*MCPError) Error

func (e *MCPError) Error() string

type Request

type Request struct {
	JSONRPC string         `json:"jsonrpc,omitempty"`
	ID      int            `json:"id,omitempty"`
	Method  string         `json:"method"`
	Params  map[string]any `json:"params,omitempty"`
}

type Resource

type Resource struct {
	URI         string `json:"uri"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

type Response

type Response struct {
	JSONRPC   string         `json:"jsonrpc,omitempty"`
	ID        int            `json:"id,omitempty"`
	Tools     []Tool         `json:"tools,omitempty"`
	Resources []Resource     `json:"resources,omitempty"`
	Result    map[string]any `json:"result,omitempty"`
	Error     *MCPError      `json:"error,omitempty"`
}

type Server

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

func NewServer

func NewServer(service *app.Service, vault string) *Server

func (*Server) Handle

func (s *Server) Handle(ctx context.Context, req Request) (Response, error)

type Tool

type Tool struct {
	Name         string         `json:"name"`
	Description  string         `json:"description"`
	InputSchema  map[string]any `json:"input_schema,omitempty"`
	Readonly     bool           `json:"readonly,omitempty"`
	BodyExposure string         `json:"body_exposure,omitempty"`
	CostClass    string         `json:"cost_class,omitempty"`
	Scope        string         `json:"scope,omitempty"`
}

Jump to

Keyboard shortcuts

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