@@ -117,11 +117,12 @@ type MCPConfig struct {
119type LSPConfig struct {
119type LSPConfig struct {
120− Disabled bool `json:"enabled,omitempty" jsonschema:"description=Whether this LSP server is disabled,default=false"`
120+ Disabled bool `json:"enabled,omitempty" jsonschema:"description=Whether this LSP server is disabled,default=false"`
121− Command string `json:"command" jsonschema:"required,description=Command to execute for the LSP server,example=gopls"`
121+ Command string `json:"command" jsonschema:"required,description=Command to execute for the LSP server,example=gopls"`
122− Args []string `json:"args,omitempty" jsonschema:"description=Arguments to pass to the LSP server command"`
122+ Args []string `json:"args,omitempty" jsonschema:"description=Arguments to pass to the LSP server command"`
123+ Env map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set to the LSP server command"`
123− Options any `json:"options,omitempty" jsonschema:"description=LSP server-specific configuration options"`
124+ Options any `json:"options,omitempty" jsonschema:"description=LSP server-specific configuration options"`
124− FileTypes []string `json:"filetypes,omitempty" jsonschema:"description=File types this LSP server handles,example=go,example=mod,example=rs,example=c,example=js,example=ts"`
125+ FileTypes []string `json:"filetypes,omitempty" jsonschema:"description=File types this LSP server handles,example=go,example=mod,example=rs,example=c,example=js,example=ts"`
127type TUIOptions struct {
128type TUIOptions struct {
@@ -186,22 +187,12 @@ func (l LSPs) Sorted() []LSP {
186 return sorted
187 return sorted
189−func (m MCPConfig) ResolvedEnv() []string {
190+func (l LSPConfig) ResolvedEnv() []string {
190− resolver := NewShellVariableResolver(env.New())
191+ return resolveEnvs(l.Env)
191− for e, v := range m.Env {
193− m.Env[e], err = resolver.ResolveValue(v)
195− slog.Error("error resolving environment variable", "error", err, "variable", e, "value", v)
200− env := make([]string, 0, len(m.Env))
194+func (m MCPConfig) ResolvedEnv() []string {
201− for k, v := range m.Env {
202− env = append(env, fmt.Sprintf("%s=%s", k, v))
204− return env
195+ return resolveEnvs(m.Env)
207func (m MCPConfig) ResolvedHeaders() map[string]string {
198func (m MCPConfig) ResolvedHeaders() map[string]string {
@@ -509,3 +500,21 @@ func (c *ProviderConfig) TestConnection(resolver VariableResolver) error {
509 _ = b.Body.Close()
500 _ = b.Body.Close()
510 return nil
501 return nil
504+func resolveEnvs(envs map[string]string) []string {
505+ resolver := NewShellVariableResolver(env.New())
506+ for e, v := range envs {
508+ envs[e], err = resolver.ResolveValue(v)
510+ slog.Error("error resolving environment variable", "error", err, "variable", e, "value", v)
515+ res := make([]string, 0, len(envs))
516+ for k, v := range envs {
517+ res = append(res, fmt.Sprintf("%s=%s", k, v))