Skip to main content
Glama
config.go1.19 kB
package server import ( "fmt" "log/slog" "os" "path/filepath" "time" ) // Config controls the behaviour of the MCP <-> gopls bridge. type Config struct { WorkspaceDir string GoplsPath string LogFile string LogJSON bool LogLevel slog.Level ShutdownTimeout time.Duration RPCTimeout time.Duration } // DefaultConfig returns sensible defaults for local development. func DefaultConfig() Config { return Config{ WorkspaceDir: ".", LogLevel: slog.LevelInfo, LogJSON: false, ShutdownTimeout: 15 * time.Second, RPCTimeout: 45 * time.Second, } } // Normalize validates and normalizes the configuration. func (c *Config) Normalize() error { if c.WorkspaceDir == "" { c.WorkspaceDir = "." } abs, err := filepath.Abs(c.WorkspaceDir) if err != nil { return fmt.Errorf("resolve workspace dir: %w", err) } if stat, statErr := os.Stat(abs); statErr != nil || !stat.IsDir() { return fmt.Errorf("workspace dir invalid: %w", statErr) } c.WorkspaceDir = abs if c.ShutdownTimeout <= 0 { c.ShutdownTimeout = 15 * time.Second } if c.RPCTimeout <= 0 { c.RPCTimeout = 45 * time.Second } return nil }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hloiseaufcms/mcp-gopls'

If you have feedback or need assistance with the MCP directory API, please join our Discord server