sipeed/picoclaw · error

MCP server %q not found

Error message

MCP server %q not found

What it means

Returned by picoclaw mcp test <name> when the name is not a key under tools.mcp.servers in the loaded config. The lookup is an exact, case-sensitive map-key match; the command exits before any connectivity check runs.

Source

Thrown at cmd/picoclaw/internal/mcp/test.go:27

)

func newTestCommand() *cobra.Command {
	var timeout time.Duration

	cmd := &cobra.Command{
		Use:   "test <name>",
		Short: "Test connectivity for a configured MCP server",
		Args:  cobra.ExactArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			cfg, err := loadConfig()
			if err != nil {
				return err
			}

			name := args[0]
			server, exists := cfg.Tools.MCP.Servers[name]
			if !exists {
				return fmt.Errorf("MCP server %q not found", name)
			}

			ctx, cancel := context.WithTimeout(context.Background(), timeout)
			defer cancel()

			result, err := serverProbe(ctx, name, server, cfg.WorkspacePath())
			if err != nil {
				return fmt.Errorf("failed to reach MCP server %q: %w", name, err)
			}

			fmt.Fprintf(cmd.OutOrStdout(), "✓ MCP server %q reachable (%d tools).\n", name, result.ToolCount)
			return nil
		},
	}

	cmd.Flags().DurationVar(&timeout, "timeout", 5*time.Second, "Connection timeout")

	return cmd

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. List configured servers with picoclaw mcp list and copy the exact key
  2. Re-run picoclaw mcp test <exact-name>
  3. If the server is missing, add it first with picoclaw mcp add
  4. Verify which config file picoclaw loads for the current workspace

Example fix

# before
$ picoclaw mcp test Github
MCP server "Github" not found

# after
$ picoclaw mcp list
NAME      TYPE     ENABLED
github    stdio    true
$ picoclaw mcp test github
Defensive patterns

Strategy: validation

Validate before calling

if _, ok := cfg.Tools.MCP.Servers[name]; !ok {
  available := make([]string, 0, len(cfg.Tools.MCP.Servers))
  for k := range cfg.Tools.MCP.Servers {
    available = append(available, k)
  }
  return fmt.Errorf("MCP server %q not found; available: %v", name, available)
}

Type guard

func isMCPServerNotFound(err error) bool {
  return err != nil && strings.Contains(err.Error(), "MCP server") && strings.Contains(err.Error(), "not found")
}

Try / catch

if err := testCmd.Execute(); err != nil {
  if isMCPServerNotFound(err) {
    // show `picoclaw mcp list` output next to the error
  }
  return err
}

Prevention

When it happens

Trigger: picoclaw mcp test with a typo'd or wrongly-cased name; testing a server that was never added or was already removed; picoclaw resolving a different config file (workspace vs user) than the one holding the entry.

Common situations: Smoke-test scripts referencing stale server names; entries added in a different directory whose workspace config differs; CI environments with a fresh HOME.

Related errors


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/709ffdabbe2bd65d. Report an issue: GitHub.