HKUDS/DeepTutor · warning · HTTPException

mcp.configure_before_testing

Error message

mcp.configure_before_testing

What it means

Raised by POST /test for an MCP server: the provided MCPServerConfig has neither command nor url, so resolved_type() is None and there is no transport to probe. The server asks you to configure the transport before attempting a connection test.

Source

Thrown at deeptutor/api/routers/mcp_settings.py:125

@router.delete("/servers/{name}")
async def delete_mcp_server(name: str) -> dict[str, Any]:
    config = load_mcp_config()
    servers = {key: value for key, value in config.servers.items() if key != name}
    updated = MCPConfig(servers=servers)
    save_mcp_config(updated)
    manager = get_mcp_manager()
    await manager.reload()
    return {
        "servers": {key: value.model_dump(mode="json") for key, value in updated.servers.items()},
        "status": manager.status(),
    }


@router.post("/test")
async def test_mcp_server(cfg: MCPServerConfig) -> dict[str, Any]:
    transport = cfg.resolved_type()
    if transport is None:
        raise HTTPException(
            status_code=400,
            detail=t("mcp.configure_before_testing"),
        )
    if transport in {"sse", "streamableHttp"}:
        ok, error = validate_mcp_url(cfg.url)
        if not ok:
            raise HTTPException(status_code=400, detail=error)
    return await probe_server(cfg)

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Fill in either command (stdio) or url (sse/streamableHttp) in the test request body
  2. If testing a saved server, first complete its configuration via the upsert endpoint
  3. In UIs, disable the Test button until a transport field is populated

Example fix

// before
await api.post('/mcp/test', { name: 'fs' });

// after
await api.post('/mcp/test', { name: 'fs', command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'] });
Defensive patterns

Strategy: type-guard

Validate before calling

if (!cfg.command && !cfg.url) {
  throw new Error('Configure a command or url before testing this MCP server');
}

Type guard

function isTestable(cfg: MCPServerConfig): boolean {
  return Boolean(cfg?.command || cfg?.url);
}

Try / catch

try {
  await api.post('/mcp/test', cfg);
} catch (e) {
  if (e.status === 400 && /configure/i.test(e.detail)) {
    // fill in transport fields and retry
  }
}

Prevention

When it happens

Trigger: POST to the MCP /test endpoint with a body like {"name": "x"} — no command and no url — so the probe cannot determine stdio vs HTTP transport.

Common situations: Testing a server entry saved as a placeholder before its transport fields were filled; a settings dialog that lets users click 'Test' on an incomplete form; client sending an empty config object by mistake.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/e527db6e9a4e4187. Report an issue: GitHub.