charmbracelet/crush · error

mcp '%s' not found in configuration

Error message

mcp '%s' not found in configuration

What it means

InitializeSingle looks up the named MCP server in the loaded configuration before starting its client. If the name is absent from cfg.Config().MCP, it returns this error without touching state. It is a configuration lookup failure, not a connection failure.

Source

Thrown at internal/agent/tools/mcp/init.go:342

	initMu.Lock()
	started := initStarted
	initMu.Unlock()
	if !started {
		return nil
	}
	select {
	case <-initDone:
		return nil
	case <-ctx.Done():
		return ctx.Err()
	}
}

// InitializeSingle initializes a single MCP client by name.
func InitializeSingle(ctx context.Context, name string, cfg *config.ConfigStore) error {
	m, exists := cfg.Config().MCP[name]
	if !exists {
		return fmt.Errorf("mcp '%s' not found in configuration", name)
	}

	if m.Disabled {
		updateState(name, StateDisabled, nil, nil, Counts{})
		slog.Debug("Skipping disabled MCP", "name", name)
		return nil
	}

	return initClient(ctx, cfg, name, m, currentGen(name), cfg.Resolver())
}

// AuthenticateMCP initiates the OAuth flow for an MCP server that is in
// StateNeedsAuth. It creates the OAuth handler (which starts a local
// callback server), connects to the server (which triggers the browser
// auth flow on 401), and transitions to StateConnected on success.
func AuthenticateMCP(ctx context.Context, cfg *config.ConfigStore, name string) error {
	m, exists := cfg.Config().MCP[name]
	if !exists {

View on GitHub (pinned to 7944b8e522)

Solutions

  1. List configured MCP servers (check cfg.Config().MCP keys) and use an exact existing name.
  2. Add the missing mcp entry to crushrc/crush.json and reload config.
  3. Fix the name passed by EnableDockerMCP to match the configured key.
  4. Validate config loading succeeded and MCP map is non-empty before calling InitializeSingle.

Example fix

// before
err := mcp.InitializeSingle(ctx, "gitHub", cfg) // typo
// after
if _, ok := cfg.Config().MCP["github"]; ok {
	err = mcp.InitializeSingle(ctx, "github", cfg)
}
Defensive patterns

Strategy: validation

Validate before calling

if _, ok := cfg.Config().MCP[name]; !ok {
	return fmt.Errorf("MCP server %q is not configured", name)
}
// safe to call InitializeSingle

Try / catch

if err := mcp.InitializeSingle(ctx, name, cfg); err != nil {
	if strings.Contains(err.Error(), "not found in configuration") {
		// list configured servers and log available names
	}
	return err
}

Prevention

When it happens

Trigger: Calling InitializeSingle(ctx, name, cfg) (directly or via EnableDockerMCP) with a server name that is not defined in the crush config's mcp entries, or after the config was reloaded without that server.

Common situations: Typo in the MCP name passed to EnableDockerMCP; config file defines the server under a different key; config failed to merge so MCP map is empty; server removed from config but still enabled elsewhere.

Related errors


AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29). Data as JSON: /api/errors/2b24846505745a9f. Report an issue: GitHub.