anthropics/skills · error · ValueError

URL is required for sse transport

Error message

URL is required for sse transport

What it means

create_connection() requires a url for transport='sse': SSE MCP servers are reached over HTTP at a known endpoint, so an MCPConnectionSSE cannot be constructed without one. The check fails fast when url is None/empty instead of producing a client that can never connect.

Source

Thrown at skills/mcp-builder/scripts/connections.py:142

        command: Command to run (stdio only)
        args: Command arguments (stdio only)
        env: Environment variables (stdio only)
        url: Server URL (sse and http only)
        headers: HTTP headers (sse and http only)

    Returns:
        MCPConnection instance
    """
    transport = transport.lower()

    if transport == "stdio":
        if not command:
            raise ValueError("Command is required for stdio transport")
        return MCPConnectionStdio(command=command, args=args, env=env)

    elif transport == "sse":
        if not url:
            raise ValueError("URL is required for sse transport")
        return MCPConnectionSSE(url=url, headers=headers)

    elif transport in ["http", "streamable_http", "streamable-http"]:
        if not url:
            raise ValueError("URL is required for http transport")
        return MCPConnectionHTTP(url=url, headers=headers)

    else:
        raise ValueError(f"Unsupported transport type: {transport}. Use 'stdio', 'sse', or 'http'")

View on GitHub (pinned to f6656c1256)

Solutions

  1. Pass the server endpoint: create_connection(name='x', transport='sse', url='http://localhost:8000/sse').
  2. If the config has a command instead of a url, that server is stdio — set transport='stdio'.
  3. Verify the key name is exactly 'url' and the value is a full URL with scheme.
  4. Add headers if the SSE endpoint needs auth: headers={'Authorization': 'Bearer ...'}.

Example fix

# before
create_connection(name="remote", transport="sse")

# after
create_connection(name="remote", transport="sse", url="https://mcp.example.com/sse")
Defensive patterns

Strategy: validation

Validate before calling

from urllib.parse import urlparse

def valid_sse_entry(entry: dict) -> bool:
    url = entry.get("url") or ""
    return bool(url) and urlparse(url).scheme in ("http", "https")

Try / catch

try:
    conn = create_connection(name=n, transport="sse", url=u)
except ValueError as e:
    if "URL is required" in str(e):
        raise ConfigError(f"server {n!r}: sse entry missing 'url'") from e
    raise

Prevention

When it happens

Trigger: Calling create_connection(transport='sse') without url — typically a config entry where the server was declared with a command (stdio-style) but transport set to 'sse', or the url key is missing/misspelled.

Common situations: Copy-pasted MCP server configs mixing fields from stdio and sse examples; forgetting the http(s):// scheme so a hostname string is treated as absent by later validation; renamed keys in config ('endpoint' vs 'url').

Related errors


AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14). Data as JSON: /api/errors/38b587dd63c2be2b. Report an issue: GitHub.