Documentation
¶
Index ¶
- Variables
- type FoxyApp
- func (f *FoxyApp) BuildFxApp() (*fx.App, error)
- func (f *FoxyApp) Run() error
- func (f *FoxyApp) WithFxOptions(opts ...fx.Option) *FoxyApp
- func (f *FoxyApp) WithName(name string) *FoxyApp
- func (f *FoxyApp) WithPrompt(newPrompt any) *FoxyApp
- func (f *FoxyApp) WithResource(newResource any) *FoxyApp
- func (f *FoxyApp) WithResourceProvider(newResourceProvider any) *FoxyApp
- func (f *FoxyApp) WithTool(newTool any) *FoxyApp
- func (f *FoxyApp) WithTransport(transport server.Transport) *FoxyApp
- func (f *FoxyApp) WithVersion(version string) *FoxyApp
- type ServerLifecycleParams
Constants ¶
This section is empty.
Variables ¶
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 ¶
BuildFxApp builds the fx.App instance as configured by `With*` methods
func (*FoxyApp) WithFxOptions ¶
WithFxOptions adds additional fx.Options to fx.App instance
func (*FoxyApp) WithName ¶
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 ¶
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 ¶
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 ¶
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) WithTool ¶
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 ¶
WithStdioTransport sets up the server to use stdio transport
options can be used to configure the stdio transport
func (*FoxyApp) WithVersion ¶
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"` }