MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / ServerFromSchema

Function ServerFromSchema

internal/mcp/client.go:276–289  ·  view source on GitHub ↗

ServerFromSchema constructs a Server from a registry schema, choosing the preferred installation method. Returns an error when the schema has no installations defined.

(schema ServerSchema)

Source from the content-addressed store, hash-verified

274// preferred installation method. Returns an error when the schema has no
275// installations defined.
276func ServerFromSchema(schema ServerSchema) (Server, error) {
277 _, entry, ok := schema.PreferredInstallation()
278 if !ok {
279 return Server{}, fmt.Errorf("mcp: schema %s has no installation methods", schema.Name)
280 }
281 server := Server{Name: schema.Name, Command: entry.Command, Args: entry.Args, Env: entry.Env}
282 if entry.URL != "" {
283 server.URL = entry.URL
284 server.Type = "http"
285 } else {
286 server.Type = "stdio"
287 }
288 return server, nil
289}

Callers 3

InstallFromRegistryMethod · 0.92
mcpAddCommandMethod · 0.92

Calls 1

PreferredInstallationMethod · 0.80