continuedev/continue · error · Error

Invalid MCP server configuration

Error message

Invalid MCP server configuration

What it means

Thrown by convertJsonMcpConfigToYamlMcpConfig when the input MCP server JSON config matches neither the stdio/sse nor the http configuration shape, so no conversion branch produced a result. The function walks known config variants and falls through to a final throw.

Source

Thrown at packages/config-yaml/src/schemas/mcp/convertJson.ts:103

    if (jsonConfig.type) {
      sseOrHttpConfig.type =
        jsonConfig.type === "http" ? "streamable-http" : "sse";
    }

    if (jsonConfig.headers) {
      sseOrHttpConfig.requestOptions = {
        headers: jsonConfig.headers,
      };
    }

    return {
      warnings,
      yamlConfig: sseOrHttpConfig,
    };
  }

  throw new Error(`Invalid MCP server configuration`);
}

/**
 * Convert from YAML schema (used in Continue) to JSON schema (e.g. used in Claude Desktop)
 */
export function convertYamlMcpConfigToJsonMcpConfig(yamlConfig: MCPServer): {
  name: string;
  jsonConfig: McpJsonConfig;
  MCP_TIMEOUT?: string;
  warnings: string[];
} {
  const { name, faviconUrl } = yamlConfig;

  const warnings: string[] = [];
  if (faviconUrl) {
    warnings.push(
      `\`faviconUrl\` from YAML MCP config not supported in Claude-style JSON, will be removed from server ${name}`,
    );

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Inspect the JSON server entry and confirm it is one of: stdio ({command, args?}), SSE ({url}), or HTTP ({url})
  2. Fix or remove unknown/misspelled keys (e.g. 'type' values or missing 'command'/'url')
  3. Validate the JSON against the Claude Desktop mcpServers schema before converting
  4. Wrap the conversion call in try-catch and report the offending server entry to the user instead of crashing

Example fix

// before
const { yamlConfig } = convertJsonMcpConfigToYamlMcpConfig({ servers: { bad: { transpor: 'stdio' } } });

// after
const { yamlConfig } = convertJsonMcpConfigToYamlMcpConfig({ servers: { good: { command: 'npx', args: ['-y', 'server'] } } });
Defensive patterns

Strategy: type-guard

Validate before calling

const isValidJsonServer = (s: any) => Boolean(s && (typeof s.command === 'string' || typeof s.url === 'string'));

Type guard

function isConvertibleJsonServer(s: unknown): s is { command?: string; url?: string; [k: string]: unknown } { const o = s as any; return !!o && (typeof o.command === 'string' || typeof o.url === 'string'); }

Try / catch

try { const { yamlConfig } = convertJsonMcpConfigToYamlMcpConfig(cfg); } catch (e) { if (e.message === 'Invalid MCP server configuration') { /* skip/report bad server */ } else throw e; }

Prevention

When it happens

Trigger: Calling convertJsonMcpConfigToYamlMcpConfig with an MCP server JSON entry that has no recognized type discriminator (missing 'command' for stdio, missing 'url' for sse/http, or an unknown transport type field).

Common situations: Hand-editing mcpServers JSON (Claude Desktop format) with typos, migrating configs between versions where the schema changed, or passing a config object with extra/renamed keys so none of the internal shape checks match.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/f0003646c97de371. Report an issue: GitHub.