app

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTransportSpecified = errors.New("no transport specified, please use WithTransport to specify a transport")
)

Functions

This section is empty.

Types

type FoxyApp

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

FoxyApp is essentially a builder for a foxy app, that wraps fx.App and provides a more user-friendly interface for building and running your MCP server

You would be calling WithTool, WithResource, WithResourceProvider, WithPrompt to register your tools, resources, resource providers and prompts and then calling Run to start the server, or you can instead call BuildFxApp to get the fx.App instance and run it yourself. You must set transport using WithTransport. Unless you configure server using WithName and WithVersion, it will use default values "my-foxy-contexts-server" and "0.0.1". Finally you can use WithFxOptions to pass additional fx.Options to the fx.App instance before it is built.

func NewFoxyApp

func NewFoxyApp() *FoxyApp

func (*FoxyApp) BuildFxApp

func (f *FoxyApp) BuildFxApp() (*fx.App, error)

BuildFxApp builds the fx.App instance as configured by `With*` methods

func (*FoxyApp) Run

func (f *FoxyApp) Run() error

Run builds and runs the fx.App instance as configured by `With*` methods

func (*FoxyApp) WithFxOptions

func (f *FoxyApp) WithFxOptions(opts ...fx.Option) *FoxyApp

WithFxOptions adds additional fx.Options to fx.App instance

func (*FoxyApp) WithName

func (f *FoxyApp) WithName(name string) *FoxyApp

WithName sets the name of the server

The name would be returned to client during the initialization phase, if not set, it would default to "my-foxy-contexts-server"

func (*FoxyApp) WithPrompt

func (f *FoxyApp) WithPrompt(newPrompt any) *FoxyApp

WithPrompt adds a prompt to the app

newPrompt must be a function that returns a fxctx.Prompt it can also take in any dependencies that you want to inject into the prompt, that will be resolved by the fx framework

func (*FoxyApp) WithResource

func (f *FoxyApp) WithResource(newResource any) *FoxyApp

WithResource adds a resource to the app

newResource must be a function that returns a fxctx.Resource it can also take in any dependencies that you want to inject into the resource, that will be resolved by the fx framework

func (*FoxyApp) WithResourceProvider

func (f *FoxyApp) WithResourceProvider(newResourceProvider any) *FoxyApp

WithResourceProvider adds a resource provider to the app

newResourceProvider must be a function that returns a fxctx.ResourceProvider it can also take in any dependencies that you want to inject into the resource provider, that will be resolved by the fx framework

func (*FoxyApp) WithServerCapabilities added in v0.0.7

func (f *FoxyApp) WithServerCapabilities(serverCapabilities *mcp.ServerCapabilities) *FoxyApp

func (*FoxyApp) WithTool

func (f *FoxyApp) WithTool(newTool any) *FoxyApp

WithTool adds a tool to the app

newTool must be a function that returns a fxctx.Tool it can also take in any dependencies that you want to inject into the tool, that will be resolved by the fx framework

func (*FoxyApp) WithTransport

func (f *FoxyApp) WithTransport(transport server.Transport) *FoxyApp

WithStdioTransport sets up the server to use stdio transport

options can be used to configure the stdio transport

func (*FoxyApp) WithVersion

func (f *FoxyApp) WithVersion(version string) *FoxyApp

WithVersion sets the version of the server

The version would be returned to client during the initialization phase, if not set, it would default to "0.0.1"

type ServerLifecycleParams

type ServerLifecycleParams struct {
	fx.In

	ToolMux     fxctx.ToolMux     `optional:"true"`
	ResourceMux fxctx.ResourceMux `optional:"true"`
	PromptMux   fxctx.PromptMux   `optional:"true"`
	CompleteMux fxctx.CompleteMux `optional:"true"`
}

Jump to

Keyboard shortcuts

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