app

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package app wires the gateway's components (store, approval workflow, proxy, API/dashboard) into one runnable process. It exists so cmd/mcp-shield/main.go stays a thin entrypoint and so integration tests can start/stop a fully wired gateway in-process on ephemeral ports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {

	// ProxyAddr/APIAddr report the actual bound address, which matters
	// when the configured addr uses port 0 (as integration tests do).
	ProxyAddr string
	APIAddr   string
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*App, error)

func (*App) Shutdown

func (a *App) Shutdown(ctx context.Context) error

func (*App) Start

func (a *App) Start(_ context.Context) error

Start launches the proxy and API listeners in background goroutines and returns immediately. Serve errors after a clean Shutdown are swallowed; anything else is logged.

type Config

type Config struct {
	DatabasePath string
	ProxyAddr    string // e.g. ":8080"; empty defaults to ":8080"
	APIAddr      string // e.g. ":8081"; empty defaults to ":8081"
	FailMode     approval.FailMode
	Servers      []mcp.ServerConfig
	TemplatesDir string // empty uses api.DefaultTemplatesDir

	// UpstreamTimeout bounds one proxied request's upstream work; zero
	// uses mcp.DefaultUpstreamTimeout.
	UpstreamTimeout time.Duration

	// NotifyConfigPath points at the notification config. A missing file
	// disables notifications, which is the default.
	NotifyConfigPath string
}

Jump to

Keyboard shortcuts

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