config

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is the current version of the MCP server. It is set at build time using -ldflags "-X 'github.com/teamwork/mcp/internal/config.Version=1.0.0'". If not set, it defaults to "dev".

Functions

func CustomerURLFromContext

func CustomerURLFromContext(ctx context.Context) (string, bool)

CustomerURLFromContext returns the customer URL from the context, if any.

func NewMCPClient

func NewMCPClient(
	ctx context.Context,
	resources Resources,
	transport transport.Interface,
	options ...client.ClientOption,
) (*client.Client, *mcp.InitializeResult, error)

NewMCPClient creates a new MCP client.

func NewMCPServer

func NewMCPServer(resources Resources, groups ...*toolsets.ToolsetGroup) *server.MCPServer

NewMCPServer creates a new MCP server with the given resources and toolset group.

func WithCrossRegion

func WithCrossRegion(ctx context.Context, crossRegion bool) context.Context

WithCrossRegion adds a boolean value to the context indicating if the request is cross-region.

func WithCustomerURL

func WithCustomerURL(ctx context.Context, customerURL string) context.Context

WithCustomerURL returns a new context with the given customer URL.

func WithScopes added in v1.5.1

func WithScopes(ctx context.Context, scopes []string) context.Context

WithScopes adds all scopes related to the Bearer Token to the context.

Types

type Resources

type Resources struct {

	// Info stores environment variables mappings.
	Info struct {
		// Version is the current version of the MCP server.
		Version string
		// ServerAddress is the address of the server. This is useful for the MCP
		// server in HTTP mode.
		ServerAddress string
		// Environment is the environment this app is running in.
		Environment string
		// AWSRegion is the AWS region this app is running in.
		AWSRegion string
		// MCPURL is the base URL of the MCP server. This is useful for the MCP
		// server in HTTP mode.
		MCPURL string
		// APIURL is the base URL of the Teamwork API.
		APIURL string
		// HAProxyURL is the URL of the HAProxy instance. This is useful for the MCP
		// server in HTTP mode.
		HAProxyURL string
		// BearerToken is the bearer token to be used to authenticate with Teamwork
		// API. This is useful for the MCP server in STDIO mode.
		BearerToken string
		// Log contains the logging configuration.
		Log struct {
			// Format is the format of the logs. It can be "json" or "text".
			Format string
			// Level is the log level. It can be "debug", "info", "warn", "error" or
			// "fatal".
			Level string
			// SentryDSN is the Sentry DSN to be used for error reporting.
			SentryDSN string
		}
		// DatadogAPM contains the configuration for Datadog APM. This is useful for
		// the MCP server in HTTP mode.
		DatadogAPM struct {
			// Enabled indicates if Datadog APM is enabled.
			Enabled bool
			// Service is the name of the service to be used in Datadog APM.
			Service string
			// AgentHost is the host of the Datadog Agent.
			AgentHost string
			// AgentPort is the port of the Datadog Agent.
			AgentPort string
			// StatsdPort is the port of the DogStatsD Agent.
			StatsdPort string
			// Environment is the environment to be used in Datadog APM.
			Environment string
			// Version is the version of the service to be used in Datadog APM.
			Version string
		}
	}
	// contains filtered or unexported fields
}

Resources stores all the resources loaded in the startup.

func Load

func Load(logOutput io.Writer) (Resources, func())

Load loads the configuration for the MCP service.

func (*Resources) DeskClient added in v1.5.0

func (r *Resources) DeskClient() *desksdk.Client

DeskClient returns the Teamwork Desk Client for use.

func (*Resources) Logger

func (r *Resources) Logger() *slog.Logger

Logger returns the logger resource.

func (*Resources) TeamworkEngine

func (r *Resources) TeamworkEngine() *twapi.Engine

TeamworkEngine returns the Teamwork Engine instance to be used to make requests to Teamwork API.

func (*Resources) TeamworkHTTPClient

func (r *Resources) TeamworkHTTPClient() *http.Client

TeamworkHTTPClient returns the HTTP client to be used to make requests to Teamwork API.

Jump to

Keyboard shortcuts

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