mcpserver

package
v1.7.13 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExampleTool = &Tool{
	Name:        "example_mcp_server",
	Description: "Returns a random integer",
	Args:        util.FieldDescs{{Key: "max", Description: "Maximum possible random int (exclusive), defaults to 100"}},
	Fn:          exampleHandler,
}
View Source
var GetProjectTool = &Tool{
	Name:        "get_project",
	Description: "Get details of a specific project managed by " + util.AppName,
	Args: util.FieldDescs{
		{Key: "id", Description: "Optional project id. If omitted, all projects will be returned"},
	},
	Fn: projectsHandler,
}
View Source
var ListProjectsTool = &Tool{
	Name:        "list_projects",
	Description: "List the projects managed by " + util.AppName,
	Fn:          projectsHandler,
}

Functions

func AddDefaultTools added in v1.7.12

func AddDefaultTools(ts ...*Tool)

func ClearDefaultTools added in v1.7.12

func ClearDefaultTools()

func UsageCLI added in v1.7.12

func UsageCLI() string

func UsageHTTP added in v1.7.12

func UsageHTTP() string

Types

type Server

type Server struct {
	MCP   *server.MCPServer `json:"-"`
	State *app.State        `json:"-"`
	Tools Tools
	HTTP  http.Handler `json:"-"`
}

func CurrentDefaultServer added in v1.7.13

func CurrentDefaultServer() *Server

func GetDefaultServer added in v1.7.12

func GetDefaultServer(ctx context.Context, as *app.State, logger util.Logger) (*Server, error)

func NewServer

func NewServer(ctx context.Context, as *app.State, logger util.Logger, tools ...*Tool) (*Server, error)

func (*Server) AddTools

func (s *Server) AddTools(as *app.State, logger util.Logger, tools ...*Tool) error

func (*Server) ServeCLI added in v1.7.12

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

func (*Server) ServeHTTP added in v1.7.12

func (s *Server) ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request, logger util.Logger)

type Tool

type Tool struct {
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Icon        string          `json:"icon,omitempty"`
	Args        util.FieldDescs `json:"args,omitempty"`
	Fn          ToolHandler     `json:"-"`
}

func (Tool) Handler

func (t Tool) Handler(as *app.State, logger util.Logger) server.ToolHandlerFunc

func (Tool) IconSafe added in v1.7.12

func (t Tool) IconSafe() string

func (Tool) ToMCP

func (t Tool) ToMCP() (mcp.Tool, error)

type ToolHandler

type ToolHandler func(ctx context.Context, as *app.State, req mcp.CallToolRequest, args util.ValueMap, logger util.Logger) (string, error)

type Tools added in v1.6.18

type Tools []*Tool

func (Tools) Get added in v1.7.12

func (t Tools) Get(n string) *Tool

Jump to

Keyboard shortcuts

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